本文整理汇总了PHP中odbc_result函数的典型用法代码示例。如果您正苦于以下问题:PHP odbc_result函数的具体用法?PHP odbc_result怎么用?PHP odbc_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了odbc_result函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: odbcAdapter
/**
* Constructor method for the adapter. This constructor implements the setting of the
* 3 required properties for the object.
*
* The body of this method was provided by Mario Falomir... Thanks.
*
* @param resource $d The datasource resource
*/
function odbcAdapter($d)
{
parent::RecordSetAdapter($d);
// count number of fields
$fieldcount = odbc_num_fields($d);
$ob = "";
$be = $this->isBigEndian;
$fc = pack('N', $fieldcount);
if (odbc_num_rows($d) > 0) {
$line = odbc_fetch_row($d, 0);
do {
// write all of the array elements
$ob .= "\n" . $fc;
for ($i = 1; $i <= $fieldcount; $i++) {
// write all of the array elements
$value = odbc_result($d, $i);
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 .= "";
}
}
} while ($line = odbc_fetch_row($d));
}
$this->serializedData = $ob;
// grab the number of fields
// loop over all of the fields
for ($i = 1; $i <= $fieldcount; $i++) {
// decode each field name ready for encoding when it goes through serialization
// and save each field name into the array
$this->columnNames[$i - 1] = $this->_directCharsetHandler->transliterate(odbc_field_name($d, $i));
}
$this->numRows = odbc_num_rows($d);
}
示例2: get_json_data
public function get_json_data()
{
$lista = json_decode($this->field_list);
$base = $this->db->getDB();
$this->conn = odbc_connect("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ={$base}", '', '') or exit('Cannot open with driver.');
if (!$this->conn) {
exit("Connection Failed: " . $this->conn);
}
$rs = odbc_exec($this->conn, $this->sql);
if (!$rs) {
exit("Error in SQL");
}
$value = '[';
while (odbc_fetch_row($rs)) {
$value .= '[';
foreach ($lista as $valor) {
$value .= $this->not_null(odbc_result($rs, $valor[0]), $valor[1]) . ',';
}
$value .= '],';
}
$value .= ']';
$value = str_replace(",]", "]", $value);
odbc_close_all();
//$value = utf8_encode($value);
return $value;
}
示例3: Table
function Table($sql, $col)
{
global $conn;
//Query
$res = odbc_do($conn, $sql);
if (!$res) {
die('SQL error');
}
//Header
$this->SetFillColor(255, 0, 0);
$this->SetTextColor(255);
$this->SetDrawColor(128, 0, 0);
$this->SetLineWidth(0.3);
$this->SetFont('', 'B');
$tw = 0;
foreach ($col as $label => $width) {
$tw += $width;
$this->Cell($width, 7, $label, 1, 0, 'C', 1);
}
$this->Ln();
//Rows
$this->SetFillColor(224, 235, 255);
$this->SetTextColor(0);
$this->SetFont('');
$fill = false;
while (odbc_fetch_row($res)) {
foreach ($col as $field => $width) {
$this->Cell($width, 6, odbc_result($res, $field), 'LR', 0, 'L', $fill);
}
$this->Ln();
$fill = !$fill;
}
$this->Cell($tw, 0, '', 'T');
}
示例4: execAsJson
public function execAsJson($query, $logComponent)
{
$query = 'sparql define output:format "RDF/XML" ' . $query;
/*
$query= 'sparql define output:format "TTL" ' .$query;
*/
/*
echo $query;
die;
*/
$odbc_result = $this->exec($query, $logComponent);
odbc_longreadlen($odbc_result, ODBC_MAX_LONGREAD_LENGTH);
odbc_fetch_row($odbc_result);
$data = false;
do {
$temp = odbc_result($odbc_result, 1);
if ($temp != null) {
$data .= $temp;
}
} while ($temp != null);
//=$data;
$conv = new XmlConverter();
$arr = $conv->toArray($data);
//print_r($arr);
//die;
//Logger::warn('check if faster with default graph, ');
return $arr;
}
示例5: getKOSUserByCharacter
public function getKOSUserByCharacter($chr_uid, $con)
{
$sql = "select * from dbo.chr_info where chr_uid = {$chr_uid}";
$result = odbc_exec($con, $sql);
while (odbc_fetch_row($result)) {
$return = array('UserId' => odbc_result($result, "chr_uin"));
}
return $return;
}
示例6: valCurRow
function valCurRow($col)
{
return odbc_result($this->res, $col);
/* if (isset($this->curRow[$col]))
return $this->curRow[$col] ;
else
return null ;
*/
}
示例7: isAvailable
function isAvailable($conn, $id)
{
$req = 'SELECT ESTDISPONIBLE FROM appartement WHERE IDAPPARTEMENT=' . $id;
$res = odbc_exec($conn, $req);
if (odbc_result($res, 1)) {
return true;
} else {
return false;
}
}
示例8: getCount
public function getCount($sql, $row = 0, $field = null)
{
$query = odbc_exec($this->dbConnection(), $sql);
if ($query) {
$result = odbc_result($query, $row, $field);
return $result;
} else {
$this->halt('Database query error', $sql);
}
}
示例9: getLastId
public function getLastId()
{
try {
$result = $this->query("SELECT LAST_INSERT_ID()");
$id = @odbc_result($result, 1);
} catch (Exception $e) {
throw new DbControlException("Error in trying to acquire Last inserted id.\n" . $e->getMessage(), $e->getCode());
}
return $id;
}
示例10: db_gettablelist
function db_gettablelist()
{
global $conn;
$ret=array();
$rs = odbc_tables($conn);
while(odbc_fetch_row($rs))
if(odbc_result($rs,"TABLE_TYPE")=="TABLE" || odbc_result($rs,"TABLE_TYPE")=="VIEW")
$ret[]=odbc_result($rs,"TABLE_NAME");
return $ret;
}
示例11: CheckEmailIfExists
public function CheckEmailIfExists($db)
{
$query = "select Fc_Email from tblMember";
$rows = odbc_exec($db, $query);
while (odbc_fetch_row($rows)) {
$existing = odbc_result($rows, "Fc_Email");
if ($this->email == $existing) {
return true;
}
}
}
示例12: db_gettablelist
/**
* @return Array
*/
public function db_gettablelist()
{
$ret = array();
$rs = odbc_tables($this->connectionObj->conn);
while (odbc_fetch_row($rs)) {
if (odbc_result($rs, "TABLE_TYPE") == "TABLE" || odbc_result($rs, "TABLE_TYPE") == "VIEW") {
$ret[] = odbc_result($rs, "TABLE_NAME");
}
}
return $ret;
}
示例13: GetLoginUser
public function GetLoginUser($db, $user)
{
try {
$query = "select Fc_Fullname from tblMember\n\t\t\t\t \twhere Pk_MemberID='" . $user . "'";
$toprow = odbc_exec($db, $query);
if (odbc_fetch_row($toprow)) {
return odbc_result($toprow, "Fc_Fullname");
}
} catch (Exception $e) {
return "";
}
}
示例14: ValorSqlODBC
function ValorSqlODBC($sql, $default)
{
// Devuelve el valor del primer campo del primer registro del query pasado como parámetro..
global $conn;
$query = DBExecSql($conn, $sql);
$value = odbc_result($query, 1);
if ($value == "") {
return $default;
} else {
return $value;
}
}
示例15: initTables
/**
* @see DatabaseInfo::initTables()
*/
protected function initTables()
{
include_once 'creole/drivers/odbc/metadata/ODBCTableInfo.php';
$result = @odbc_tables($this->conn->getResource());
if (!$result) {
throw new SQLException('Could not list tables', $this->conn->nativeError());
}
while (odbc_fetch_row($result)) {
$tablename = strtoupper(odbc_result($result, 'TABLE_NAME'));
$this->tables[$tablename] = new ODBCTableInfo($this, $tablename);
}
@odbc_free_result($result);
}