当前位置: 首页>>代码示例>>PHP>>正文


PHP pg_affected_rows函数代码示例

本文整理汇总了PHP中pg_affected_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_affected_rows函数的具体用法?PHP pg_affected_rows怎么用?PHP pg_affected_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pg_affected_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: affected

 function affected()
 {
     if (is_null($this->affected)) {
         $this->affected = pg_affected_rows($this->q);
     }
     return $this->affected;
 }
开发者ID:jmcclenon,项目名称:yourTinyTodo,代码行数:7,代码来源:class.db.postgres.php

示例2: affectedRows

 public function affectedRows()
 {
     if (!is_resource($this->result)) {
         return false;
     }
     return pg_affected_rows($this->result);
 }
开发者ID:miknatr,项目名称:dbster,代码行数:7,代码来源:AdapterPgsqlResult.php

示例3: execute

 function execute()
 {
     $this->queryId = parent::execute();
     if (is_resource($this->queryId)) {
         return pg_affected_rows($this->queryId);
     }
 }
开发者ID:snowjobgit,项目名称:limb,代码行数:7,代码来源:lmbPgsqlManipulationStatement.class.php

示例4: comprobar_operacion

function comprobar_operacion($res, &$error)
{
    if (pg_affected_rows($res) == 0) {
        $error[] = "No se ha podido modificar el artículo.";
        throw new Exception();
    }
}
开发者ID:ricpelo,项目名称:juguetoon,代码行数:7,代码来源:auxiliar.php

示例5: __construct

 public function __construct($result, $sql, $as_object = FALSE, $params = NULL, $total_rows = NULL)
 {
     parent::__construct($result, $sql, $as_object, $params);
     if ($as_object === TRUE) {
         $this->_as_object = 'stdClass';
     }
     if ($total_rows !== NULL) {
         $this->_total_rows = $total_rows;
     } else {
         switch (pg_result_status($result)) {
             case PGSQL_TUPLES_OK:
                 $this->_total_rows = pg_num_rows($result);
                 break;
             case PGSQL_COMMAND_OK:
                 $this->_total_rows = pg_affected_rows($result);
                 break;
             case PGSQL_BAD_RESPONSE:
             case PGSQL_NONFATAL_ERROR:
             case PGSQL_FATAL_ERROR:
                 throw new Database_Exception(':error [ :query ]', array(':error' => pg_result_error($result), ':query' => $sql));
             case PGSQL_COPY_OUT:
             case PGSQL_COPY_IN:
                 throw new Database_Exception('PostgreSQL COPY operations not supported [ :query ]', array(':query' => $sql));
             default:
                 $this->_total_rows = 0;
         }
     }
 }
开发者ID:alekseyshavrak,项目名称:3cx,代码行数:28,代码来源:Result.php

示例6: affected_rows

 public function affected_rows()
 {
     if ($this->last_execute_result === null) {
         return 0;
     }
     return pg_affected_rows($this->last_execute_result);
 }
开发者ID:xpd1437,项目名称:swap,代码行数:7,代码来源:pgsql_rdb.php

示例7: updateAffectedRows

 protected function updateAffectedRows($result)
 {
     $this->affected_rows += pg_affected_rows($result);
     if ($this->affected_rows != 0 && $this->affected_rows % 500 == 0) {
         echo get_class($this) . " has affected " . $this->affected_rows . " row(s)...\n";
     }
 }
开发者ID:kidaa,项目名称:evedata,代码行数:7,代码来源:BaseMigrator.php

示例8: SetData

 public function SetData($setQuery)
 {
     $this->Connect();
     //var_dump('????', $setQuery, "???");
     $result = pg_query($this->connectionHandle, $setQuery);
     return pg_affected_rows($result);
 }
开发者ID:sparrow41,项目名称:training,代码行数:7,代码来源:DbHandle.php

