本文整理汇总了PHP中sybase_fetch_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP sybase_fetch_assoc函数的具体用法?PHP sybase_fetch_assoc怎么用?PHP sybase_fetch_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sybase_fetch_assoc函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: dbQuery
function dbQuery($query, $show_errors = true, $all_results = true, $show_output = true)
{
if ($show_errors) {
error_reporting(E_ALL);
} else {
error_reporting(E_PARSE);
}
// Connect to the Sybase database management system
$link = @sybase_pconnect("192.168.231.144", "testuser", "testpass");
if (!$link) {
die(sybase_get_last_message());
}
// Make 'testdb' the current database
$db_selected = @sybase_select_db("testdb");
if (!$db_selected) {
die(sybase_get_last_message());
}
// Print results in HTML
print "<html><body>\n";
// Print SQL query to test sqlmap '--string' command line option
//print "<b>SQL query:</b> " . $query . "<br>\n";
// Perform SQL injection affected query
$result = sybase_query($query);
if (!$result) {
if ($show_errors) {
print "<b>SQL error:</b> " . sybase_get_last_message() . "<br>\n";
}
exit(1);
}
if (!$show_output) {
exit(1);
}
print "<b>SQL results:</b>\n";
print "<table border=\"1\">\n";
while ($line = sybase_fetch_assoc($result)) {
print "<tr>";
foreach ($line as $col_value) {
print "<td>" . $col_value . "</td>";
}
print "</tr>\n";
if (!$all_results) {
break;
}
}
print "</table>\n";
print "</body></html>";
}
开发者ID:dieface,项目名称:testenv,代码行数:47,代码来源:sybase_user.inc.php
示例2: next
/**
* Iterator function. Returns a rowset if called without parameter,
* the fields contents if a field is specified or FALSE to indicate
* no more rows are available.
*
* @param string field default NULL
* @return var
*/
public function next($field = NULL)
{
if (!is_resource($this->handle) || FALSE === ($row = sybase_fetch_assoc($this->handle))) {
return FALSE;
}
foreach (array_keys($row) as $key) {
if (NULL === $row[$key] || !isset($this->fields[$key])) {
continue;
}
if ('datetime' === $this->fields[$key]) {
$row[$key] = Date::fromString($row[$key], $this->tz);
}
}
if ($field) {
return $row[$field];
} else {
return $row;
}
}
开发者ID:melogamepay,项目名称:xp-framework,代码行数:27,代码来源:SybaseResultSet.class.php
示例3: next
/**
* Iterator function. Returns a rowset if called without parameter,
* the fields contents if a field is specified or FALSE to indicate
* no more rows are available.
*
* @param string field default NULL
* @return [:var]
*/
public function next($field = null)
{
if (!is_resource($this->handle) || false === ($row = sybase_fetch_assoc($this->handle))) {
return null;
}
foreach (array_keys($row) as $key) {
if (null === $row[$key] || !isset($this->fields[$key])) {
continue;
}
if ('datetime' === $this->fields[$key]) {
$row[$key] = new \util\Date($row[$key], $this->tz);
}
}
if ($field) {
return $row[$field];
} else {
return $row;
}
}
开发者ID:xp-framework,项目名称:rdbms,代码行数:27,代码来源:SybaseResultSet.class.php
示例4: _fetch_assoc
/**
* Result - associative array
*
* Returns the result set as an array
*
* @access private
* @return array
*/
function _fetch_assoc()
{
return sybase_fetch_assoc($this->result_id);
}
开发者ID:alexandrebagio,项目名称:CodeIgniter3-sybase-driver,代码行数:12,代码来源:sybase_result.php
示例5: 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
示例6: _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
示例7: 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
示例8: _sybase_field_flags
/**
* Get the flags for a field
*
* Currently supports:
* + <samp>unique_key</samp> (unique index, unique check or primary_key)
* + <samp>multiple_key</samp> (multi-key index)
*
* @param string $table the table name
* @param string $column the field name
*
* @return string space delimited string of flags. Empty string if none.
*
* @access private
*/
function _sybase_field_flags($table, $column)
{
static $tableName = null;
static $flags = array();
if ($table != $tableName) {
$flags = array();
$tableName = $table;
/* We're running sp_helpindex directly because it doesn't exist in
* older versions of ASE -- unfortunately, we can't just use
* DB::isError() because the user may be using callback error
* handling. */
$res = @sybase_query("sp_helpindex {$table}", $this->connection);
if ($res === false || $res === true) {
// Fake a valid response for BC reasons.
return '';
}
while (($val = sybase_fetch_assoc($res)) !== false) {
if (!isset($val['index_keys'])) {
/* No useful information returned. Break and be done with
* it, which preserves the pre-1.7.9 behaviour. */
break;
}
$keys = explode(', ', trim($val['index_keys']));
if (sizeof($keys) > 1) {
foreach ($keys as $key) {
$this->_add_flag($flags[$key], 'multiple_key');
}
}
if (strpos($val['index_description'], 'unique')) {
foreach ($keys as $key) {
$this->_add_flag($flags[$key], 'unique_key');
}
}
}
sybase_free_result($res);
}
if (array_key_exists($column, $flags)) {
return implode(' ', $flags[$column]);
}
return '';
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:55,代码来源:sybase.php
示例9: _fetch_assoc
protected function _fetch_assoc($result_id)
{
global $configArray;
if (strcasecmp($configArray['System']['operatingSystem'], 'windows') == 0) {
return sybase_fetch_assoc($result_id);
} else {
return mssql_fetch_assoc($result_id);
}
}
开发者ID:victorfcm,项目名称:VuFind-Plus,代码行数:9,代码来源:Horizon.php
示例10: 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
示例11: fetch_assoc
/**
* Fetch the current row as associative array
* @return array
*/
protected function fetch_assoc()
{
return @sybase_fetch_assoc($this->resResult);
}
开发者ID:jens-wetzel,项目名称:use2,代码行数:8,代码来源:DB_Sybase.php
示例12: fetch_assoc
/**
* This function fetches a result as an associative array.
*
* @param mixed $result
* @return array
*/
function fetch_assoc($result)
{
return sybase_fetch_assoc($result);
}
开发者ID:jr-ewing,项目名称:phpMyFAQ,代码行数:10,代码来源:Sybase.php
示例13: Send
function Send()
{
$this->error_message();
$this->getHeader();
if ($this->smtp) {
$this->checkSmtp($this->hostSmtp, $this->portSmtp, $this->authenticate, $this->userSmtp, $this->passSmtp);
$this->socket = $this->connectSmtp($this->hostSmtp, $this->portSmtp, $this->timeoutSmtp);
switch ($this->smtpServer) {
case 'esmtp':
$this->smtpEhlo($this->socket);
break;
case 'smtp':
$this->smtpHelo($this->socket);
break;
case 'test':
if ($this->smtpEhlo($this->socket)) {
echo nl2br("Connection successful... \r\n Server type: esmtp server \n");
return false;
} else {
$this->smtpQuit($this->socket);
$this->disconnectSmtp($this->socket);
$this->socket = $this->connectSmtp($this->hostSmtp, $this->portSmtp, $this->timeoutSmtp);
if ($this->smtpHelo($this->socket)) {
echo nl2br("Connection successful... \r\n Server type: smtp server \n");
return false;
} else {
echo nl2br("Server type: unknown server. \n");
return false;
}
}
}
$this->smtpAuth($this->authenticate);
}
if ($this->use == "whom") {
$this->readData($this->setWhom($this->whom));
} elseif ($this->use == "maillist") {
$this->readData($this->checkMaillist($this->list));
} elseif ($this->use == "DB" || $this->use == "all") {
switch ($this->dbfbasa) {
case 'mysql':
if (!$this->query_result) {
return false;
}
while ($this->tos = mysql_fetch_assoc($this->query_result)) {
$this->readData($this->tos);
}
break;
case 'pgsql':
if (!$this->query_result) {
return false;
}
while ($this->tos = pg_fetch_assoc($this->query_result)) {
$this->readData($this->tos);
}
break;
case 'ibase':
if (!$this->query_result) {
return false;
}
while ($this->tos = ibase_fetch_assoc($this->query_result)) {
$this->readData($this->tos);
}
break;
case 'msql':
if (!$this->query_result) {
return false;
}
while ($this->tos = msql_fetch_array($this->query_result, MSQL_ASSOC)) {
$this->readData($this->tos);
}
break;
case 'fbsql':
if (!$this->query_result) {
return false;
}
while ($this->tos = fbsql_fetch_assoc($this->query_result)) {
$this->readData($this->tos);
}
break;
case 'sqli':
if (!$this->query_result) {
return false;
}
while ($this->tos = sqlite_fetch_array($this->query_result, SQLITE_ASSOC)) {
$this->readData($this->tos);
}
break;
case 'oci':
if (!$this->query_result) {
return false;
}
while ($this->tos = oci_fetch_assoc($this->query_result)) {
$this->readData($this->tos);
}
break;
case 'sybase':
if (!$this->query_result) {
return false;
}
while ($this->tos = sybase_fetch_assoc($this->query_result)) {
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:cartonbank,代码行数:101,代码来源:phpMM_V_23_08_2007.php
示例14: fetch_assoc
/**
* Fetch a result row as an array
*
* This function fetches a result as an associative array.
*
* @param mixed $result
* @return array
* @access public
* @author Adam Greene <[email protected]>
* @since 2004-12-10
*/
function fetch_assoc($result)
{
if (!function_exists('sybase_fetch_assoc')) {
$rs = @sybase_fetch_array($result);
} else {
$rs = @sybase_fetch_assoc($result);
}
return $rs;
}
开发者ID:noon,项目名称:phpMyFAQ,代码行数:20,代码来源:Sybase.php
示例15: fetchAssoc
public function fetchAssoc()
{
if (!empty($this->query)) {
return sybase_fetch_assoc($this->query);
} else {
return false;
}
}
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:8,代码来源:SybaseDriver.php
示例16: _performFetch
function _performFetch($result)
{
$row = sybase_fetch_assoc($result);
//if (sybase_error()(!!!)) return $this->_setDbError($this->_lastQuery);
if ($row === false) {
return null;
}
// sybase bugfix - replase ' ' to ''
// Encoding string fields on fly
if (is_array($row)) {
$tf = $this->_getTextFields($result);
foreach ($tf as $k => $t) {
$v = $row[$k];
if (!is_null($v)) {
if ($v === ' ') {
// Sybase bugfix
$v = '';
} else {
if ($this->lcharset && $this->rcharset) {
$v = mb_convert_encoding($v, $this->lcharset, $this->rcharset);
}
}
}
$row[$k] = $v;
}
}
return $row;
}
开发者ID:Ambalus,项目名称:DbSimple,代码行数:28,代码来源:Sybase.php
注:本文中的sybase_fetch_assoc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论