本文整理汇总了PHP中cubrid_column_names函数的典型用法代码示例。如果您正苦于以下问题:PHP cubrid_column_names函数的具体用法?PHP cubrid_column_names怎么用?PHP cubrid_column_names使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cubrid_column_names函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _fetch
/**
* Fetch the result
* @param resource $result
* @param int|NULL $arrayIndexEndValue
* @return array
*/
function _fetch($result, $arrayIndexEndValue = NULL)
{
$output = array();
if (!$this->isConnected() || $this->isError() || !$result) {
return array();
}
if ($this->use_prepared_statements == 'Y') {
}
// TODO Improve this piece of code
// This code trims values from char type columns
$col_types = cubrid_column_types($result);
$col_names = cubrid_column_names($result);
$max = count($col_types);
for ($count = 0; $count < $max; $count++) {
if (preg_match("/^char/", $col_types[$count]) > 0) {
$char_type_fields[] = $col_names[$count];
}
}
while ($tmp = cubrid_fetch($result, CUBRID_OBJECT)) {
if (is_array($char_type_fields)) {
foreach ($char_type_fields as $val) {
$tmp->{$val} = rtrim($tmp->{$val});
}
}
if ($arrayIndexEndValue) {
$output[$arrayIndexEndValue--] = $tmp;
} else {
$output[] = $tmp;
}
}
unset($char_type_fields);
if ($result) {
cubrid_close_request($result);
}
if (count($output) == 1) {
// If call is made for pagination, always return array
if (isset($arrayIndexEndValue)) {
return $output;
} else {
return $output[0];
}
}
return $output;
}
示例2: list_fields
/**
* Fetch Field Names
*
* Generates an array of column names
*
* @access public
* @return array
*/
function list_fields()
{
return cubrid_column_names($this->result_id);
}
示例3: testCubridColumnNames2
/**
* @group php-822
*/
public function testCubridColumnNames2()
{
if (OUTPUT_FUNCTION_NAME == true) {
echo "\r\nRunning: " . __FUNCTION__ . " = ";
}
try {
$this->sql = "create table test1 (id int, hobby set)";
cubrid_execute($this->con, $this->sql);
$this->sql = "insert into test1 values(1, {'a', 'b', 'c'})";
cubrid_execute($this->con, $this->sql);
$this->sql = "select * from test1 where id=1";
$this->req = cubrid_execute($this->con, $this->sql);
$colnames = cubrid_column_names(NULL);
$this->assertTrue(FALSE);
} catch (Exception $e) {
$this->assertTrue(TRUE);
$this->req = null;
$this->log = __FUNCTION__;
self::writeErrorLog($e);
$this->sql = "drop table test1";
cubrid_execute($this->con, $this->sql);
}
}