Пример #1
0
 public function __get($strName)
 {
     switch ($strName) {
         case 'AffectedRows':
             return mssql_affected_rows($this->objMsSql);
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Пример #2
0
/**
 * Returns the number of rows affected by the last INSERT, UPDATE or DELETE.
 *
 * <b>Note:</b> Use the {@link dbi_error()} function to get error information
 * if the connection fails.
 *
 * @param resource $conn The database connection
 * @param resource $res  The database query resource returned from
 *                       the {@link dbi_query()} function.
 *
 * @return int The number or database rows affected.
 */
function dbi_affected_rows($conn, $res)
{
    if (strcmp($GLOBALS["db_type"], "mysql") == 0) {
        return mysql_affected_rows($conn);
    } else {
        if (strcmp($GLOBALS["db_type"], "mysqli") == 0) {
            return mysqli_affected_rows($conn);
        } else {
            if (strcmp($GLOBALS["db_type"], "mssql") == 0) {
                return mssql_affected_rows($conn);
            } else {
                if (strcmp($GLOBALS["db_type"], "oracle") == 0) {
                    if ($GLOBALS["oracle_statement"] >= 0) {
                        return OCIRowCount($GLOBALS["oracle_statement"]);
                    } else {
                        return -1;
                    }
                } else {
                    if (strcmp($GLOBALS["db_type"], "postgresql") == 0) {
                        return pg_affected_rows($res);
                    } else {
                        if (strcmp($GLOBALS["db_type"], "odbc") == 0) {
                            return odbc_num_rows($res);
                        } else {
                            if (strcmp($GLOBALS["db_type"], "ibm_db2") == 0) {
                                return db2_num_rows($res);
                            } else {
                                if (strcmp($GLOBALS["db_type"], "ibase") == 0) {
                                    return ibase_affected_rows($conn);
                                } else {
                                    dbi_fatal_error("dbi_free_result(): db_type not defined.");
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Пример #3
0
 /**
  * @return int The number of affected rows in the previous operation
  * @since 1.0.5
  */
 function getAffectedRows()
 {
     return mssql_affected_rows($this->_resource);
 }
Пример #4
0
                                 $b1 .= '<td nowrap>' . html_clean($inside) . '&nbsp;</td>';
                             }
                             $where = base64_encode($where);
                             if ($allowedit) {
                                 p('<td nowrap><a href="javascript:editrecord(\'edit\', \'' . $where . '\', \'' . $tablename . '\');">Edit</a> | <a href="javascript:editrecord(\'del\', \'' . $where . '\', \'' . $tablename . '\');">Del</a></td>');
                             }
                             p($b1);
                             p('</tr>');
                             $index++;
                             unset($b1);
                         }
                         tbfoot();
                         p($multipage);
                         break;
                     case 2:
                         $ar = mssql_affected_rows();
                         p('<h2>affected rows : <b>' . $ar . '</b></h2>');
                         break;
                 }
             }
         }
     }
 } else {
     $query = msq("select sysobjects.id,sysobjects.name,sysobjects.category,sysusers.name as owner,sysobjects.crdate from sysobjects join sysusers on sysobjects.uid = sysusers.uid where sysobjects.xtype = 'U' order by sysobjects.name asc");
     $table_num = 0;
     $tabledb = array();
     while ($table = mssql_fetch_array($query)) {
         $table_num++;
         $tabledb[] = $table;
     }
     unset($table);
 function affected_rows()
 {
     switch ($this->db) {
         case 'MySQL':
             return @mysql_affected_rows($this->res);
             break;
         case 'MSSQL':
             return @mssql_affected_rows($this->res);
             break;
         case 'PostgreSQL':
             return @pg_affected_rows($this->res);
             break;
         case 'Oracle':
             return @ocirowcount($this->res);
             break;
         default:
             return 0;
             break;
     }
 }
 /**
  * Número de Filas afectadas en un insert, update o delete
  *
  * @param resource $result_query
  * @return int
  */
 public function affected_rows($result_query = '')
 {
     if (($numberRows = mssql_affected_rows()) !== false) {
         return $numberRows;
     } else {
         $this->lastError = $this->error();
         throw new KumbiaException($this->error());
     }
     return false;
 }
Пример #7
0
 /**
  * returns the affected rows of a query
  *
  * @return mixed MDB2 Error Object or number of rows
  * @access public
  */
 function affectedRows()
 {
     $affected_rows = @mssql_affected_rows($this->connection);
     if ($affected_rows === false) {
         return $this->raiseError(MDB2_ERROR_NEED_MORE_DATA);
     }
     return $affected_rows;
 }
Пример #8
0
 public function insert_update($table, $data, $condition)
 {
     # Params:
     # 		$table = the name of the table
     # 		$data = field/value pairs to be added/updated
     # 		$condition = example: where id = 99
     if ($table) {
         if ($data) {
             if ($condition) {
                 if ($this->row_exists("select * from {$table} where {$condition}")) {
                     $this->result = mssql_query("update {$table} set {$data} where {$condition}") or $this->setError(mssql_error(), mssql_errno());
                     $this->query = "update {$table} set {$data} where {$condition}";
                     if ($this->result) {
                         $this->affected = intval(mssql_affected_rows());
                         // return the number of rows affected
                         return $this->affected;
                     }
                 } else {
                     $this->result = mssql_query("insert into {$table} set {$data}") or $this->setError(mssql_error(), mssql_errno());
                     $this->query = "insert into {$table} set {$data}";
                     if ($this->result) {
                         $this->insert_id = intval(mssql_insert_id());
                         $this->affected = intval(mssql_affected_rows());
                         // return the number of rows affected
                         return $this->affected;
                     }
                 }
             } else {
                 print "No Condition Specified !!";
             }
         } else {
             print "No Data Specified !!";
         }
     } else {
         print "No Table Specified !!";
     }
 }
Пример #9
0
 function _performQuery($queryMain)
 {
     $this->_lastQuery = $queryMain;
     $this->_expandPlaceholders($queryMain, false);
     $result = mssql_query($queryMain[0], $this->link);
     if ($result === false) {
         return $this->_setDbError($queryMain[0]);
     }
     if (!is_resource($result)) {
         if (preg_match('/^\\s* INSERT \\s+/six', $queryMain[0])) {
             // INSERT queries return generated ID.
             $result = mssql_fetch_assoc(mssql_query("SELECT SCOPE_IDENTITY() AS insert_id", $this->link));
             return isset($result['insert_id']) ? $result['insert_id'] : true;
         }
         // Non-SELECT queries return number of affected rows, SELECT - resource.
         if (function_exists('mssql_affected_rows')) {
             return mssql_affected_rows($this->link);
         } elseif (function_exists('mssql_rows_affected')) {
             return mssql_rows_affected($this->link);
         }
     }
     return $result;
 }
 private function execute_mssql($sSQL)
 {
     //Cuando se recupera un objeto desde sesion no cuenta
     //con linkid (linkid = 0)
     if (empty($this->_oLinkId)) {
         $this->conectar();
     }
     try {
         $oResource = mysql_query($sSQL, $this->_oLinkId);
         if ($oResource != false) {
             $this->_iRowsAffected = mssql_affected_rows();
             //mssql_free_result($oResource);
             $this->_isError = false;
             $this->_sMensaje = "executed: {$sSQL}";
             return true;
         } else {
             $this->_isError = true;
             $this->_sMensaje = "ERROR EN SQL: {$sSQL}";
             return -1;
         }
     } catch (Exception $e) {
         $sMensaje = "Excepción: " . $e->getMessage();
         $sMensaje .= "\nSQL = {$sSQL}";
         $this->_isError = true;
         $this->_sMensaje = $sMensaje;
         return -1;
     }
 }
Пример #11
0
 function affected_rows()
 {
     return mssql_affected_rows($this->Query_ID);
 }
Пример #12
0
 /**
  * NumAffected
  *
  * Returns the number of affected rows on success.
  *
  * @param  mixed $null Placeholder for postgres compatability
  *
  * @return int
  */
 function NumAffected($null)
 {
     return mssql_affected_rows($this->connection);
 }
Пример #13
0
 public function affectedRows()
 {
     return @mssql_affected_rows($this->connection);
 }