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


PHP mssql_data_seek函数代码示例

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


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

示例1: set_result_pointer

 public function set_result_pointer($offset = 0)
 {
     if ($this->num_rows()) {
         return mssql_data_seek($this->resource, $offset);
     }
     return false;
 }
开发者ID:codifyllc,项目名称:phpopenfw,代码行数:7,代码来源:dr_mssql.class.php

示例2: query

 public function query($sql, $start = null, $perpage = null, $nolimit = false)
 {
     $start and !$perpage and $perpage = 10000;
     $query = mssql_query($sql, $this->dbConnection());
     if ($start) {
         $qcount = mssql_num_rows($query);
         if ($qcount < $start) {
             return array();
         } else {
             mssql_data_seek($query, $start);
         }
     }
     if ($query) {
         $result = array();
         while ($row = mssql_fetch_assoc($query)) {
             if (DBCHARSET == 'gbk' && CHARSET != 'gbk') {
                 $row = Base_Class::gbktoutf($row);
             }
             $result[] = $row;
             if ($perpage && count($result) >= $perpage) {
                 break;
             }
         }
         return $result;
     } else {
         $this->halt("数据库查询错误", $sql);
     }
 }
开发者ID:huangbinzd,项目名称:kppwGit,代码行数:28,代码来源:mssql_driver.php

