function recupera_campo($campo,$tabela,$campo_condicao,$condicao) { $consulta = "SELECT $campo FROM $tabela WHERE $campo_condicao = $condicao"; $resultado = ibase_query($consulta); $registro = ibase_fetch_object($resultado); $campo = $registro->$campo; return $campo; }
function FetchAs($result) { if (!is_resource($result)) { return false; } return ibase_fetch_object($result); //cambio de fetch_assoc por fetch_row }
function sendSMS() { global $database; $sql = $database->query("SELECT * FROM SYSSETTINGS"); while ($row = ibase_fetch_object($sql)) { $this->tumasmsusername = $row->SMSUSERNAME; $this->tumasmspassword = $row->SMSPASSWORD; $this->sms_from = $row->SMSSENDERID; } }
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; }
public function executeQuery($sql) { try { $this->openConnection(); $this->rtemp = ibase_query($this->connection, $sql); while ($row = ibase_fetch_object($this->rtemp)) { $this->result[] = $row; } $this->freeResult(); $this->closeConnection(); } catch (Exception $ex) { $this->logger->log("Exception while connection with firebird database... {$ex}"); } }
/** * Build db-specific report * @access private */ function _sql_report($mode, $query = '') { switch ($mode) { case 'start': break; case 'fromcache': $endtime = explode(' ', microtime()); $endtime = $endtime[0] + $endtime[1]; $result = @ibase_query($this->db_connect_id, $query); while ($void = @ibase_fetch_object($result, IBASE_TEXT)) { // Take the time spent on parsing rows into account } @ibase_free_result($result); $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; $this->sql_report('record_fromcache', $query, $endtime, $splittime); break; } }
/** * Result - object * * Returns the result set as an object * * @return object */ protected function _fetch_object() { if (($row = @ibase_fetch_object($this->result_id, IBASE_FETCH_BLOBS)) !== FALSE) { //Increment row count $this->num_rows++; } return $row; }
/** * Get the column's flags * * Supports "primary_key", "unique_key", "not_null", "default", * "computed" and "blob". * * @param string $field_name the name of the field * @param string $table_name the name of the table * * @return string the flags * * @access private */ function _ibaseFieldFlags($field_name, $table_name) { $sql = 'SELECT R.RDB$CONSTRAINT_TYPE CTYPE' . ' FROM RDB$INDEX_SEGMENTS I' . ' JOIN RDB$RELATION_CONSTRAINTS R ON I.RDB$INDEX_NAME=R.RDB$INDEX_NAME' . ' WHERE I.RDB$FIELD_NAME=\'' . $field_name . '\'' . ' AND UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\''; $result = @ibase_query($this->connection, $sql); if (!$result) { return $this->ibaseRaiseError(); } $flags = ''; if ($obj = @ibase_fetch_object($result)) { @ibase_free_result($result); if (isset($obj->CTYPE) && trim($obj->CTYPE) == 'PRIMARY KEY') { $flags .= 'primary_key '; } if (isset($obj->CTYPE) && trim($obj->CTYPE) == 'UNIQUE') { $flags .= 'unique_key '; } } $sql = 'SELECT R.RDB$NULL_FLAG AS NFLAG,' . ' R.RDB$DEFAULT_SOURCE AS DSOURCE,' . ' F.RDB$FIELD_TYPE AS FTYPE,' . ' F.RDB$COMPUTED_SOURCE AS CSOURCE' . ' FROM RDB$RELATION_FIELDS R ' . ' JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME' . ' WHERE UPPER(R.RDB$RELATION_NAME)=\'' . strtoupper($table_name) . '\'' . ' AND R.RDB$FIELD_NAME=\'' . $field_name . '\''; $result = @ibase_query($this->connection, $sql); if (!$result) { return $this->ibaseRaiseError(); } if ($obj = @ibase_fetch_object($result)) { @ibase_free_result($result); if (isset($obj->NFLAG)) { $flags .= 'not_null '; } if (isset($obj->DSOURCE)) { $flags .= 'default '; } if (isset($obj->CSOURCE)) { $flags .= 'computed '; } if (isset($obj->FTYPE) && $obj->FTYPE == 261) { $flags .= 'blob '; } } return trim($flags); }
function num_rows($query) { if ($this->debug) { echo "<pre style=\"color : green\">Getting number of rows {$this->dbpath} <p style=\"color:purple;\"> {$query} </p></pre>"; } $noofrows = 0; //Validate the sql statement and make adjustments switch ($this->dbtype) { /* Firebird Functionality */ case "firebird": //write some things here $icount = 0; while ($row = ibase_fetch_object($query)) { $icount++; } $noofrows = $icount; break; /* SQLite Functionality */ /* SQLite Functionality */ case "sqlite": putenv("TMP=" . $this->tmppath); $noofrows = sqlite_num_rows($query); break; /*DBASE functionality */ /*DBASE functionality */ case "dbase": $noofrows = dbase_numrecords($this->dbh); break; /* MYSQL Functionality */ /* MYSQL Functionality */ case "mysql": $noofrows = mysql_num_rows($query); break; /* Oracle Functionality */ /* Oracle Functionality */ case "oracle": $noofrows = oci_num_rows($query); break; /* PGSQL Functionality */ /* PGSQL Functionality */ case "pgsql": $noofrows = pg_num_rows($query); break; } if ($this->debug) { echo "<pre style=\"color : blue\">Number of rows {$noofrows} \n </pre>"; } return $noofrows; }
/** +---------------------------------------------------------- * 取得数据表的字段信息 +---------------------------------------------------------- * @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; }
/** * Result - object * * Returns the result set as an object * * @param string $class_name * @return object */ protected function _fetch_object($class_name = 'stdClass') { $row = ibase_fetch_object($this->result_id, IBASE_FETCH_BLOBS); if ($class_name === 'stdClass' or !$row) { return $row; } $class_name = new $class_name(); foreach ($row as $key => $value) { $class_name->{$key} = $value; } return $class_name; }
/** * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다 * * 그닥 좋지는 않은 구조이지만 편리하다.. -_-; **/ function _getNavigationData($table_list, $columns, $left_join, $condition, $output) { require_once _XE_PATH_ . 'classes/page/PageHandler.class.php'; $query_groupby = ''; if ($output->groups) { foreach ($output->groups as $key => $val) { $group_list[] = $this->autoQuotes($val); } if (count($group_list)) { $query_groupby = sprintf(" GROUP BY %s", implode(", ", $group_list)); } } /* // group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정 // 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다. // $count_condition = strlen($query_groupby) ? sprintf('%s group by %s', $condition, $query_groupby) : $condition; $total_count = $this->getCountCache($output->tables, $count_condition); if($total_count === false) { $count_query = sprintf('select count(*) as "count" from %s %s %s', implode(', ', $table_list), implode(' ', $left_join), $count_condition); if (count($output->groups)) $count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query); $result = $this->_query($count_query); $count_output = $this->_fetch($result); $total_count = (int)$count_output->count; $this->putCountCache($output->tables, $count_condition, $total_count); } */ // 전체 개수를 구함 $count_query = sprintf("select count(*) as \"count\" from %s %s %s", implode(',', $table_list), implode(' ', $left_join), $condition); $total_count = $this->getCountCache($output->tables, $condition); if ($total_count === false) { $result = $this->_query($count_query); $count_output = $this->_fetch($result); if (!$this->transaction_started) { @ibase_commit($this->fd); } $total_count = (int) $count_output->count; $this->putCountCache($output->tables, $condition, $total_count); } $list_count = $output->list_count['value']; if (!$list_count) { $list_count = 20; } $page_count = $output->page_count['value']; if (!$page_count) { $page_count = 10; } $page = $output->page['value']; if (!$page) { $page = 1; } // 전체 페이지를 구함 if ($total_count) { $total_page = (int) (($total_count - 1) / $list_count) + 1; } else { $total_page = 1; } // 페이지 변수를 체크 if ($page > $total_page) { $page = $total_page; } $start_count = ($page - 1) * $list_count; // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 if ($output->order) { $conditions = $this->getConditionList($output); if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { foreach ($output->order as $key => $val) { $col = $val[0]; if (!in_array($col, array('list_order', 'update_order'))) { continue; } if ($condition) { $condition .= sprintf(' and "%s" < 2100000000 ', $col); } else { $condition = sprintf(' where "%s" < 2100000000 ', $col); } } } } $limit = sprintf('FIRST %d SKIP %d ', $list_count, $start_count); $query = sprintf('SELECT %s %s FROM %s %s %s', $limit, $columns, implode(',', $table_list), implode(' ', $left_join), $condition); if (strlen($query_groupby)) { $query .= $query_groupby; } if ($output->order) { foreach ($output->order as $key => $val) { $index_list[] = sprintf("%s %s", $this->autoQuotes($val[0]), $val[1]); } if (count($index_list)) { $query .= sprintf(" ORDER BY %s", implode(",", $index_list)); } } $query .= ";"; $result = $this->_query($query); if ($this->isError()) { if (!$this->transaction_started) { @ibase_rollback($this->fd); } $buff = new Object(); $buff->total_count = 0; $buff->total_page = 0; $buff->page = 1; $buff->data = array(); $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); return $buff; } $virtual_no = $total_count - ($page - 1) * $list_count; while ($tmp = ibase_fetch_object($result)) { foreach ($tmp as $key => $val) { $type = $output->column_type[$key]; if ($type == null) { foreach ($output->columns as $cols) { if ($cols['alias'] == $key) { $type = $output->column_type[$cols['name']]; } } } if ($type == "text" || $type == "bigtext") { $blob_data = ibase_blob_info($tmp->{$key}); $blob_hndl = ibase_blob_open($tmp->{$key}); $tmp->{$key} = ibase_blob_get($blob_hndl, $blob_data[0]); ibase_blob_close($blob_hndl); } } $data[$virtual_no--] = $tmp; } if (!$this->transaction_started) { @ibase_commit($this->fd); } $buff = new Object(); $buff->total_count = $total_count; $buff->total_page = $total_page; $buff->page = $page; $buff->data = $data; $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); return $buff; }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $dados = array('nome' => '', 'email' => '', 'senha' => ''); if ('post' == strtolower($_SERVER['REQUEST_METHOD'])) { $dados = array('nome' => filter_var($_POST['nome'], FILTER_SANITIZE_STRING), 'email' => filter_var($_POST['email'], FILTER_SANITIZE_EMAIL), 'senha' => empty($_POST['senha']) ? $usuario_logado->SENHA : sha1(md5($_POST['senha']))); $sql = "INSERT INTO usuarios(id, nome, email, senha) VALUES ((SELECT iif(MAX(id) > 0, MAX(id), 0) FROM usuarios) + 1, '{$dados['nome']}', '{$dados['email']}', '{$dados['senha']}') RETURNING id"; if ($rotas['id']) { $sql = "UPDATE usuarios SET nome = '{$dados['nome']}', email = '{$dados['email']}', senha = '{$dados['senha']}' WHERE id = '{$usuario_logado->ID}' RETURNING id"; } $query = ibase_query($conexao, $sql); $resultado = ibase_fetch_object($query); if ($resultado) { header("Location: {$base}/index.php/{$rotas['pagina']}/formulario/{$resultado->ID}"); } echo 'Houve um erro ao salvar os dados. Tente novamente.<br/>' . ibase_errmsg(); } if ($rotas['id']) { $sql = "SELECT * FROM usuarios WHERE id = '{$rotas['id']}'"; $query = ibase_query($conexao, $sql); $dados = ibase_fetch_assoc($query); $dados = array_change_key_case($dados, CASE_LOWER); } ?> <h2><?php echo $rotas['id'] ? 'Editar' : 'Criar novo'; ?>
foreach ($HTTP_GET_VARS as $key => $value) { if ($key != 'page') { $display_links .= "<input type=hidden name='" . $key . "' value='" . $value . "'>"; } } foreach ($HTTP_POST_VARS as $key => $value) { if ($key != 'page') { $display_links .= "<input type=hidden name='" . $key . "' value='" . $value . "'>"; } } if ($this->current_page_number > 1) { $display_links .= "<a href='" . replaceurl($REQUEST_URI, 'page', $this->current_page_number - 1) . "'title=Previous>" . PREVNEXT_BUTTON_PREV . "</a> "; } else { $display_links .= PREVNEXT_BUTTON_PREV . ' '; } $s = "<select name=page size=1 onchange='this.form.submit();'>"; for ($i = 1; $i <= $num_pages; $i++) { $s .= "<option value={$i}"; if ($i == $this->current_page_number) { $s .= " selected"; } $s .= ">{$i}</option>"; } $s .= "</select>";
?> value="<?php echo $usuario->ID; ?> "><?php echo $usuario->NOME; ?> </option> <?php } ?> </select><br/><br/> <label>Página</label><br/> <select required name="pagina_id"> <?php while ($pagina = ibase_fetch_object($paginas)) { ?> <option <?php echo $dados['pagina_id'] == $pagina->ID ? 'selected' : null; ?> value="<?php echo $pagina->ID; ?> "><?php echo $pagina->NOME; ?> </option> <?php } ?> </select><br/><br/>
<td align="left" valign="top" class="form_header">Units</td> <td align="left" valign="top" class="form_header">Price</td> <td align="left" valign="top" class="form_header">Cost</td> <td align="left" valign="top" class="form_header">Units</td> <td align="left" valign="top" class="form_header">Price</td> <td align="left" valign="top" class="form_header">Amount</td> <td align="left" valign="top" class="form_header">Units</td> <td align="left" valign="top" class="form_header">Nav</td> </tr> <?php $salestotals = 0; $purchasetotals = 0; $Tpurchaseunits = 0; $Tsoldunits = 0; $balance_units = 0; while ($trans = ibase_fetch_object($querytrans)) { echo "<tr valign=TOP onMouseOver=bgColor='yellow' onMouseOut=bgColor='White' bgcolor=White> "; $trans_id = $trans->TRANS_ID; $trans_date = date("d-m-Y", strtotime($trans->TRANS_DATE)); $transtype = $trans->TRANS_TYPE; if ($transtype == "PURCHASE") { $unitspurchased = $trans->NOOFSHARES; $purchaseprice = $trans->PRICE; $purchasecost = $trans->AMOUNT; $unitssold = "--"; $saleprice = "--"; $salesamount = "--"; $Tpurchaseunits = $Tpurchaseunits + $unitspurchased; $purchasetotals = $purchasetotals + $purchasecost; } elseif ($transtype == "WITHDRAWAL") { $unitspurchased = "--";
<input type="hidden" name="usuario_id" value="0" /> <input type="hidden" name="postagem_id" value="<?php echo $postagem->ID; ?> " /> <label>Texto</label><br/> <textarea rows="10" cols="75" name="texto"><?php echo $dados['texto']; ?> </textarea><br/><br/> <button>Comentar</button> </form> <hr/> <div class="comentarios"> <?php while ($comentario = ibase_fetch_object($query, IBASE_TEXT)) { ?> <b><?php echo $comentario->USUARIO_NOME ? $comentario->USUARIO_NOME : 'Anônimo'; ?> disse:</b><br/> <small><i><?php echo $comentario->DATA; ?> </i></small> <p><?php echo $comentario->TEXTO; ?> </p> <?php }
/** * fetch_assoc() * * This function fetches a result as an associative array. * * @param mixed $result * @return array * @access public * @author Thorsten Rinne <*****@*****.**> * @since 2005-04-16 */ function fetch_assoc($result) { if (function_exists('ibase_fetch_assoc')) { return ibase_fetch_assoc($result); } else { return get_object_vars(ibase_fetch_object($result)); } }
function sql_fetch_object(&$res, $nr = 0) { global $dbtype; switch ($dbtype) { case "MySQL": $row = mysql_fetch_object($res); if ($row) { return $row; } else { return false; } break; case "mSQL": $row = msql_fetch_object($res); if ($row) { return $row; } else { return false; } break; case "postgres": case "postgres_local": if ($res->get_total_rows() > $res->get_fetched_rows()) { $row = pg_fetch_object($res->get_result(), $res->get_fetched_rows()); $res->increment_fetched_rows(); if ($row) { return $row; } else { return false; } } else { return false; } break; case "ODBC": $result = odbc_fetch_row($res, $nr); if (!$result) { return false; } $nf = odbc_num_fields($res); /* Field numbering starts at 1 */ for ($count = 1; $count < $nf + 1; $count++) { $field_name = odbc_field_name($res, $count); $field_value = odbc_result($res, $field_name); $row->{$field_name} = $field_value; } return $row; break; case "ODBC_Adabas": $result = odbc_fetch_row($res, $nr); if (!$result) { return false; } $nf = count($result) + 2; /* Field numbering starts at 1 */ for ($count = 1; $count < $nf; $count++) { $field_name = odbc_field_name($res, $count); $field_value = odbc_result($res, $field_name); $row->{$field_name} = $field_value; } return $row; break; case "Interbase": $orow = ibase_fetch_object($res); if ($orow) { $arow = get_object_vars($orow); while (list($name, $key) = each($arow)) { $name = strtolower($name); $row->{$name} = $key; } return $row; } else { return false; } break; case "Sybase": $row = sybase_fetch_object($res); return $row; break; } }
<?php $host = 'localhost:/path/to/your.gdb'; $dbh = ibase_connect($host, $username, $password); $stmt = 'SELECT * FROM tblname'; $sth = ibase_query($dbh, $stmt); while ($row = ibase_fetch_object($sth)) { echo $row->email, "\n"; } ibase_free_result($sth); ibase_close($dbh);
/** * Fetches a row from the result set. * * @param int $style OPTIONAL Fetch mode for this fetch operation. * @param int $cursor OPTIONAL Absolute, relative, or other. * @param int $offset OPTIONAL Number for absolute or relative cursors. * @return mixed Array, object, or scalar depending on fetch mode. * @throws Zend_Db_Statement_Exception */ public function fetch($style = null, $cursor = null, $offset = null) { if (!$this->_stmt_result) { return false; } if ($style === null) { $style = $this->_fetchMode; } // @todo, respect the foldCase for column names switch ($style) { case Zend_Db::FETCH_NUM: $row = ibase_fetch_row($this->_stmt_result, IBASE_TEXT); break; case Zend_Db::FETCH_ASSOC: $row = ibase_fetch_assoc($this->_stmt_result, IBASE_TEXT); break; case Zend_Db::FETCH_BOTH: $row = ibase_fetch_assoc($this->_stmt_result, IBASE_TEXT); $values = array_values($row); foreach ($values as $val) { $row[] = $val; } break; case Zend_Db::FETCH_OBJ: $row = ibase_fetch_object($this->_stmt_result, IBASE_TEXT); break; case Zend_Db::FETCH_BOUND: $row = ibase_fetch_assoc($this->_stmt_result, IBASE_TEXT); $values = array_values($row); foreach ($values as $val) { $row[] = $val; } if ($row !== false) { return $this->_fetchBound($row); } break; default: /** * @see Zend_Db_Adapter_Firebird_Exception */ require_once 'Zend/Db/Statement/Firebird/Exception.php'; throw new Zend_Db_Statement_Firebird_Exception("Invalid fetch mode '{$style}' specified"); break; } if (!$row && ($error = ibase_errcode())) { /** * @see Zend_Db_Adapter_Firebird_Exception */ require_once 'Zend/Db/Statement/Firebird/Exception.php'; throw new Zend_Db_Statement_Firebird_Exception($error); } /* switch ($this->_adapter->caseFolding) { case Zend_Db::CASE_LOWER: $r = array_change_key_case($row, CASE_LOWER); break; case Zend_Db::CASE_UPPER: $r = array_change_key_case($row, CASE_UPPER); break; case default: $r = $row; break; }*/ return $row; }
<div> <?php echo $postagem->TEXTO; ?> </div> <div id="comentarios"> <?php require 'includes/formulario_comentario.php'; ?> </div> </div> <?php } else { ?> <?php while ($postagem = ibase_fetch_object($postagens, IBASE_TEXT)) { $title = strtolower(strtr(filter_var($postagem->TITULO, FILTER_SANITIZE_STRING), ' ', '-')); ?> <div class="item"> <h3><a href="index.php/<?php echo $rotas['pagina']; ?> /<?php echo preg_replace('/[^A-Za-z0-9-]+/', '-', $title); ?> /<?php echo $postagem->ID; ?> "><?php echo $postagem->TITULO; ?>
function sql_report($mode, $query = '') { if (empty($_GET['explain'])) { return; } global $cache, $starttime, $phpbb_root_path; static $curtime, $query_hold, $html_hold; static $sql_report = ''; static $cache_num_queries = 0; if (!$query && !empty($query_hold)) { $query = $query_hold; } switch ($mode) { case 'display': if (!empty($cache)) { $cache->unload(); } $this->sql_close(); $mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime; echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8869-1"><meta http-equiv="Content-Style-Type" content="text/css"><link rel="stylesheet" href="' . $phpbb_root_path . 'adm/subSilver.css" type="text/css"><style type="text/css">' . "\n"; echo 'th { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic3.gif\') }' . "\n"; echo 'td.cat { background-image: url(\'' . $phpbb_root_path . 'adm/images/cellpic1.gif\') }' . "\n"; echo '</style><title>' . $msg_title . '</title></head><body>'; echo '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td><a href="' . htmlspecialchars(preg_replace('/&explain=([^&]*)/', '', $_SERVER['REQUEST_URI'])) . '"><img src="' . $phpbb_root_path . 'adm/images/header_left.jpg" width="200" height="60" alt="phpBB Logo" title="phpBB Logo" border="0"/></a></td><td width="100%" background="' . $phpbb_root_path . 'adm/images/header_bg.jpg" height="60" align="right" nowrap="nowrap"><span class="maintitle">SQL Report</span> </td></tr></table><br clear="all"/><table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr><td height="40" align="center" valign="middle"><b>Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries} queries" . ($cache_num_queries ? " + {$cache_num_queries} " . ($cache_num_queries == 1 ? 'query' : 'queries') . ' returning data from cache' : '') . '</b></td></tr><tr><td align="center" nowrap="nowrap">Time spent on MySQL queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></td></tr></table><table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr><td>'; echo $sql_report; echo '</td></tr></table><br /></body></html>'; exit; break; case 'start': $query_hold = $query; $html_hold = ''; $curtime = explode(' ', microtime()); $curtime = $curtime[0] + $curtime[1]; break; case 'fromcache': $endtime = explode(' ', microtime()); $endtime = $endtime[0] + $endtime[1]; $result = @ibase_query($this->db_connect_id, $query); while ($void = @ibase_fetch_object($result, IBASE_TEXT)) { // Take the time spent on parsing rows into account } $splittime = explode(' ', microtime()); $splittime = $splittime[0] + $splittime[1]; $time_cache = $endtime - $curtime; $time_db = $splittime - $endtime; $color = $time_db > $time_cache ? 'green' : 'red'; $sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query results obtained from the cache</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\\t(AND|OR)(\\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\\s]*[\\n\\r\\t]+[\\n\\r\\s\\t]*/', "\n", $query))) . '</textarea></td></tr></table><p align="center">'; $sql_report .= 'Before: ' . sprintf('%.5f', $curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed [cache]: <b style="color: ' . $color . '">' . sprintf('%.5f', $time_cache) . 's</b> | Elapsed [db]: <b>' . sprintf('%.5f', $time_db) . 's</b></p>'; // Pad the start time to not interfere with page timing $starttime += $time_db; @ibase_freeresult($result); $cache_num_queries++; break; case 'stop': $endtime = explode(' ', microtime()); $endtime = $endtime[0] + $endtime[1]; $sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query #' . $this->num_queries . '</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\\t(AND|OR)(\\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\\s]*[\\n\\r\\t]+[\\n\\r\\s\\t]*/', "\n", $query))) . '</textarea></td></tr></table> ' . $html_hold . '<p align="center">'; if ($this->query_result) { if (preg_match('/^(UPDATE|DELETE|REPLACE)/', $query)) { $sql_report .= "Affected rows: <b>" . $this->sql_affectedrows($this->query_result) . '</b> | '; } $sql_report .= 'Before: ' . sprintf('%.5f', $curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed: <b>' . sprintf('%.5f', $endtime - $curtime) . 's</b>'; } else { $error = $this->sql_error(); $sql_report .= '<b style="color: red">FAILED</b> - ' . SQL_LAYER . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']); } $sql_report .= '</p>'; $this->sql_time += $endtime - $curtime; break; } }
protected function criaObjetoConsulta($sql) { return ibase_fetch_object($sql); }
/** * Fetches a row from the result set. * * @param int $style OPTIONAL Fetch mode for this fetch operation. * @param int $cursor OPTIONAL Absolute, relative, or other. * @param int $offset OPTIONAL Number for absolute or relative cursors. * @return mixed Array, object, or scalar depending on fetch mode. * @throws Zend_Db_Statement_Exception */ public function fetch($style = null, $cursor = null, $offset = null) { if (!$this->_stmtResult) { return false; } if ($style === null) { $style = $this->_fetchMode; } switch ($style) { case Zend_Db::FETCH_NUM: $row = ibase_fetch_row($this->_stmtResult, IBASE_TEXT); break; case Zend_Db::FETCH_ASSOC: $row = ibase_fetch_assoc($this->_stmtResult, IBASE_TEXT); break; case Zend_Db::FETCH_BOTH: $row = ibase_fetch_assoc($this->_stmtResult, IBASE_TEXT); if ($row !== false) { $row = array_merge($row, array_values($row)); } break; case Zend_Db::FETCH_OBJ: $row = ibase_fetch_object($this->_stmtResult, IBASE_TEXT); break; case Zend_Db::FETCH_BOUND: $row = ibase_fetch_assoc($this->_stmtResult, IBASE_TEXT); if ($row !== false) { $row = array_merge($row, array_values($row)); $row = $this->_fetchBound($row); } break; default: /** * @see ZendX_Db_Adapter_Firebird_Exception */ require_once 'ZendX/Db/Statement/Firebird/Exception.php'; throw new ZendX_Db_Statement_Firebird_Exception("Invalid fetch mode '{$style}' specified"); break; } return $row; }
<html> <head> <meta charset="UTF-8"> <title>Consulta Inventario</title> </head> <body> <?php include "C:\\wamp\\www\\dbConnection.php"; //Conexión a la Base de Datos $conexion = dbConnect(); //Consulta SQL $sent = "SELECT DESCRIPCIO FROM CATINVEN"; $resultado = consulta($conexion, $sent); // Mostrar resultados while ($c = ibase_fetch_object($resultado)) { echo $c->DESCRIPCIO; } ?> </body> </html>
/** * Renvoie sous forme d'objet la ligne suivante dans le jeu de résultat * * @access public * @return object */ function fetchObject() { $row = ibase_fetch_object($this->result, IBASE_TEXT); settype($row, 'array'); $row = array_change_key_case($row, CASE_LOWER); settype($row, 'object'); return $row; }
<?php $results = ""; $head = "\\SetWatermarkText{" . $watermark . "}\n"; $head .= "\\normalsize Биоматериал: КРОВЬ ИЗ ВЕНЫ\n\n ~~~~~~~~~~~~~~~~СОСКОБ\n\n\\vspace{3px}"; $head .= "\\vspace{-10px} \\begin{center}\\large{\\textbf{Gine-Mix максима}}\n\\vspace{3px}\\rule{1\\linewidth}{0.1mm} \n \\normalsize{\\textbf{Маркеры опухолевого роста}} \\vspace{-5px} \n\n \\end{center}"; $apprdate = find_apprdate($ordersid, $dbh); $restm = "select o.comments_pic as com from orders ord inner join ordtask o on o.ordersid = ord.id where o.testcode =1912 and ord.id in(" . $ordersid . ")"; $row = ibase_query($restm); $data = ibase_fetch_object($row); $blob_data = ibase_blob_info($data->COM); $blob_hndl = ibase_blob_open($data->COM); $comments = ibase_blob_get($blob_hndl, $blob_data[0]); $comments = str_replace('%', '\\%', $comments); $comments = str_replace('_', '\\_', $comments); ibase_blob_close($blob_hndl); ibase_free_result($row); $results .= "\n\n" . $comments; $apprusergist = ""; $restm = "select u.fullname from ordtask o inner join users u on u.usernam = o.appruser inner join tests t on t.id = o.testcode where o.ordersid in(" . $ordersid . ") and t.dept =4"; $res = ibase_query($dbh, $restm); while ($row = ibase_fetch_row($res)) { $apprusergist .= $row[0]; } ibase_free_result($res); $apprpcr = ""; $restm = "select u.fullname from ordtask o inner join users u on u.usernam = o.appruser inner join tests t on t.id = o.testcode where o.ordersid in(" . $ordersid . ") and t.dept =3"; $res = ibase_query($dbh, $restm); while ($row = ibase_fetch_row($res)) { $apprpcr .= $row[0]; }
function fetchInto($result, &$ar, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum = null) { if ($rownum !== NULL) { return $this->raiseError(DB_ERROR_NOT_CAPABLE); } if ($fetchmode == DB_FETCHMODE_DEFAULT) { $fetchmode = $this->fetchmode; } if ($fetchmode & DB_FETCHMODE_ASSOC) { $ar = (array) ibase_fetch_object($result); } else { $ar = ibase_fetch_row($result); } if (!$ar) { if ($errmsg = ibase_errmsg()) { return $this->raiseError($errmsg); } else { return null; } } return DB_OK; }
<?php require '../includes/conexao.php'; require '../includes/rotas.php'; $base .= '/admin'; if (isset($_SESSION['auth_token'])) { $sql = "SELECT id, nome, email, senha FROM usuarios WHERE token = '" . sha1($_SESSION['auth_token']) . "'"; $query = ibase_query($conexao, $sql); $usuario_logado = ibase_fetch_object($query); } ?> <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <title>Painel</title> <base href="/vivi/admin/" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <script src="ckeditor/ckeditor.js"></script> </head> <body> <?php if (isset($_SESSION['auth_token'])) { ?> <?php