/** * Creates a new PostgreSQLSelectQueryResult object. * Creates a new PostgreSQLSelectQueryResult object. * @access public * @param integer $resourceId The resource id for this SELECT query. * @param integer $linkId The link identifier for the database connection. * @return object PostgreSQLSelectQueryResult A new PostgreSQLSelectQueryResult object. */ function PostgreSQLSelectQueryResult($resourceId, $linkId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); ArgumentValidator::validate($resourceId, $resourceRule, true); ArgumentValidator::validate($linkId, $resourceRule, true); // ** end of parameter validation $this->_resourceId = $resourceId; $this->_linkId = $linkId; $this->_currentRowIndex = 0; $this->_currentRow = array(); $this->_currentRow[BOTH] = array(); $this->_currentRow[NUMERIC] = array(); $this->_currentRow[ASSOC] = array(); // if we have at least one row in the result, fetch its array if ($this->hasMoreRows()) { $this->_currentRow[BOTH] = pg_fetch_array($this->_resourceId); foreach ($this->_currentRow[BOTH] as $key => $value) { if (is_int($key)) { $this->_currentRow[NUMERIC][$key] = $value; } else { $this->_currentRow[ASSOC][$key] = $value; } } } }
/** * Creates a new OracleSelectQueryResult object. * Creates a new OracleSelectQueryResult object. * @access public * @param integer $resourceId The resource id for this SELECT query. * @param integer $linkId The link identifier for the database connection. * @return object OracleSelectQueryResult A new OracleSelectQueryResult object. */ function OracleSelectQueryResult($resourceId, $linkId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); ArgumentValidator::validate($resourceId, $resourceRule, true); ArgumentValidator::validate($linkId, $resourceRule, true); // ** end of parameter validation $this->_resourceId = $resourceId; $this->_linkId = $linkId; $this->_currentRowIndex = 0; $this->_currentRow = array(); $this->_currentRow[BOTH] = array(); $this->_currentRow[NUMERIC] = array(); $this->_currentRow[ASSOC] = array(); $this->_numRows = ocifetchstatement($this->_resourceId); ociexecute($this->_resourceId); // if we have at least one row in the result, fetch its array if ($this->hasMoreRows()) { ocifetchinto($this->_resourceId, $this->_currentRow[BOTH], OCI_ASSOC + OCI_NUM + OCI_RETURN_LOBS); foreach ($this->_currentRow[BOTH] as $key => $value) { if (is_int($key)) { $this->_currentRow[NUMERIC][$key] = $value; } else { $this->_currentRow[ASSOC][$key] = $value; } } } }
/** * The constructor. * @access public * @param integer $resourceId The resource id for this query. */ function OracleDeleteQueryResult($resourceId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); ArgumentValidator::validate($resourceId, $resourceRule, true); // ** end of parameter validation $this->_resourceId = $resourceId; $this->_numberOfRows = ocirowcount($this->_resourceId); }
/** * The constructor. * @access public * @param integer $resourceId The resource id for this query. */ function PostgreSQLUpdateQueryResult($resourceId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); ArgumentValidator::validate($resourceId, $resourceRule, true); // ** end of parameter validation $this->_resourceId = $resourceId; $this->_numberOfRows = pg_affected_rows($this->_resourceId); }
/** * Creates a new MySQLDeleteQueryResult object. * Creates a new MySQLDeleteQueryResult object. * @access public * @param integer $linkId The link identifier for the database connection. * @return object MySQLDeleteQueryResult A new MySQLDeleteQueryResult object. */ function MySQLDeleteQueryResult($linkId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); ArgumentValidator::validate($linkId, $resourceRule, true); // ** end of parameter validation $this->_linkId = $linkId; $this->_numberOfRows = mysql_affected_rows($this->_linkId); }
/** * Constructor * * @param integer $resourceId The resource id for this SELECT query. * @param integer $linkId The link identifier for the database connection. * @access public * @since 7/2/04 */ function PostgreSQLGenericQueryResult($resourceId, $linkId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); if (!is_bool($resourceId)) { ArgumentValidator::validate($resourceId, $resourceRule, true); } ArgumentValidator::validate($linkId, $resourceRule, true); // ** end of parameter validation $this->_resourceId = $resourceId; $this->_linkId = $linkId; }
/** * Creates a new OracleINSERTQueryResult object. * @access public * @param integer $resourceId The resource id for this query. * @param integer $lastId The last id that was inserted * @return object A new OracleINSERTQueryResult object. */ function OracleInsertQueryResult($resourceId, $lastId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); $integerRule = OptionalRule::getRule(IntegerValidatorRule::getRule()); ArgumentValidator::validate($resourceId, $resourceRule, true); ArgumentValidator::validate($lastId, $integerRule, true); // ** end of parameter validation $this->_resourceId = $resourceId; $this->_numberOfRows = ocirowcount($this->_resourceId); $this->_lastAutoIncrementValue = $lastId; }
/** * Creates a new MySQLINSERTQueryResult object. * Creates a new MySQLINSERTQueryResult object. * @access public * @param integer $linkId The link identifier for the database connection. * @return object MySQLINSERTQueryResult A new MySQLINSERTQueryResult object. */ function MySQLInsertQueryResult($linkId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); ArgumentValidator::validate($linkId, $resourceRule, true); // ** end of parameter validation $this->_linkId = $linkId; $this->_numberOfRows = mysql_affected_rows($this->_linkId); // in MySQL, when inserting several rows with one INSERT query, // mysql_insert_id() returns the id of the first row. // Thus, we need to add the number of inserted rows - 1 to get the actual // last id. $this->_lastAutoIncrementValue = mysql_insert_id($this->_linkId) + $this->getNumberOfRows() - 1; }