本文整理汇总了PHP中sybase_fetch_row函数的典型用法代码示例。如果您正苦于以下问题:PHP sybase_fetch_row函数的具体用法?PHP sybase_fetch_row怎么用?PHP sybase_fetch_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sybase_fetch_row函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: lastInsertId
public function lastInsertId($name = '')
{
if ($result = sybase_query('SELECT @@IDENTITY', $this->link)) {
$row = sybase_fetch_row($result);
if ($row[0] === null) {
return -1;
}
return $row[0];
}
return false;
}
开发者ID:Deepab23,项目名称:clinic,代码行数:11,代码来源:sybase.php
示例2: asArray
public function asArray()
{
$json = [];
$i = 0;
while ($row = sybase_fetch_row($this->result)) {
foreach ($row as $_v) {
$json[$i][] = iconv("cp936", "utf-8", $_v);
}
$i++;
}
return $json;
}
开发者ID:perpel,项目名称:ywfy,代码行数:12,代码来源:Sybase.php
示例3: 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 (!@sybase_data_seek($result, $rownum)) {
return null;
}
}
if ($fetchmode & DB_FETCHMODE_ASSOC) {
if (function_exists('sybase_fetch_assoc')) {
$arr = @sybase_fetch_assoc($result);
} else {
if ($arr = @sybase_fetch_array($result)) {
foreach ($arr as $key => $value) {
if (is_int($key)) {
unset($arr[$key]);
}
}
}
}
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
$arr = array_change_key_case($arr, CASE_LOWER);
}
} else {
$arr = @sybase_fetch_row($result);
}
if (!$arr) {
// reported not work as seems that sybase_get_last_message()
// always return a message here
//if ($errmsg = @sybase_get_last_message()) {
// return $this->sybaseRaiseError($errmsg);
//} else {
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:sergiokessler,项目名称:perio,代码行数:60,代码来源:sybase.php
示例4: _fetch_row
protected function _fetch_row()
{
return sybase_fetch_row($this->_result);
}
开发者ID:Deepab23,项目名称:clinic,代码行数:4,代码来源:sybase_statement.php
示例5: sql_fetch_row
function sql_fetch_row(&$res, $nr = 0)
{
global $dbtype;
switch ($dbtype) {
case "MySQL":
$row = mysql_fetch_row($res);
return $row;
break;
case "mSQL":
$row = msql_fetch_row($res);
return $row;
break;
case "postgres":
case "postgres_local":
if ($res->get_total_rows() > $res->get_fetched_rows()) {
$row = pg_fetch_row($res->get_result(), $res->get_fetched_rows());
$res->increment_fetched_rows();
return $row;
} else {
return false;
}
break;
case "ODBC":
case "ODBC_Adabas":
$row = array();
$cols = odbc_fetch_into($res, $nr, $row);
return $row;
break;
case "Interbase":
$row = ibase_fetch_row($res);
return $row;
break;
case "Sybase":
$row = sybase_fetch_row($res);
return $row;
break;
default:
break;
}
}
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:40,代码来源:sql_layer.php
示例6: fetchInto
function fetchInto($result, &$ar, $fetchmode, $rownum = null)
{
if ($rownum !== null) {
if (!sybase_data_seek($result, $rownum)) {
return $this->raiseError();
}
}
$ar = $fetchmode & DB_FETCHMODE_ASSOC ? @sybase_fetch_array($result) : @sybase_fetch_row($result);
if (!$ar) {
// reported not work as seems that sybase_get_last_message()
// always return a message here
//if ($errmsg = sybase_get_last_message()) {
// return $this->raiseError($errmsg);
//} else {
return null;
//}
}
return DB_OK;
}
开发者ID:joeymetal,项目名称:v1,代码行数:19,代码来源:sybase.php
示例7: insert_id
/**
* Returns the ID of the latest insert
*
* @return integer
* @access public
* @author Adam Greene <[email protected]>
* @since 2004-12-10
*/
function insert_id($table, $field)
{
$sql = "SELECT max({$field}) FROM {$table} ";
$rs = sybase_query($sql, $this->conn);
$row = sybase_fetch_row($rs);
if (isset($row[0]) && $row[0] > 0) {
return $row[0] + 1;
}
return 1;
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:18,代码来源:sybase.php
示例8: _fetch
function _fetch($ignore_fields = false)
{
if ($this->fetchMode == ADODB_FETCH_NUM) {
$this->fields = @sybase_fetch_row($this->_queryID);
} else {
if ($this->fetchMode == ADODB_FETCH_ASSOC) {
$this->fields = @sybase_fetch_row($this->_queryID);
$this->fields = $this->GetRowAssoc(ADODB_CASE_ASSOC);
} else {
$this->fields = @sybase_fetch_array($this->_queryID);
}
}
return is_array($this->fields);
}
开发者ID:OberjukhtinIA0VWV0Allokuum,项目名称:testmasteke.leo,代码行数:14,代码来源:adodb-sybase.inc.php
示例9: query
function query($query)
{
//if flag to convert query from MySql syntax to Sybase syntax is true
//convert the query
if ($this->convertMySqlTosybaseQuery == true) {
$query = $this->ConvertMySqlTosybase($query);
}
// Initialise return
$return_val = 0;
// Flush cached values..
$this->flush();
// For reg expressions
$query = trim($query);
// Log how the function was called
$this->func_call = "\$db->query(\"{$query}\")";
// Keep track of the last query for debug..
$this->last_query = $query;
// Count how many queries there have been
$this->num_queries++;
// Use core file cache function
if ($cache = $this->get_cache($query)) {
return $cache;
}
// If there is no existing database connection then try to connect
if (!isset($this->dbh) || !$this->dbh) {
$this->connect($this->dbuser, $this->dbpassword, $this->dbhost);
$this->select($this->dbname);
}
// Perform the query via std sybase_query function..
$this->result = @sybase_query($query);
// If there is an error then take note of it..
if ($this->result == false) {
$get_errorcodeSql = "SELECT @@ERROR as errorcode";
$error_res = @sybase_query($get_errorcodeSql, $this->dbh);
$errorCode = @sybase_result($error_res, 0, "errorcode");
$get_errorMessageSql = "SELECT severity as errorSeverity, text as errorText FROM sys.messages WHERE message_id = " . $errorCode;
$errormessage_res = @sybase_query($get_errorMessageSql, $this->dbh);
if ($errormessage_res) {
$errorMessage_Row = @sybase_fetch_row($errormessage_res);
$errorSeverity = $errorMessage_Row[0];
$errorMessage = $errorMessage_Row[1];
}
$sqlError = "ErrorCode: " . $errorCode . " ### Error Severity: " . $errorSeverity . " ### Error Message: " . $errorMessage . " ### Query: " . $query;
$is_insert = true;
$this->register_error($sqlError);
$this->show_errors ? trigger_error($sqlError, E_USER_WARNING) : null;
return false;
}
// Query was an insert, delete, update, replace
$is_insert = false;
if (preg_match("/^(insert|delete|update|replace)\\s+/i", $query)) {
$this->rows_affected = @sybase_rows_affected($this->dbh);
// Take note of the insert_id
if (preg_match("/^(insert|replace)\\s+/i", $query)) {
$identityresultset = @sybase_query("select SCOPE_IDENTITY()");
if ($identityresultset != false) {
$identityrow = @sybase_fetch_row($identityresultset);
$this->insert_id = $identityrow[0];
}
}
// Return number of rows affected
$return_val = $this->rows_affected;
} else {
// Take note of column info
$i = 0;
while ($i < @sybase_num_fields($this->result)) {
$this->col_info[$i] = @sybase_fetch_field($this->result);
$i++;
}
// Store Query Results
$num_rows = 0;
while ($row = @sybase_fetch_object($this->result)) {
// Store relults as an objects within main array
$this->last_result[$num_rows] = $row;
$num_rows++;
}
@sybase_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;
}
// disk caching of queries
$this->store_cache($query, $is_insert);
// If debug ALL queries
$this->trace || $this->debug_all ? $this->debug() : null;
return $return_val;
}
开发者ID:BGCX067,项目名称:ezsqlhelper-svn-to-git,代码行数:88,代码来源:ez_sql_sybase.php
示例10: fetch_row
/**
* Fetch the current row as enumerated array
* @return array
*/
protected function fetch_row()
{
return @sybase_fetch_row($this->resResult);
}
开发者ID:jens-wetzel,项目名称:use2,代码行数:8,代码来源:DB_Sybase.php
示例11: errorNative
/**
* Gets the DBMS' native error code produced by the last query
*
* @return int the DBMS' error code
*/
function errorNative()
{
$res = @mssql_query('select @@ERROR as ErrorCode', $this->connection);
if (!$res) {
return DB_ERROR;
}
$row = @sybase_fetch_row($res);
return $row[0];
}
开发者ID:hendricson,项目名称:couponator,代码行数:14,代码来源:mssqlm.php
示例12: getMyFines
/**
* Get Patron Fines
*
* This is responsible for retrieving all fines by a specific patron.
*
* @param array $patron The patron array from patronLogin
*
* @throws \VuFind\Exception\Date
* @throws ILSException
* @return mixed Array of the patron's fines on success.
*/
public function getMyFines($patron)
{
$aid = $patron['address_id_nr'];
$iln = $patron['iln'];
//$lang = $patron['lang'];
$sql = "select o.ppn" . ", r.costs_code" . ", r.costs" . ", rtrim(convert(char(20),r.date_of_issue,104))" . ", rtrim(convert(char(20),r.date_of_creation,104))" . ", 'Overdue' as fines" . ", o.shorttitle" . " from requisition r, ous_copy_cache o, volume v" . " where r.address_id_nr=" . $aid . "" . " and r.iln=" . $iln . " and r.id_number=v.volume_number" . " and v.epn=o.epn" . " and r.iln=o.iln" . " and r.costs_code in (1, 2, 3, 4, 8)" . " union select id_number" . ", r.costs_code" . ", r.costs" . ", rtrim(convert(char(20),r.date_of_issue,104))" . ", rtrim(convert(char(20),r.date_of_creation,104))" . ", r.extra_information" . ", '' as zero" . " from requisition r" . " where r.address_id_nr=" . $aid . "" . " and r.costs_code not in (1, 2, 3, 4, 8)" . "";
try {
$result = [];
$sqlStmt = sybase_query($sql);
while ($row = sybase_fetch_row($sqlStmt)) {
//$fine = $this->translate(('3'==$row[1])?'Overdue':'Dues');
$fine = $this->picaRecode($row[5]);
$amount = null == $row[2] ? 0 : $row[2] * 100;
//$balance = (null==$row[3])?0:$row[3]*100;
$checkout = substr($row[3], 0, 12);
$duedate = substr($row[4], 0, 12);
$title = $this->picaRecode(substr($row[6], 0, 12));
$result[] = ['id' => $this->prfz($row[0]), 'amount' => $amount, 'balance' => $amount, 'checkout' => $checkout, 'duedate' => $duedate, 'fine' => $fine, 'title' => $title];
}
return $result;
} catch (\Exception $e) {
throw new ILSException($e->getMessage());
}
return [];
}
开发者ID:tillk,项目名称:vufind,代码行数:36,代码来源:LBS4.php
示例13: FetchAllRows
function FetchAllRows()
{
$retVal = array();
$i = 0;
// bump up if just ran query
if ($this->cur == -1) {
$this->cur = 0;
}
while ($a = @sybase_fetch_row($this->res)) {
$this->cur++;
$retVal[$i++] = $a;
}
return $retVal;
}
开发者ID:ljvblfz,项目名称:mysoftwarebrasil,代码行数:14,代码来源:class.DCL_DB_sybase.inc.php
示例14: fetchResult
/**
* Fetches the next row from the current result set
*
* @return unknown
*/
function fetchResult()
{
if ($row = sybase_fetch_row($this->results)) {
$resultRow = array();
$i = 0;
foreach ($row as $index => $field) {
list($table, $column) = $this->map[$index];
$resultRow[$table][$column] = $row[$index];
$i++;
}
return $resultRow;
} else {
return false;
}
}
开发者ID:christianallred,项目名称:fluent_univ,代码行数:20,代码来源:dbo_sybase.php
示例15: query0
/**
* Execute any statement
*
* @param string sql
* @param bool buffered default TRUE
* @return rdbms.sybase.SybaseResultSet or TRUE if no resultset was created
* @throws rdbms.SQLException
*/
protected function query0($sql, $buffered = TRUE)
{
if (!is_resource($this->handle)) {
if (!($this->flags & DB_AUTOCONNECT)) {
throw new SQLStateException('Not connected');
}
$c = $this->connect();
// Check for subsequent connection errors
if (FALSE === $c) {
throw new SQLStateException('Previously failed to connect');
}
}
if (!$buffered) {
$result = @sybase_unbuffered_query($sql, $this->handle, FALSE);
} else {
if ($this->flags & DB_UNBUFFERED) {
$result = @sybase_unbuffered_query($sql, $this->handle, $this->flags & DB_STORE_RESULT);
} else {
$result = @sybase_query($sql, $this->handle);
}
}
if (FALSE === $result) {
$message = 'Statement failed: ' . trim(sybase_get_last_message()) . ' @ ' . $this->dsn->getHost();
if (!is_resource($error = sybase_query('select @@error', $this->handle))) {
// The only case selecting @@error should fail is if we receive a
// disconnect. We could also check on the warnings stack if we can
// find the following:
//
// Sybase: Client message: Read from SQL server failed. (severity 78)
//
// but that seems a bit errorprone.
throw new SQLConnectionClosedException($message, $sql);
}
$code = current(sybase_fetch_row($error));
switch ($code) {
case 1205:
// Deadlock
throw new SQLDeadlockException($message, $sql, $code);
default:
// Other error
throw new SQLStatementFailedException($message, $sql, $code);
}
}
return TRUE === $result ? $result : new SybaseResultSet($result, $this->tz);
}
开发者ID:Gamepay,项目名称:xp-framework,代码行数:53,代码来源:SybaseConnection.class.php
示例16: _fetch
function _fetch($ignore_fields = false)
{
if ($this->fetchMode == ADODB_FETCH_NUM) {
$this->fields = @sybase_fetch_row($this->_queryID);
} else {
if ($this->fetchMode == ADODB_FETCH_ASSOC) {
$this->fields = @sybase_fetch_assoc($this->_queryID);
if (is_array($this->fields)) {
$this->fields = $this->GetRowAssoc();
return true;
}
return false;
} else {
$this->fields = @sybase_fetch_array($this->_queryID);
}
}
if (is_array($this->fields)) {
return true;
}
return false;
}
开发者ID:ceryxSeidor,项目名称:ProyectoPruebaWSV2,代码行数:21,代码来源:adodb-sybase.inc.php
示例17: convertResource
protected function convertResource($resource)
{
$resourceType = get_resource_type($resource);
switch ($resourceType) {
#case 'dbm':
#case 'dba':
#case 'dbase':
#case 'domxml attribute':
#case 'domxml document':
#case 'domxml node':
case 'fbsql result':
$rows = array();
$indexType = $this->dbResultIndexType == 'ASSOC' ? FBSQL_ASSOC : FBSQL_NUM;
while ($row = fbsql_fetch_array($resource, $indexType)) {
array_push($rows, $row);
}
return $rows;
#case 'gd': #return base64
#case 'gd': #return base64
case 'msql query':
$rows = array();
$indexType = $this->dbResultIndexType == 'ASSOC' ? MSQL_ASSOC : MSQL_NUM;
while ($row = msql_fetch_array($resource, $indexType)) {
array_push($rows, $row);
}
return $rows;
case 'mssql result':
$rows = array();
$indexType = $this->dbResultIndexType == 'ASSOC' ? MSSQL_ASSOC : MSSQL_NUM;
while ($row = mssql_fetch_array($resource, $indexType)) {
array_push($rows, $row);
}
return $rows;
case 'mysql result':
$rows = array();
$indexType = $this->dbResultIndexType == 'ASSOC' ? MYSQL_ASSOC : MYSQL_NUM;
while ($row = mysql_fetch_array($resource, $indexType)) {
array_push($rows, $row);
}
return $rows;
case 'odbc result':
$rows = array();
if ($this->dbResultIndexType == 'ASSOC') {
while ($row = odbc_fetch_array($resource)) {
array_push($rows, $row);
}
} else {
while ($row = odbc_fetch_row($resource)) {
array_push($rows, $row);
}
}
return $rows;
#case 'pdf document':
#case 'pdf document':
case 'pgsql result':
$rows = array();
$indexType = $this->dbResultIndexType == 'ASSOC' ? PGSQL_ASSOC : PGSQL_NUM;
while ($row = pg_fetch_array($resource, $indexType)) {
array_push($rows, $row);
}
return $rows;
case 'stream':
return stream_get_contents($resource);
case 'sybase-db result':
case 'sybase-ct result':
$rows = array();
if ($this->dbResultIndexType == 'ASSOC') {
while ($row = sybase_fetch_assoc($resource)) {
array_push($rows, $row);
}
} else {
while ($row = sybase_fetch_row($resource)) {
array_push($rows, $row);
}
}
return $rows;
#case 'xml':
#case 'xml':
default:
trigger_error("Unable to return resource type '{$resourceType}'.");
}
}
开发者ID:esironal,项目名称:crossui,代码行数:82,代码来源:RPCServer.class.php
示例18: fetchInto
/**
* Places a row from the result set into the given array
*
* Formating of the array and the data therein are configurable.
* See DB_result::fetchInto() for more information.
*
* This method is not meant to be called directly. Use
* DB_result::fetchInto() instead. It can't be declared "protected"
* because DB_result is a separate object.
*
* @param resource $result the query result resource
* @param array $arr the referenced array to put the data in
* @param int $fetchmode how the resulting array should be indexed
* @param int $rownum the row number to fetch (0 = first row)
*
* @return mixed DB_OK on success, NULL when the end of a result set is
* reached or on failure
*
* @see DB_result::fetchInto()
*/
function fetchInto($result, &$arr, $fetchmode, $rownum = null)
{
if ($rownum !== null) {
if (!@sybase_data_seek($result, $rownum)) {
return null;
}
}
if ($fetchmode & DB_FETCHMODE_ASSOC) {
if (function_exists('sybase_fetch_assoc')) {
$arr = @sybase_fetch_assoc($result);
} else {
if ($arr = @sybase_fetch_array($result)) {
foreach ($arr as $key => $value) {
if (is_int($key)) {
unset($arr[$key]);
}
}
}
}
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
$arr = array_change_key_case($arr, CASE_LOWER);
}
} else {
$arr = @sybase_fetch_row($result);
}
if (!$arr) {
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:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:56,代码来源:sybase.php
示例19: fetchRow
public function fetchRow()
{
if (!empty($this->query)) {
return sybase_fetch_row($this->query);
} else {
return 0;
}
}
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:8,代码来源:SybaseDriver.php
注:本文中的sybase_fetch_row函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论