示例9: sqlQuery

 function sqlQuery($query)
 {
     if (!$query) {
         return false;
     }
     if (b1n_DEBUG) {
         echo '<pre style="text-align: left">QUERY: ' . $query . '</pre>';
     }
     if (!$this->sqlIsConnected()) {
         user_error('DB NOT CONNECTED');
         return false;
     }
     $result = pg_query($this->sqlGetLink(), $query);
     if (is_bool($result)) {
         return pg_affected_rows($result);
     }
     $num = pg_num_rows($result);
     if ($num > 0) {
         for ($i = 0; $i < $num; $i++) {
             $row[$i] = pg_fetch_array($result, $i, PGSQL_ASSOC);
         }
         return $row;
     }
     return true;
 }
开发者ID:mmr,项目名称:b1n,代码行数:25,代码来源:sqllink.lib.php

示例10: castResult

 public static function castResult($result, array $a, Stub $stub, $isNested)
 {
     $a['num rows'] = pg_num_rows($result);
     $a['status'] = pg_result_status($result);
     if (isset(self::$resultStatus[$a['status']])) {
         $a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']);
     }
     $a['command-completion tag'] = pg_result_status($result, PGSQL_STATUS_STRING);
     if (-1 === $a['num rows']) {
         foreach (self::$diagCodes as $k => $v) {
             $a['error'][$k] = pg_result_error_field($result, $v);
         }
     }
     $a['affected rows'] = pg_affected_rows($result);
     $a['last OID'] = pg_last_oid($result);
     $fields = pg_num_fields($result);
     for ($i = 0; $i < $fields; ++$i) {
         $field = array('name' => pg_field_name($result, $i), 'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)), 'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)), 'nullable' => (bool) pg_field_is_null($result, $i), 'storage' => pg_field_size($result, $i) . ' bytes', 'display' => pg_field_prtlen($result, $i) . ' chars');
         if (' (OID: )' === $field['table']) {
             $field['table'] = null;
         }
         if ('-1 bytes' === $field['storage']) {
             $field['storage'] = 'variable size';
         } elseif ('1 bytes' === $field['storage']) {
             $field['storage'] = '1 byte';
         }
         if ('1 chars' === $field['display']) {
             $field['display'] = '1 char';
         }
         $a['fields'][] = new EnumStub($field);
     }
     return $a;
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:33,代码来源:PgSqlCaster.php

示例11: safe_dml_query

function safe_dml_query($query, $verbose = True)
{
    global $conn;
    if ($verbose) {
        echo "------------------------\n";
        echo "Executing PG query: {$query}\n";
    }
    $time_start = microtime(true);
    pg_send_query($conn, $query) or die("Failed to execute query {$query}");
    while (pg_connection_busy($conn)) {
        if (microtime(true) - $time_start > 30) {
            if (rand(0, 10) == 0) {
                echo "Busy for " . round((microtime(true) - $time_start) * 1000) . " ms -";
            }
            sleep(5);
        }
        usleep(2000);
    }
    $res = pg_get_result($conn);
    if (pg_result_error($res) != null) {
        die("Error during query: " . pg_result_error($res) . "\n");
    }
    $time_end = microtime(true);
    $rows = pg_affected_rows($res);
    if ($verbose) {
        echo "Done executing {$query}: {$rows} touched\n";
        $t = round(($time_end - $time_start) * 1000);
        echo "Query time: {$t} ms\n";
        echo "------------------------\n";
    }
}
开发者ID:johnpyeatt,项目名称:nominatiny,代码行数:31,代码来源:dbutils.inc.php

