コード例 #1
0
 /**
  * Static Qcodo Query method to query for an array of InventoryTransaction objects.
  * Uses BuildQueryStatment to perform most of the work.
  * @param QQCondition $objConditions any conditions on the query, itself
  * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  * @return InventoryTransaction[] the queried objects as an array
  */
 public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null)
 {
     // Get the Query Statement
     try {
         $strQuery = InventoryTransaction::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     // Perform the Query and Instantiate the Array Result
     $objDbResult = $objQueryBuilder->Database->Query($strQuery);
     return InventoryTransaction::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes);
 }
コード例 #2
0
    /**
     * Load an array of InventoryTransaction objects,
     * by Inventory ModelId
     * @param integer $intInventoryModelId
     * @param string $strOrderBy
     * @param string $strLimit
     * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
     * @return InventoryTransaction[]
     */
    public static function LoadArrayByInventoryModelId($intInventoryModelId, $strOrderBy = null, $strLimit = null, $objExpansionMap = null)
    {
        // Call to ArrayQueryHelper to Get Database Object and Get SQL Clauses
        InventoryTransaction::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Properly Escape All Input Parameters using Database->SqlVariable()
        $intInventoryModelId = $objDatabase->SqlVariable($intInventoryModelId, true);
        // Setup the SQL Query
        $strQuery = sprintf('
				SELECT
				%s
					`inventory_transaction`.`inventory_transaction_id` AS `inventory_transaction_id`,
					`inventory_transaction`.`inventory_location_id` AS `inventory_location_id`,
					`inventory_transaction`.`transaction_id` AS `transaction_id`,
					`inventory_transaction`.`quantity` AS `quantity`,
					`inventory_transaction`.`source_location_id` AS `source_location_id`,
					`inventory_transaction`.`destination_location_id` AS `destination_location_id`
					%s
				FROM
					`inventory_location` AS `inventory_location`,
					`inventory_transaction` AS `inventory_transaction`
					%s
				WHERE
					`inventory_location`.`inventory_model_id` %s
					AND `inventory_location`.`inventory_location_id` = `inventory_transaction`.`inventory_location_id`
				%s
				%s', $strLimitPrefix, $strExpandSelect, $strExpandFrom, $intInventoryModelId, $strOrderBy, $strLimitSuffix);
        // Perform the Query and Instantiate the Result
        $objDbResult = $objDatabase->Query($strQuery);
        return InventoryTransaction::InstantiateDbResult($objDbResult);
    }
コード例 #3
0
 /**
  * Gets the historical journal for an object from the log database.
  * Objects will have VirtualAttributes available to lookup login, date, and action information from the journal object.
  * @param integer intInventoryTransactionId
  * @return InventoryTransaction[]
  */
 public static function GetJournalForId($intInventoryTransactionId)
 {
     $objDatabase = InventoryTransaction::GetDatabase()->JournalingDatabase;
     $objResult = $objDatabase->Query('SELECT * FROM inventory_transaction WHERE inventory_transaction_id = ' . $objDatabase->SqlVariable($intInventoryTransactionId) . ' ORDER BY __sys_date');
     return InventoryTransaction::InstantiateDbResult($objResult);
 }