示例3: seek

 /**
  * Seek
  *
  * @param   int offset
  * @return  bool success
  * @throws  rdbms.SQLException
  */
 public function seek($offset)
 {
     if (!mssql_data_seek($this->handle, $offset)) {
         throw new SQLException('Cannot seek to offset ' . $offset);
     }
     return TRUE;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:14,代码来源:MsSQLResultSet.class.php

示例4: next

 function next()
 {
     $this->cur++;
     if ($this->cur > $this->max) {
         return false;
     }
     mssql_data_seek($this->res, $this->cur);
     return mssql_fetch_assoc($this->res);
 }
开发者ID:laiello,项目名称:zoop,代码行数:9,代码来源:DbMssqlResult.php

示例5: mssqlAdapter

 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * @param resource $d The datasource resource
  */
 function mssqlAdapter($d)
 {
     parent::RecordSetAdapter($d);
     $fieldcount = mssql_num_fields($d);
     // grab the number of fields
     $ob = "";
     $be = $this->isBigEndian;
     $fc = pack('N', $fieldcount);
     if (mssql_num_rows($d) > 0) {
         mssql_data_seek($d, 0);
         while ($line = mssql_fetch_row($d)) {
             // write all of the array elements
             $ob .= "\n" . $fc;
             foreach ($line as $value) {
                 // write all of the array elements
                 if (is_string($value)) {
                     // type as string
                     $os = $this->_directCharsetHandler->transliterate($value);
                     //string flag, string length, and string
                     $len = strlen($os);
                     if ($len < 65536) {
                         $ob .= "" . pack('n', $len) . $os;
                     } else {
                         $ob .= "\f" . pack('N', $len) . $os;
                     }
                 } elseif (is_float($value) || is_int($value)) {
                     // type as double
                     $b = pack('d', $value);
                     // pack the bytes
                     if ($be) {
                         // if we are a big-endian processor
                         $r = strrev($b);
                     } else {
                         // add the bytes to the output
                         $r = $b;
                     }
                     $ob .= "" . $r;
                 } elseif (is_bool($value)) {
                     //type as bool
                     $ob .= "";
                     $ob .= pack('c', $value);
                 } elseif (is_null($value)) {
                     // null
                     $ob .= "";
                 }
             }
         }
     }
     $this->serializedData = $ob;
     for ($i = 0; $i < $fieldcount; $i++) {
         // loop over all of the fields
         $this->columnNames[] = $this->_directCharsetHandler->transliterate(mssql_field_name($d, $i));
     }
     $this->numRows = mssql_num_rows($d);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:61,代码来源:mssqlAdapter.php

示例6: SetRow

 /**
  * Go to a row int the RecordSet.
  *
  * @param int $row Row to go to.
  * @return bool Returns TRUE on success, FALSE if failed.
  */
 function SetRow($row = 0)
 {
     if (!mssql_num_rows($this->result)) {
         return FALSE;
     }
     if (!mssql_data_seek($this->result, $row)) {
         return FALSE;
     }
     $this->row = $row;
     return TRUE;
 }
开发者ID:JAMNConsultoria,项目名称:snaids,代码行数:17,代码来源:RS_MSSQL.class.php

示例7: query

 public function query($sql)
 {
     LogMaster::log($sql);
     $res = mssql_query($sql, $this->connection, $this->start_from === false ? 10 : 0);
     if ($this->insert_operation) {
         $last = mssql_fetch_assoc($res);
         $this->last_id = $last["dhx_id"];
         mysql_free_result($res);
     }
     if ($this->start_from !== false) {
         mssql_data_seek($res, $this->start_from);
     }
     return $res;
 }
开发者ID:Jellious,项目名称:test2223,代码行数:14,代码来源:db_mssql.php

示例8: mssqlAdapter

 /**
  * Constructor method for the adapter.  This constructor implements the setting of the
  * 3 required properties for the object.
  * 
  * @param resource $d The datasource resource
  */
 function mssqlAdapter($d)
 {
     parent::RecordSetAdapter($d);
     $fieldcount = mssql_num_fields($d);
     // grab the number of fields
     for ($i = 0; $i < $fieldcount; $i++) {
         // loop over all of the fields
         $this->columnNames[] = mssql_field_name($d, $i);
     }
     if (mssql_num_rows($d) > 0) {
         mssql_data_seek($d, 0);
         while ($line = mssql_fetch_row($d)) {
             $this->rows[] = $line;
         }
     }
 }
开发者ID:BGCX067,项目名称:ezplanner-svn-to-git,代码行数:22,代码来源:mssqlAdapter.php

示例9: db_dataseek

function db_dataseek($qhandle, $row)
{
    if ($row > 0) {
        mssql_data_seek($qhandle, $row);
    }
}
开发者ID:samsulpendis,项目名称:Instant_Appointment,代码行数:6,代码来源:dbconnection.mssql.unix.php

示例10: p

     p('<td nowrap>' . $tb['name'] . '<br><span>' . $tb['type'] . '(' . $tb['length'] . ') ' . ($tb['colstat'] ? '<b> - PRIMARY</b>' : '') . ($tb['autoval'] ? '<b> - Auto</b>' : '') . '</span></td>');
     $rowdb[$tb['name']]['Key'] = $tb['colstat'];
     $rowdb[$tb['name']]['Auto'] = $tb['autoval'];
     if ($tb['colstat']) {
         $keyfied = $tb['name'];
     }
 }
 p('</tr>');
 //直接浏览表按照主键降序排列
 if (strtolower(substr($query, 0, 13)) == 'select * from') {
     $query .= " order by {$keyfied} DESC";
 }
 $result = msq($query);
 $index = 0;
 if ($pagenum > 0) {
     mssql_data_seek($result, $start_limit);
 }
 while ($mn = @mssql_fetch_assoc($result)) {
     if ($index > $pagenum - 1) {
         break;
     }
     $thisbg = bg();
     p('<tr class="' . $thisbg . '" onmouseover="this.className=\'focus\';" onmouseout="this.className=\'' . $thisbg . '\';">');
     $where = $tmp = $b1 = '';
     //选取条件字段用
     foreach ($mn as $key => $inside) {
         if ($inside) {
             //查找主键、唯一属性、自动增加的字段,找到就停止,否则组合所有字段作为条件。
             if ($rowdb[$key]['Key'] == 1 || $rowdb[$key]['Auto'] == 1) {
                 $where = $key . "='" . addslashes($inside) . "'";
                 break;
开发者ID:mcanv,项目名称:webshell,代码行数:31,代码来源:2009mssql.php

示例11: get_recordset_sql

 /**
  * Get a number of records as a moodle_recordset using a SQL statement.
  *
  * Since this method is a little less readable, use of it should be restricted to
  * code where it's possible there might be large datasets being returned.  For known
  * small datasets use get_records_sql - it leads to simpler code.
  *
  * The return type is like:
  * @see function get_recordset.
  *
  * @param string $sql the SQL select query to execute.
  * @param array $params array of sql parameters
  * @param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
  * @param int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set).
  * @return moodle_recordset instance
  * @throws dml_exception A DML specific exception is thrown for any errors.
  */
 public function get_recordset_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0)
 {
     list($limitfrom, $limitnum) = $this->normalise_limit_from_num($limitfrom, $limitnum);
     if ($limitfrom or $limitnum) {
         if (!$this->supportsoffsetfetch) {
             if ($limitnum >= 1) {
                 // Only apply TOP clause if we have any limitnum (limitfrom offset is handled later).
                 $fetch = $limitfrom + $limitnum;
                 if (PHP_INT_MAX - $limitnum < $limitfrom) {
                     // Check PHP_INT_MAX overflow.
                     $fetch = PHP_INT_MAX;
                 }
                 $sql = preg_replace('/^([\\s(])*SELECT([\\s]+(DISTINCT|ALL))?(?!\\s*TOP\\s*\\()/i', "\\1SELECT\\2 TOP {$fetch}", $sql);
             }
         } else {
             $sql = substr($sql, -1) === ';' ? substr($sql, 0, -1) : $sql;
             // We need order by to use FETCH/OFFSET.
             // Ordering by first column shouldn't break anything if there was no order in the first place.
             if (!strpos(strtoupper($sql), "ORDER BY")) {
                 $sql .= " ORDER BY 1";
             }
             $sql .= " OFFSET " . $limitfrom . " ROWS ";
             if ($limitnum > 0) {
                 $sql .= " FETCH NEXT " . $limitnum . " ROWS ONLY";
             }
         }
     }
     list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
     $rawsql = $this->emulate_bound_params($sql, $params);
     $this->query_start($sql, $params, SQL_QUERY_SELECT);
     $result = mssql_query($rawsql, $this->mssql);
     $this->query_end($result);
     if ($limitfrom && !$this->supportsoffsetfetch) {
         // Skip $limitfrom records.
         if (!@mssql_data_seek($result, $limitfrom)) {
             // Nothing, most probably seek past the end.
             mssql_free_result($result);
             $result = null;
         }
     }
     return $this->create_recordset($result);
 }
开发者ID:grigory-catalyst,项目名称:moodle,代码行数:59,代码来源:mssql_native_moodle_database.php

示例12: fetchInto

 /**
  * Fetch a row and insert the data into an existing array.
  *
  * Formating of the array and the data therein are configurable.
  * See DB_result::fetchInto() for more information.
  *
  * @param resource $result    query result identifier
  * @param array    $arr       (reference) array where data from the row
  *                            should be placed
  * @param int      $fetchmode how the resulting array should be indexed
  * @param int      $rownum    the row number to fetch
  *
  * @return mixed DB_OK on success, null when end of result set is
  *               reached or on failure
  *
  * @see DB_result::fetchInto()
  * @access private
  */
 function fetchInto($result, &$arr, $fetchmode, $rownum = null)
 {
     if ($rownum !== null) {
         if (!@mssql_data_seek($result, $rownum)) {
             return null;
         }
     }
     if ($fetchmode & DB_FETCHMODE_ASSOC) {
         $arr = @mssql_fetch_array($result, MSSQL_ASSOC);
         if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
             $arr = array_change_key_case($arr, CASE_LOWER);
         }
     } else {
         $arr = @mssql_fetch_row($result);
     }
     if (!$arr) {
         /* This throws informative error messages,
               don't use it for now
            if ($msg = @mssql_get_last_message()) {
                return $this->raiseError($msg);
            }
            */
         return null;
     }
     if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
         $this->_rtrimArrayValues($arr);
     }
     if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
         $this->_convertNullArrayValuesToEmpty($arr);
     }
     return DB_OK;
 }
开发者ID:bantudevelopment,项目名称:polysmis,代码行数:50,代码来源:mssql.php

示例13: limit

 function limit($query, $offset, $pagesize = 0)
 {
     if ($pagesize > 0) {
         mssql_data_seek($query, $offset);
     } else {
         $pagesize = $offset;
     }
     $info = array();
     for ($i = 0; $i < $pagesize; $i++) {
         $r = $this->fetch_array($query);
         if (!$r) {
             break;
         }
         $info[] = $r;
     }
     $this->free_result($query);
     $this->cursor = 0;
     return $info;
 }
开发者ID:hcd2008,项目名称:destoon,代码行数:19,代码来源:db_mssql.class.php

示例14: _seek

 function _seek($row)
 {
     return @mssql_data_seek($this->_queryID, $row);
 }
开发者ID:johnfelipe,项目名称:orfeo,代码行数:4,代码来源:adodb-mssql.inc.php

示例15: seek

 /**
  * @see ResultSet::seek()
  */
 function seek($rownum)
 {
     // support emulated OFFSET
     $actual = $rownum + $this->offset;
     if ($this->limit > 0 && $rownum >= $this->limit || $rownum < 0) {
         // have to check for rownum < 0, because mssql_seek() won't
         // complain if the $actual is valid.
         return false;
     }
     // MSSQL rows start w/ 0, but this works, because we are
     // looking to move the position _before_ the next desired position
     if (!@mssql_data_seek($this->result, $actual)) {
         return false;
     }
     $this->cursorPos = $rownum;
     return true;
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:20,代码来源:MSSQLResultSet.php


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