本文整理汇总了PHP中ibase_field_info函数的典型用法代码示例。如果您正苦于以下问题:PHP ibase_field_info函数的具体用法?PHP ibase_field_info怎么用?PHP ibase_field_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibase_field_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FieldName
function FieldName($Index)
{
$FieldInfo = ibase_field_info($this->Records, $Index);
if ($FieldInfo['alias']) {
return $FieldInfo['alias'];
} else {
return $FieldInfo['name'];
}
}
示例2: __construct
/**
* Constructor
*
* @param resource handle
*/
public function __construct($result, TimeZone $tz = NULL)
{
$fields = array();
if (is_resource($result)) {
for ($i = 0, $num = ibase_num_fields($result); $i < $num; $i++) {
$field = ibase_field_info($result, $i);
$fields[$field['name']] = $field['type'];
}
}
parent::__construct($result, $fields, $tz);
}
示例3: _performGetBlobFieldNames
function _performGetBlobFieldNames($result)
{
$blobFields = array();
for ($i = ibase_num_fields($result) - 1; $i >= 0; $i--) {
$info = ibase_field_info($result, $i);
if ($info['type'] === "BLOB") {
$blobFields[] = $info['name'];
}
}
return $blobFields;
}
示例4: field_data
/**
* Field data
*
* Generates an array of objects containing field meta-data
*
* @return array
*/
public function field_data()
{
$retval = array();
for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) {
$info = ibase_field_info($this->result_id, $i);
$retval[$i] = new stdClass();
$retval[$i]->name = $info['name'];
$retval[$i]->type = $info['type'];
$retval[$i]->max_length = $info['length'];
}
return $retval;
}
示例5: gcms_fetch_object
function gcms_fetch_object($nresult)
{
$result = ibase_fetch_object($nresult);
if ($result) {
$coln = ibase_num_fields($nresult);
for ($i = 0; $i < $coln; $i++) {
$col_info = ibase_field_info($nresult, $i);
eval("\$result->" . strtolower($col_info['alias']) . " = \$result->" . $col_info['alias'] . ";");
}
}
return $result;
}
示例6: GetFields
function GetFields()
{
$_fields = array();
$_result = ibase_query($this->_Link, $this->SelectCommand);
$coln = ibase_num_fields($_result);
for ($i = 0; $i < $coln; $i++) {
$_prop = ibase_field_info($_result, $i);
$_field = array("Name" => $_prop["name"], "Type" => $_prop["type"], "Not_Null" => 0);
array_push($_fields, $_field);
}
ibase_free_result($_result);
return $_fields;
}
示例7: field_data
/**
* Field data
*
* Generates an array of objects containing field meta-data
*
* @access public
* @return array
*/
function field_data()
{
$retval = array();
for ($i = 0; $i < $this->num_fields(); $i++) {
$col_info = ibase_field_info($this->result_id, $i);
$F = new stdClass();
$F->name = $col_info['name'];
$F->type = $col_info['type'];
$F->max_length = $col_info['length'];
$F->primary_key = 0;
$F->default = '';
$retval[] = $F;
}
return $retval;
}
示例8: __construct
/**
* This function initializes the class.
*
* @access public
* @override
* @param DB_Connection_Driver $connection the connection to be used
* @param string $sql the SQL statement to be queried
* @param integer $mode the execution mode to be used
* @throws Throwable_SQL_Exception indicates that the query failed
*/
public function __construct(DB_Connection_Driver $connection, $sql, $mode = NULL)
{
$this->resource = $connection->get_resource();
$command = @ibase_query($this->resource, $sql);
if ($command === FALSE) {
throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => @ibase_errmsg()));
}
$this->command = $command;
$this->record = FALSE;
$this->blobs = array();
$count = (int) @ibase_num_fields($command);
for ($i = 0; $i < $count; $i++) {
$field = ibase_field_info($command, $i);
if ($field['type'] == 'BLOB') {
$this->blobs[] = $field['name'];
}
}
}
示例9: field_data
/**
* Field data
*
* Generates an array of objects containing field meta-data
*
* @access public
* @return array
*/
function field_data()
{
$retval = array();
$fieldCount = $this->num_fields();
for ($c = 0; $c < $fieldCount; $c++) {
$col_info = ibase_field_info($this->stmt_id, $c);
$F = new stdClass();
$F->name = $col_info['name'];
$F->type = $col_info['type'];
$F->max_length = $col_info['length'];
$retval[] = $F;
}
return $retval;
}
示例10: _execute
/**
* Executes a prepared statement.
*
* @param array $params OPTIONAL Values to bind to parameter placeholders.
* @return bool
* @throws ZendX_Db_Statement_Firebird_Exception
*/
public function _execute(array $params = null)
{
if (!$this->_stmtPrepared) {
return false;
}
// if no params were given as an argument to execute(),
// then default to the _bindParam array
if ($params === null) {
$params = $this->_bindParam;
}
// send $params as input parameters to the statement
if ($params) {
array_unshift($params, $this->_stmtPrepared);
$retval = @call_user_func_array('ibase_execute', $params);
} else {
// execute the statement
$retval = @ibase_execute($this->_stmtPrepared);
}
$this->_stmtResult = $retval;
if ($retval === false) {
$last_error = ibase_errmsg();
$this->_stmtRowCount = 0;
}
//Firebird php ibase extension, auto-commit is not after each call, but at
//end of script. Disabled when transaction is active
if (!$this->_adapter->getTransaction()) {
ibase_commit_ret();
}
if ($retval === false) {
/**
* @see ZendX_Db_Statement_Firebird_Exception
*/
require_once 'ZendX/Db/Statement/Firebird/Exception.php';
throw new ZendX_Db_Statement_Firebird_Exception("Firebird statement execute error : " . $last_error);
}
// statements that have no result set do not return metadata
if (is_resource($this->_stmtResult)) {
// get the column names that will result
$this->_keys = array();
$coln = ibase_num_fields($this->_stmtResult);
$this->_stmtColumnCount = $coln;
for ($i = 0; $i < $coln; $i++) {
$col_info = ibase_field_info($this->_stmtResult, $i);
$this->_keys[] = $this->_adapter->foldCase($col_info['name']);
}
// set up a binding space for result variables
$this->_values = array_fill(0, count($this->_keys), null);
// set up references to the result binding space.
// just passing $this->_values in the call_user_func_array()
// below won't work, you need references.
$refs = array();
foreach ($this->_values as $i => &$f) {
$refs[$i] =& $f;
}
}
if ($trans = $this->_adapter->getTransaction()) {
$this->_stmtRowCount = ibase_affected_rows($trans);
} else {
$this->_stmtRowCount = ibase_affected_rows($this->_adapter->getConnection());
}
return true;
}
示例11: write_data
function write_data($table_name)
{
global $db;
$ary_type = $ary_name = array();
// Grab all of the data from current table.
$sql = "SELECT *\n\t\t\tFROM {$table_name}";
$result = $db->sql_query($sql);
$i_num_fields = ibase_num_fields($result);
for ($i = 0; $i < $i_num_fields; $i++) {
$info = ibase_field_info($result, $i);
$ary_type[$i] = $info['type'];
$ary_name[$i] = $info['name'];
}
while ($row = $db->sql_fetchrow($result)) {
$schema_vals = $schema_fields = array();
// Build the SQL statement to recreate the data.
for ($i = 0; $i < $i_num_fields; $i++) {
$str_val = $row[strtolower($ary_name[$i])];
if (preg_match('#char|text|bool|varbinary|blob#i', $ary_type[$i])) {
$str_quote = '';
$str_empty = "''";
$str_val = sanitize_data_generic(str_replace("'", "''", $str_val));
} else {
if (preg_match('#date|timestamp#i', $ary_type[$i])) {
if (empty($str_val)) {
$str_quote = '';
} else {
$str_quote = "'";
}
} else {
$str_quote = '';
$str_empty = 'NULL';
}
}
if (empty($str_val) && $str_val !== '0') {
$str_val = $str_empty;
}
$schema_vals[$i] = $str_quote . $str_val . $str_quote;
$schema_fields[$i] = '"' . $ary_name[$i] . '"';
}
// Take the ordered fields and their associated data and build it
// into a valid sql statement to recreate that field in the data.
$sql_data = "INSERT INTO {$table_name} (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
$this->flush($sql_data);
}
$db->sql_freeresult($result);
}
示例12: getFields
/**
+----------------------------------------------------------
* 取得数据表的字段信息
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function getFields($tableName)
{
$result = $this->query('SELECT RDB$FIELD_NAME AS FIELD, RDB$DEFAULT_VALUE AS DEFAULT1, RDB$NULL_FLAG AS NULL1 FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME=UPPER(\'' . $tableName . '\') ORDER By RDB$FIELD_POSITION');
$info = array();
if ($result) {
foreach ($result as $key => $val) {
$info[trim($val['FIELD'])] = array('name' => trim($val['FIELD']), 'type' => '', 'notnull' => (bool) ($val['NULL1'] == 1), 'default' => $val['DEFAULT1'], 'primary' => false, 'autoinc' => false);
}
}
//剑雷 取表字段类型
$sql = 'select first 1 * from ' . $tableName;
$rs_temp = ibase_query($this->_linkID, $sql);
$fieldCount = ibase_num_fields($rs_temp);
for ($i = 0; $i < $fieldCount; $i++) {
$col_info = ibase_field_info($rs_temp, $i);
$info[trim($col_info['name'])]['type'] = $col_info['type'];
}
ibase_free_result($rs_temp);
//剑雷 取表的主键
$sql = 'select b.rdb$field_name as FIELD_NAME from rdb$relation_constraints a join rdb$index_segments b
on a.rdb$index_name=b.rdb$index_name
where a.rdb$constraint_type=\'PRIMARY KEY\' and a.rdb$relation_name=UPPER(\'' . $tableName . '\')';
$rs_temp = ibase_query($this->_linkID, $sql);
while ($row = ibase_fetch_object($rs_temp)) {
$info[trim($row->FIELD_NAME)]['primary'] = True;
}
ibase_free_result($rs_temp);
return $info;
}
示例13: resultSet
/**
* Enter description here...
*
* @param unknown_type $results
*/
function resultSet(&$results)
{
$this->results =& $results;
$this->map = array();
$num_fields = ibase_num_fields($results);
$index = 0;
$j = 0;
while ($j < $num_fields) {
$column = ibase_field_info($results, $j);
if (!empty($column[2])) {
$this->map[$index++] = array(ucfirst(strtolower($this->modeltmp[strtolower($column[2])])), strtolower($column[1]));
} else {
$this->map[$index++] = array(0, strtolower($column[1]));
}
$j++;
}
}
示例14: columns
public function columns()
{
if (empty($this->query)) {
return false;
}
$columns = array();
$num_fields = $this->numFields();
$field = '';
for ($i = 0; $i < $num_fields; $i++) {
$field = ibase_field_info($this->query, $i);
$column[] = $field['name'];
}
return $columns;
}
示例15: ADOFieldObject
function &FetchField($fieldOffset = -1)
{
$fld = new ADOFieldObject();
$ibf = ibase_field_info($this->_queryID, $fieldOffset);
switch (ADODB_ASSOC_CASE) {
case 2:
// the default
$fld->name = $ibf['alias'];
if (empty($fld->name)) {
$fld->name = $ibf['name'];
}
break;
case 0:
$fld->name = strtoupper($ibf['alias']);
if (empty($fld->name)) {
$fld->name = strtoupper($ibf['name']);
}
break;
case 1:
$fld->name = strtolower($ibf['alias']);
if (empty($fld->name)) {
$fld->name = strtolower($ibf['name']);
}
break;
}
$fld->type = $ibf['type'];
$fld->max_length = $ibf['length'];
/* This needs to be populated from the metadata */
$fld->not_null = false;
$fld->has_default = false;
$fld->default_value = 'null';
return $fld;
}