示例12: __construct

 /**
  * @param   resource    from pg_query() or pg_get_result()
  * @param   string      SQL used to create this result
  * @param   resource    from pg_connect() or pg_pconnect()
  * @param   boolean|string
  * @return  void
  */
 public function __construct($result, $sql, $link, $return_objects)
 {
     // PGSQL_COMMAND_OK     <- SET client_encoding = 'utf8'
     // PGSQL_TUPLES_OK      <- SELECT table_name FROM information_schema.tables
     // PGSQL_COMMAND_OK     <- INSERT INTO pages (name) VALUES ('gone soon')
     // PGSQL_COMMAND_OK     <- DELETE FROM pages WHERE id = 2
     // PGSQL_COMMAND_OK     <- UPDATE pb_users SET company_id = 1
     // PGSQL_FATAL_ERROR    <- SELECT FROM pages
     switch (pg_result_status($result)) {
         case PGSQL_EMPTY_QUERY:
             $this->total_rows = 0;
             break;
         case PGSQL_COMMAND_OK:
             $this->total_rows = pg_affected_rows($result);
             break;
         case PGSQL_TUPLES_OK:
             $this->total_rows = pg_num_rows($result);
             break;
         case PGSQL_COPY_OUT:
         case PGSQL_COPY_IN:
             Kohana_Log::add('debug', 'PostgreSQL COPY operations not supported');
             break;
         case PGSQL_BAD_RESPONSE:
         case PGSQL_NONFATAL_ERROR:
         case PGSQL_FATAL_ERROR:
             throw new Database_Exception(':error [ :query ]', array(':error' => pg_result_error($result), ':query' => $sql));
     }
     $this->link = $link;
     $this->result = $result;
     $this->return_objects = $return_objects;
     $this->sql = $sql;
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:39,代码来源:Database_Postgresql_Result.php

示例13: Afficher

 public function Afficher()
 {
     if (isset($_SESSION["compte"]) && !empty($_SESSION["compte"])) {
         // - gestion spécifique de la page
         $account_id = $_SESSION['compte']->id;
         $djun_name = $_SESSION['djun_choisi']->nom;
         // - On supprime le D'jun
         $sql = "DELETE FROM \"libertribes\".\"AVATAR\"  WHERE compte_id = {$account_id} and avatar_nom ='{$djun_name}'";
         $result = $this->db_connexion->Requete($sql);
         if (!$result || pg_affected_rows($result) == 0) {
             // - redirection vers la page djun_suppression avec un message d'erreur
             header('Location: index.php?page=djun_suppression&erreur=1');
             exit;
         }
         //  restructurer la variable de session avatar s'il y a plusieurs avatars
         $avatars = array();
         $i = 0;
         foreach ($_SESSION['avatars'] as $avatar) {
             if ($avatar->nom != $_SESSION['djun_choisi']->nom) {
                 $avatars[$i] = $avatar;
                 $i++;
             }
         }
         unset($_SESSION['avatars']);
         $_SESSION['avatars'] = $avatars;
         unset($_SESSION['djun_choisi']);
         unset($_SESSION["avatar_name"]);
         // - redirection vers la page TDB
         header('Location: index.php?page=tdb');
     } else {
         header('Location: index.php?page=connexion&erreur=3');
         exit;
     }
 }
开发者ID:domiboo,项目名称:libertribes_fromneosys,代码行数:34,代码来源:class_page_djun_suppression_validation.php

示例14: query

 public function query($string = '')
 {
     if ($string != '') {
         $this->query = $this->escape($string);
     } else {
         $this->query = $this->select . $this->insert . $this->update . $this->delete . $this->create . $this->from . $this->join . $this->where . $this->group . $this->order . $this->limit;
     }
     $this->insert = " RETURNING id";
     $this->result = pg_exec($this->connection, $this->query);
     $this->inserted_id = $this->result;
     $this->error = pg_errormessage($this->connection);
     $this->affected_rows = pg_affected_rows($this->result);
     $this->select = '';
     $this->insert = '';
     $this->update = '';
     $this->delete = '';
     $this->create = '';
     $this->from = '';
     $this->join = '';
     $this->where = '';
     $this->group = '';
     $this->order = '';
     $this->limit = '';
     return $this;
 }
开发者ID:varyan,项目名称:system,代码行数:25,代码来源:postgresql.php

示例15: rowsAffected

 public function rowsAffected($result)
 {
     $affectedRows = pg_affected_rows($result);
     if (!$affectedRows) {
         $affectedRows = pg_num_rows($result);
     }
     return $affectedRows;
 }
开发者ID:php-yaoi,项目名称:php-yaoi,代码行数:8,代码来源:Pgsql.php


注:本文中的pg_affected_rows函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。