本文整理汇总了PHP中fbsql_field_name函数的典型用法代码示例。如果您正苦于以下问题:PHP fbsql_field_name函数的具体用法?PHP fbsql_field_name怎么用?PHP fbsql_field_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fbsql_field_name函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pgsqlAdapter
/**
* 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 pgsqlAdapter($d)
{
parent::RecordSetAdapter($d);
$fieldcount = fbsql_num_fields($d);
$ob = "";
$be = $this->isBigEndian;
$fc = pack('N', $fieldcount);
if (fbsql_num_rows($d) > 0) {
fbsql_data_seek($d, 0);
while ($line = fbsql_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;
$this->numRows = fbsql_num_rows($d);
for ($i = 0; $i < $fieldcount; $i++) {
$this->columnNames[$i] = $this->_charsetHandler->transliterate(fbsql_field_name($d, $i));
}
}
开发者ID:ksecor,项目名称:civicrm,代码行数:59,代码来源:fbsqlAdapter.php
示例2: fbsqlAdapter
/**
* 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 fbsqlAdapter($d)
{
parent::RecordSetAdapter($d);
$fieldcount = fbsql_num_fields($d);
for ($i = 0; $i < $fieldcount; $i++) {
$this->columns[] = fbsql_field_name($d, $i);
}
if (fbsql_num_rows($d) > 0) {
fbsql_data_seek($d, 0);
while ($line = fbsql_fetch_row($d)) {
$this->rows[] = $line;
}
}
}
开发者ID:FalconGT,项目名称:DrEvony,代码行数:20,代码来源:fbsqlAdapter.php
示例3: tableInfo
/**
* Returns information about a table or a result set
*
* @param object|string $result MDB2_result object from a query or a
* string containing the name of a table.
* While this also accepts a query result
* resource identifier, this behavior is
* deprecated.
* @param int $mode a valid tableInfo mode
*
* @return array an associative array with the information requested.
* A MDB2_Error object on failure.
*
* @see MDB2_Driver_Common::tableInfo()
*/
function tableInfo($result, $mode = null)
{
if (is_string($result)) {
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
if (MDB2::isError($db)) {
return $db;
}
$resource = MDB2::isResultCommon($result) ? $result->getResource() : $result;
if (!is_resource($resource)) {
return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'Could not generate result resource', __FUNCTION__);
}
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
if ($db->options['field_case'] == CASE_LOWER) {
$case_func = 'strtolower';
} else {
$case_func = 'strtoupper';
}
} else {
$case_func = 'strval';
}
$count = @fbsql_num_fields($resource);
$res = array();
if ($mode) {
$res['num_fields'] = $count;
}
for ($i = 0; $i < $count; $i++) {
$res[$i] = array('table' => $case_func(@fbsql_field_table($resource, $i)), 'name' => $case_func(@fbsql_field_name($resource, $i)), 'type' => @fbsql_field_type($resource, $i), 'length' => @fbsql_field_len($resource, $i), 'flags' => @fbsql_field_flags($resource, $i));
// todo: implement $db->datatype->mapNativeDatatype();
$res[$i]['mdb2type'] = $res[$i]['type'];
if ($mode & MDB2_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
}
return $res;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:55,代码来源:fbsql.php
示例4: tableInfo
/**
* Returns information about a table or a result set
*
* @param object|string $result DB_result object from a query or a
* string containing the name of a table.
* While this also accepts a query result
* resource identifier, this behavior is
* deprecated.
* @param int $mode a valid tableInfo mode
*
* @return array an associative array with the information requested.
* A DB_Error object on failure.
*
* @see DB_common::tableInfo()
*/
function tableInfo($result, $mode = null)
{
if (is_string($result)) {
/*
* Probably received a table name.
* Create a result resource identifier.
*/
$id = @fbsql_list_fields($this->dsn['database'], $result, $this->connection);
$got_string = true;
} elseif (isset($result->result)) {
/*
* Probably received a result object.
* Extract the result resource identifier.
*/
$id = $result->result;
$got_string = false;
} else {
/*
* Probably received a result resource identifier.
* Copy it.
* Deprecated. Here for compatibility only.
*/
$id = $result;
$got_string = false;
}
if (!is_resource($id)) {
return $this->fbsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
}
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
$case_func = 'strtolower';
} else {
$case_func = 'strval';
}
$count = @fbsql_num_fields($id);
$res = array();
if ($mode) {
$res['num_fields'] = $count;
}
for ($i = 0; $i < $count; $i++) {
$res[$i] = array('table' => $case_func(@fbsql_field_table($id, $i)), 'name' => $case_func(@fbsql_field_name($id, $i)), 'type' => @fbsql_field_type($id, $i), 'len' => @fbsql_field_len($id, $i), 'flags' => @fbsql_field_flags($id, $i));
if ($mode & DB_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & DB_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
}
// free the result only if we were called on a table
if ($got_string) {
@fbsql_free_result($id);
}
return $res;
}
开发者ID:roojs,项目名称:pear,代码行数:68,代码来源:fbsql.php
示例5: tableInfo
/**
* Returns information about a table or a result set.
*
* @param object|string $result MDB2_result object from a query or a
* string containing the name of a table
* @param int $mode a valid tableInfo mode
* @return array an associative array with the information requested
* or an error object if something is wrong
* @access public
* @internal
* @see MDB2_Driver_Common::tableInfo()
*/
function tableInfo($result, $mode = null)
{
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
if ($db->options['portability'] & MDB2_PORTABILITY_LOWERCASE) {
$case_func = 'strtolower';
} else {
$case_func = 'strval';
}
if (is_string($result)) {
/*
* Probably received a table name.
* Create a result resource identifier.
*/
if (MDB2::isError($connect = $db->connect())) {
return $connect;
}
$id = @fbsql_list_fields($db->database_name, $result, $db->connection);
$got_string = true;
} else {
/*
* Probably received a result object.
* Extract the result resource identifier.
*/
$id = $result->getResource();
if (empty($id)) {
return $db->raiseError();
}
$got_string = false;
}
if (!is_resource($id)) {
return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA);
}
$count = @fbsql_num_fields($id);
// made this IF due to performance (one if is faster than $count if's)
if (!$mode) {
for ($i = 0; $i < $count; $i++) {
$res[$i]['table'] = $case_func(@fbsql_field_table($id, $i));
$res[$i]['name'] = $case_func(@fbsql_field_name($id, $i));
$res[$i]['type'] = @fbsql_field_type($id, $i);
$res[$i]['len'] = @fbsql_field_len($id, $i);
$res[$i]['flags'] = @fbsql_field_flags($id, $i);
}
} else {
// full
$res["num_fields"] = $count;
for ($i = 0; $i < $count; $i++) {
$res[$i]['table'] = $case_func(@fbsql_field_table($id, $i));
$res[$i]['name'] = $case_func(@fbsql_field_name($id, $i));
$res[$i]['type'] = @fbsql_field_type($id, $i);
$res[$i]['len'] = @fbsql_field_len($id, $i);
$res[$i]['flags'] = @fbsql_field_flags($id, $i);
if ($mode & MDB2_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
}
}
// free the result only if we were called on a table
if ($got_string) {
@fbsql_free_result($id);
}
return $res;
}
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:77,代码来源:fbsql.php
示例6: tableInfo
/**
* Returns information about a table or a result set
*
* @param object|string $result MDB2_result object from a query or a
* string containing the name of a table.
* While this also accepts a query result
* resource identifier, this behavior is
* deprecated.
* @param int $mode a valid tableInfo mode
*
* @return array an associative array with the information requested.
* A MDB2_Error object on failure.
*
* @see MDB2_Driver_Common::tableInfo()
*/
function tableInfo($result, $mode = null)
{
$db =& $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
if (is_string($result)) {
/*
* Probably received a table name.
* Create a result resource identifier.
*/
$connection = $db->getConnection();
if (PEAR::isError($connection)) {
return $connection;
}
$id = @fbsql_list_fields($db->database_name, $result, $connection);
$got_string = true;
} elseif (MDB2::isResultCommon($result)) {
/*
* Probably received a result object.
* Extract the result resource identifier.
*/
$id = $result->getResource();
$got_string = false;
} else {
/*
* Probably received a result resource identifier.
* Copy it.
* Deprecated. Here for compatibility only.
*/
$id = $result;
$got_string = false;
}
if (!is_resource($id)) {
return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA);
}
if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
if ($db->options['field_case'] == CASE_LOWER) {
$case_func = 'strtolower';
} else {
$case_func = 'strtoupper';
}
} else {
$case_func = 'strval';
}
$count = @fbsql_num_fields($id);
$res = array();
if ($mode) {
$res['num_fields'] = $count;
}
for ($i = 0; $i < $count; $i++) {
$res[$i] = array('table' => $case_func(@fbsql_field_table($id, $i)), 'name' => $case_func(@fbsql_field_name($id, $i)), 'type' => @fbsql_field_type($id, $i), 'length' => @fbsql_field_len($id, $i), 'flags' => @fbsql_field_flags($id, $i));
// todo: implement $db->datatype->mapNativeDatatype();
$res[$i]['mdb2type'] = $res[$i]['type'];
if ($mode & MDB2_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
}
// free the result only if we were called on a table
if ($got_string) {
@fbsql_free_result($id);
}
return $res;
}
开发者ID:ajisantoso,项目名称:kateglo,代码行数:82,代码来源:fbsql.php
示例7: tableInfo
function tableInfo($result, $mode = null)
{
$count = 0;
$id = 0;
$res = array();
/*
* depending on $mode, metadata returns the following values:
*
* - mode is false (default):
* $result[]:
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["flags"] field flags
*
* - mode is DB_TABLEINFO_ORDER
* $result[]:
* ["num_fields"] number of metadata records
* [0]["table"] table name
* [0]["name"] field name
* [0]["type"] field type
* [0]["len"] field length
* [0]["flags"] field flags
* ["order"][field name] index of field named "field name"
* The last one is used, if you have a field name, but no index.
* Test: if (isset($result['meta']['myfield'])) { ...
*
* - mode is DB_TABLEINFO_ORDERTABLE
* the same as above. but additionally
* ["ordertable"][table name][field name] index of field
* named "field name"
*
* this is, because if you have fields from different
* tables with the same field name * they override each
* other with DB_TABLEINFO_ORDER
*
* you can combine DB_TABLEINFO_ORDER and
* DB_TABLEINFO_ORDERTABLE with DB_TABLEINFO_ORDER |
* DB_TABLEINFO_ORDERTABLE * or with DB_TABLEINFO_FULL
*/
// if $result is a string, then we want information about a
// table without a resultset
if (is_string($result)) {
$id = @fbsql_list_fields($this->dsn['database'], $result, $this->connection);
if (empty($id)) {
return $this->fbsqlRaiseError();
}
} else {
// else we want information about a resultset
$id = $result;
if (empty($id)) {
return $this->fbsqlRaiseError();
}
}
$count = @fbsql_num_fields($id);
// made this IF due to performance (one if is faster than $count if's)
if (empty($mode)) {
for ($i = 0; $i < $count; $i++) {
$res[$i]['table'] = @fbsql_field_table($id, $i);
$res[$i]['name'] = @fbsql_field_name($id, $i);
$res[$i]['type'] = @fbsql_field_type($id, $i);
$res[$i]['len'] = @fbsql_field_len($id, $i);
$res[$i]['flags'] = @fbsql_field_flags($id, $i);
}
} else {
// full
$res["num_fields"] = $count;
for ($i = 0; $i < $count; $i++) {
$res[$i]['table'] = @fbsql_field_table($id, $i);
$res[$i]['name'] = @fbsql_field_name($id, $i);
$res[$i]['type'] = @fbsql_field_type($id, $i);
$res[$i]['len'] = @fbsql_field_len($id, $i);
$res[$i]['flags'] = @fbsql_field_flags($id, $i);
if ($mode & DB_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & DB_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
}
}
// free the result only if we were called on a table
if (is_string($result)) {
@fbsql_free_result($id);
}
return $res;
}
开发者ID:BackupTheBerlios,项目名称:e-maku-svn,代码行数:88,代码来源:fbsql.php
示例8: columns
public function columns()
{
if (empty($this->query)) {
return false;
}
$columns = array();
$num_fields = $this->num_fields();
for ($i = 0; $i < $num_fields; $i++) {
$columns[] = fbsql_field_name($this->query, $i);
}
return $columns;
}
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:12,代码来源:FbsqlDriver.php
示例9: _getColumnNames
/**
* Retrieve the names of columns returned by the DBMS in a query result.
*
* @return mixed Array variable that holds the names of columns as keys
* or an MDB2 error on failure.
* Some DBMS may not return any columns when the result set
* does not contain any rows.
* @access private
*/
function _getColumnNames()
{
$columns = array();
$numcols = $this->numCols();
if (MDB2::isError($numcols)) {
return $numcols;
}
for ($column = 0; $column < $numcols; $column++) {
$column_name = @fbsql_field_name($this->result, $column);
$columns[$column_name] = $column;
}
if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
$columns = array_change_key_case($columns, $this->db->options['field_case']);
}
return $columns;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:25,代码来源:fbsql.php
注:本文中的fbsql_field_name函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论