本文整理汇总了PHP中mssql_rows_affected函数的典型用法代码示例。如果您正苦于以下问题:PHP mssql_rows_affected函数的具体用法?PHP mssql_rows_affected怎么用?PHP mssql_rows_affected使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mssql_rows_affected函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeQuery
private function executeQuery()
{
$return = false;
if ($this->queryType == 'other') {
if (mssql_query($this->query, $this->link) === true) {
$return = true;
$this->error = mssql_get_last_message();
}
} else {
if ($result = mssql_query($this->query, $this->link)) {
// Conteo de registros
if ($this->queryType == 'insert' || $this->queryType == 'update' || $this->queryType == 'delete') {
$this->numRows = mssql_rows_affected($this->link);
$return = true;
} else {
$this->numRows = mssql_num_rows($result);
$fetchType = MSSQL_NUM;
if ($this->queryReturn == 'assoc') {
$fetchType = MSSQL_ASSOC;
} elseif ($this->queryReturn == 'both') {
$fetchType = MSSQL_BOTH;
}
$return = array();
while ($row = mssql_fetch_array($result, $fetchType)) {
array_push($return, $row);
}
}
$this->error = mssql_get_last_message();
mssql_free_result($result);
} else {
$this->error = mssql_get_last_message();
}
}
return $return;
}
示例2: count_affected
function count_affected()
{
if (ANEWT_DATABASE_MSSQL_ROWS_AFFECTED_EXISTS) {
return mssql_rows_affected($this->rs);
} else {
return $this->rowcount;
}
}
示例3: _doExec
protected function _doExec($query)
{
if (!mssql_select_db($this->profile['database'], $this->_connection)) {
throw new jException('jelix~db.error.database.unknown', $this->profile['database']);
}
if ($qI = mssql_query($query, $this->_connection)) {
return mssql_rows_affected($this->_connection);
} else {
throw new jException('jelix~db.error.query.bad', mssql_get_last_message());
}
}
示例4: doQuery
/**
Does the mssql-dependent work of the execute method.
@param $sQuery The query to execute.
@return weeSQLiteResult A result set for SELECT queries.
*/
protected function doQuery($sQuery)
{
// mssql_query triggers a warning when the query could not be executed.
$m = @mssql_query($sQuery, $this->rLink);
$m === false and burn('DatabaseException', sprintf(_WT("Failed to execute the query with the following error:\n%s"), mssql_get_last_message()));
// Get it now since it can be wrong if numAffectedRows is called after getPKId
$this->iNumAffectedRows = mssql_rows_affected($this->rLink);
if ($m !== true) {
return new weeMSSQLResult($m);
}
}
示例5: exec
public function exec(&$statement)
{
if ($result = @mssql_query($statement, $this->link)) {
if (is_resource($result)) {
mssql_free_result($result);
return 0;
}
return mssql_rows_affected($this->link);
}
return false;
}
示例6: execute
public function execute($sql, $bindParams = array(), $additionalParameters = array())
{
$sql = $this->bind($sql, $bindParams);
if ($result = mssql_query($sql, $this->connection)) {
$rows = array();
if (is_resource($result)) {
while ($row = mssql_fetch_assoc($result)) {
$rows[] = $row;
}
mssql_free_result($result);
$this->affectedRows = 0;
} else {
$this->affectedRows = mssql_rows_affected($this->connection);
}
return empty($rows) ? null : $rows;
} else {
$this->executeError($sql);
}
}
示例7: affected_rows
/**
* Return the number of affected rows
* @return int
*/
protected function affected_rows()
{
return @mssql_rows_affected($this->resConnection);
}
示例8: affected_rows
public function affected_rows($resource = null)
{
return mssql_rows_affected(is_resource($resource) ? $resouce : $this->getConnection());
}
示例9: _affectedRows
protected function _affectedRows()
{
return mssql_rows_affected($this->connection);
}
示例10: execute
/**
* (non-PHPdoc)
*
* @see Core_DB::execute()
*/
public function execute($str)
{
$this->parse_query($str);
if (!is_resource($this->link)) {
$this->connect();
}
N('db_write', 1);
G('queryStartTime');
$result = mssql_query($this->query_str, $this->link);
$this->debug();
if (false === $result) {
$this->error();
return false;
} else {
$this->num_rows = mssql_rows_affected($this->link);
$this->lastinsid = $this->mssql_insert_id();
return $this->num_rows;
}
}
示例11: affectedRows
/**
* Return the number of rows affected by the previous operation.
* @return int
*/
public function affectedRows()
{
if ($this->mssql) {
return mssql_rows_affected($this->dbConn);
} else {
return $this->lastAffectedRows;
}
}
示例12: _post_query
function _post_query($query, $dbh)
{
++$this->num_queries;
// If there is an error then take note of it..
if ($this->result == FALSE && ($this->last_error = mssql_get_last_message())) {
$this->log_query($this->last_error);
//var_dump($query);
//var_dump($this->translation_changes);
$this->print_error();
return false;
}
if (defined('SAVEQUERIES') && SAVEQUERIES) {
$this->queries[] = array($query, $this->timer_stop(), $this->get_caller());
}
if (preg_match("/^\\s*(insert|delete|update|replace) /i", $query)) {
$this->rows_affected = mssql_rows_affected($dbh);
// Take note of the insert_id
if (preg_match("/^\\s*(insert|replace) /i", $query)) {
$result = @mssql_fetch_object(@mssql_query("SELECT SCOPE_IDENTITY() AS ID"));
$this->insert_id = $result->ID;
}
$return_val = $this->rows_affected;
} else {
$i = 0;
while ($i < @mssql_num_fields($this->result)) {
$field = @mssql_fetch_field($this->result, $i);
$new_field = new stdClass();
$new_field->name = $field->name;
$new_field->table = $field->column_source;
$new_field->def = null;
$new_field->max_length = $field->max_length;
$new_field->not_null = true;
$new_field->primary_key = null;
$new_field->unique_key = null;
$new_field->multiple_key = null;
$new_field->numeric = $field->numeric;
$new_field->blob = null;
$new_field->type = $field->type;
if (isset($field->unsigned)) {
$new_field->unsigned = $field->unsigned;
} else {
$new_field->unsigned = null;
}
$new_field->zerofill = null;
$this->col_info[$i] = $new_field;
$i++;
}
$num_rows = 0;
while ($row = @mssql_fetch_object($this->result)) {
$this->last_result[$num_rows] = $row;
$num_rows++;
}
$this->last_result = $this->fix_results($this->last_result);
// perform limit
if (!empty($this->limit)) {
$this->last_result = array_slice($this->last_result, $this->limit['from'], $this->limit['to']);
$num_rows = count($this->last_result);
}
@mssql_free_result($this->result);
// Log number of rows the query returned
$this->num_rows = $num_rows;
// Return number of rows selected
$return_val = $this->num_rows;
}
$this->log_query();
return $return_val;
}
示例13: update_entity
/**
* 更新数据
* @param string $table 表名
* @param mixed $condition 要更新的where条件或者字符下标的条件数组
* @param array $data 要更新的数据,字符下标的数组形式
* @param array $pam 数字下标的数组,数组项依次替换$condition中的"?"参数
* @return integer 成功返回受影响的行数,更新失败返回null
*/
function update_entity($table, $condition = null, $data = array(), $pam = null)
{
$ssql = "update [{$table}] set ";
$vars = array();
$vals = array();
$columns = $this->list_fields($table);
foreach ($data as $k => $val) {
if (in_array($k, $columns)) {
$vars[] = "[{$k}]=@yYUc_SqL@ ";
$vals[] = $val === null ? self::raw('null') : $val;
}
}
$ssql .= implode(",", $vars);
if (!empty($condition)) {
if (is_string($condition)) {
$condition = str_replace('?', '@yYUc_SqL@', $condition);
}
$whereres = $this->con_sql($condition, $pam);
$ssql .= trim($whereres[0]);
$pam = $whereres[1];
if ($pam !== null) {
$vals = array_merge($vals, $pam);
}
}
if ($this->execute($ssql, $vals)) {
return mssql_rows_affected($this->conn);
}
return null;
}
示例14: affectedRows
public function affectedRows()
{
return mssql_rows_affected($this->linkID);
}
示例15: getAffectedRowCount
function getAffectedRowCount()
{
return mssql_rows_affected($this->connection->getConnectionId());
}