本文整理汇总了PHP中sybase_query函数的典型用法代码示例。如果您正苦于以下问题:PHP sybase_query函数的具体用法?PHP sybase_query怎么用?PHP sybase_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sybase_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getQueryCount
public function getQueryCount($qtxt)
{
$link = $this->getDB();
$qtxt = iconv("utf-8", "gbk//ignore", $qtxt);
$query = sybase_query("exec llt_searchByPageCount " . "'" . $qtxt . "'", $link);
$row = sybase_fetch_array($query);
return $row[0];
}
示例2: onConnect
/**
* Process connect events.
*
* @param var observable
* @param var dbevent
*/
public function onConnect($obs, $arg)
{
ini_set('sybct.min_server_severity', 0);
sybase_set_message_handler(array($this, '_msghandler'), $obs->handle);
sybase_query('set statistics io on', $obs->handle);
// Reset query- and message-cache
$this->queries = $this->messages = array();
}
示例3: onConnect
/**
* Process connect events.
*
* @param var observable
* @param var dbevent
*/
public function onConnect($obs, $arg)
{
ini_set('sybct.min_server_severity', 0);
sybase_set_message_handler([$this, '_msghandler'], $obs->handle);
sybase_query('set showplan on', $obs->handle);
// Reset query- and message-cache
$this->queries = $this->messages = [];
}
示例4: _execute
protected function _execute()
{
$query = $this->_build_query();
if (!$query) {
return false;
}
$this->_result = @sybase_query($query, $this->_link);
if (!$this->_result) {
$this->_set_stmt_error(null, PDO::ERRMODE_SILENT, 'execute');
return false;
}
return true;
}
示例5: dbQuery
function dbQuery($query, $show_errors = true, $all_results = true, $show_output = true)
{
if ($show_errors) {
error_reporting(E_ALL);
} else {
error_reporting(E_PARSE);
}
// Connect to the Sybase database management system
$link = @sybase_pconnect("192.168.231.144", "testuser", "testpass");
if (!$link) {
die(sybase_get_last_message());
}
// Make 'testdb' the current database
$db_selected = @sybase_select_db("testdb");
if (!$db_selected) {
die(sybase_get_last_message());
}
// Print results in HTML
print "<html><body>\n";
// Print SQL query to test sqlmap '--string' command line option
//print "<b>SQL query:</b> " . $query . "<br>\n";
// Perform SQL injection affected query
$result = sybase_query($query);
if (!$result) {
if ($show_errors) {
print "<b>SQL error:</b> " . sybase_get_last_message() . "<br>\n";
}
exit(1);
}
if (!$show_output) {
exit(1);
}
print "<b>SQL results:</b>\n";
print "<table border=\"1\">\n";
while ($line = sybase_fetch_assoc($result)) {
print "<tr>";
foreach ($line as $col_value) {
print "<td>" . $col_value . "</td>";
}
print "</tr>\n";
if (!$all_results) {
break;
}
}
print "</table>\n";
print "</body></html>";
}
示例6: select
function select($fields, $tables, $where = "", $order_by = "", $group_by = "", $having = "")
{
$sql_stat = " select {$fields} from {$tables} ";
if (!empty($where)) {
$sql_stat .= "where {$where} ";
}
if (!empty($group_by)) {
$sql_stat .= "group by {$group_by} ";
}
if (!empty($order_by)) {
$sql_stat .= "order by {$order_by} ";
}
if (!empty($having)) {
$sql_stat .= "having {$having} ";
}
$this->db_result = @sybase_query($sql_stat) or print "Error";
$this->db_affected_rows = @sybase_num_rows($this->db_result);
return $sql_stat;
}
示例7: _query
protected function _query($query)
{
global $configArray;
if (strcasecmp($configArray['System']['operatingSystem'], 'windows') == 0) {
return sybase_query($query);
} else {
return mssql_query($query);
}
}
示例8: query
function query($query)
{
//if flag to convert query from MySql syntax to Sybase syntax is true
//convert the query
if ($this->convertMySqlTosybaseQuery == true) {
$query = $this->ConvertMySqlTosybase($query);
}
// Initialise return
$return_val = 0;
// Flush cached values..
$this->flush();
// For reg expressions
$query = trim($query);
// Log how the function was called
$this->func_call = "\$db->query(\"{$query}\")";
// Keep track of the last query for debug..
$this->last_query = $query;
// Count how many queries there have been
$this->num_queries++;
// Use core file cache function
if ($cache = $this->get_cache($query)) {
return $cache;
}
// If there is no existing database connection then try to connect
if (!isset($this->dbh) || !$this->dbh) {
$this->connect($this->dbuser, $this->dbpassword, $this->dbhost);
$this->select($this->dbname);
}
// Perform the query via std sybase_query function..
$this->result = @sybase_query($query);
// If there is an error then take note of it..
if ($this->result == false) {
$get_errorcodeSql = "SELECT @@ERROR as errorcode";
$error_res = @sybase_query($get_errorcodeSql, $this->dbh);
$errorCode = @sybase_result($error_res, 0, "errorcode");
$get_errorMessageSql = "SELECT severity as errorSeverity, text as errorText FROM sys.messages WHERE message_id = " . $errorCode;
$errormessage_res = @sybase_query($get_errorMessageSql, $this->dbh);
if ($errormessage_res) {
$errorMessage_Row = @sybase_fetch_row($errormessage_res);
$errorSeverity = $errorMessage_Row[0];
$errorMessage = $errorMessage_Row[1];
}
$sqlError = "ErrorCode: " . $errorCode . " ### Error Severity: " . $errorSeverity . " ### Error Message: " . $errorMessage . " ### Query: " . $query;
$is_insert = true;
$this->register_error($sqlError);
$this->show_errors ? trigger_error($sqlError, E_USER_WARNING) : null;
return false;
}
// Query was an insert, delete, update, replace
$is_insert = false;
if (preg_match("/^(insert|delete|update|replace)\\s+/i", $query)) {
$this->rows_affected = @sybase_rows_affected($this->dbh);
// Take note of the insert_id
if (preg_match("/^(insert|replace)\\s+/i", $query)) {
$identityresultset = @sybase_query("select SCOPE_IDENTITY()");
if ($identityresultset != false) {
$identityrow = @sybase_fetch_row($identityresultset);
$this->insert_id = $identityrow[0];
}
}
// Return number of rows affected
$return_val = $this->rows_affected;
} else {
// Take note of column info
$i = 0;
while ($i < @sybase_num_fields($this->result)) {
$this->col_info[$i] = @sybase_fetch_field($this->result);
$i++;
}
// Store Query Results
$num_rows = 0;
while ($row = @sybase_fetch_object($this->result)) {
// Store relults as an objects within main array
$this->last_result[$num_rows] = $row;
$num_rows++;
}
@sybase_free_result($this->result);
// Log number of rows the query returned
$this->num_rows = $num_rows;
// Return number of rows selected
$return_val = $this->num_rows;
}
// disk caching of queries
$this->store_cache($query, $is_insert);
// If debug ALL queries
$this->trace || $this->debug_all ? $this->debug() : null;
return $return_val;
}
示例9: query0
/**
* Execute any statement
*
* @param string sql
* @param bool buffered default TRUE
* @return rdbms.sybase.SybaseResultSet or TRUE if no resultset was created
* @throws rdbms.SQLException
*/
protected function query0($sql, $buffered = TRUE)
{
if (!is_resource($this->handle)) {
if (!($this->flags & DB_AUTOCONNECT)) {
throw new SQLStateException('Not connected');
}
$c = $this->connect();
// Check for subsequent connection errors
if (FALSE === $c) {
throw new SQLStateException('Previously failed to connect');
}
}
if (!$buffered) {
$result = @sybase_unbuffered_query($sql, $this->handle, FALSE);
} else {
if ($this->flags & DB_UNBUFFERED) {
$result = @sybase_unbuffered_query($sql, $this->handle, $this->flags & DB_STORE_RESULT);
} else {
$result = @sybase_query($sql, $this->handle);
}
}
if (FALSE === $result) {
$message = 'Statement failed: ' . trim(sybase_get_last_message()) . ' @ ' . $this->dsn->getHost();
if (!is_resource($error = sybase_query('select @@error', $this->handle))) {
// The only case selecting @@error should fail is if we receive a
// disconnect. We could also check on the warnings stack if we can
// find the following:
//
// Sybase: Client message: Read from SQL server failed. (severity 78)
//
// but that seems a bit errorprone.
throw new SQLConnectionClosedException($message, $sql);
}
$code = current(sybase_fetch_row($error));
switch ($code) {
case 1205:
// Deadlock
throw new SQLDeadlockException($message, $sql, $code);
default:
// Other error
throw new SQLStatementFailedException($message, $sql, $code);
}
}
return TRUE === $result ? $result : new SybaseResultSet($result, $this->tz);
}
示例10: rollBack
public function rollBack()
{
parent::rollback();
if (!sybase_query('ROLLBACK', $this->link)) {
$this->set_driver_error(null, PDO::ERRMODE_EXCEPTION, 'rollBack');
}
$this->setAttribute(PDO::ATTR_AUTOCOMMIT, $this->driver_options[PDO::ATTR_AUTOCOMMIT]);
return true;
}
示例11: query_sybase
function query_sybase($query)
{
if (!$this->sybase_link) {
return false;
}
$this->query_result = sybase_query($query, $this->sybase_link);
if ($this->query_result) {
return $this->query_result;
} else {
print nl2br("Error query. \n");
return false;
}
}
示例12: die
<?php
//phpinfo();
$link = @sybase_connect('lltang2000', 'sa', '******') or die("Could not connect !");
//连接数据库,第一空必须写服务名称,不能是ip;
echo "Connected successfully<br>";
$db = @sybase_select_db("sulcmis", $link) or die("数据库没有选择");
echo "数据库选择成功<br>";
$sql = "select ctrlNo,F200,F210c from b_brief where ctrlNo<100";
$rs = sybase_query($sql, $link);
//查询表
if (!$rs) {
echo "SQL:" . $sql . "执行失败!";
exit;
}
//$sybase = sybase_fetch_array($rs);
//print_r($sybase);//结束
echo '<table border="1"><tr><td>CtrlNO</td><td>F200</td><td>F210c</td>';
while ($row = sybase_fetch_array($rs)) {
$id = $row["ctrlNo"];
$F200 = $row["F200"];
$F210c = $row["F210c"];
echo '<tr><td>' . $id . '</td><td>' . $F200 . '</td><td>' . $F210c . '</td></tr>';
}
echo '</table>';
sybase_free_result($rs);
sybase_close($link);
?>
示例13: sybase_connect
<html>
<body bgcolor=white>
<?php
$dbproc = sybase_connect("JDBC", "guest", "sybase");
if (!$dbproc) {
return;
}
$res = sybase_query("select * from test", $dbproc);
if (!$res) {
return;
}
while ($arr = sybase_fetch_array($res)) {
print $arr["i"] . " " . $arr["v"] . "<br>\n";
}
?>
</body>
</html>
示例14: sybase_query
$intention = $med[Intention];
$protocole = $med[Protocole];
$Tstage = $med[Code1];
$Nstage = $med[Code2];
$Mstage = $med[Code3];
$stage = $med[Code4];
$ptpn = $med[Code5];
//requete sur la partie CodeDiag
$queryDIAG = "SELECT * FROM CodeDiag\n\t\t\tWHERE (CodeDiag.DiagCode='{$Diag}')";
$requeteDIAG = sybase_query($queryDIAG, $link);
//while($co=sybase_fetch_array($requeteDIAG)) {
$co = sybase_fetch_array($requeteDIAG);
$DiagT = $co[1];
//requete sur la partie CodeRegion
$queryREG = "SELECT * FROM CodeRegion\n\t\t\tWHERE (CodeRegion.RegionCode='{$Region}')";
$requeteREG = sybase_query($queryREG, $link);
//while($re=sybase_fetch_array($requeteREG)) {
$re = sybase_fetch_array($requeteREG);
$RegT = $re[RegionText];
sybase_close($link);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" class="textprint" height="65">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%"><img src="../images/UCL.jpg" width="70" height="105"></td>
<td><p><b><font size="3" face="Verdana, Arial, Helvetica, sans-serif">Université catholique de Louvain<br>
</font></b> <font size="3"><b><font face="Verdana, Arial, Helvetica, sans-serif">Cliniques Universitaire Saint-Luc</font></b></font><br>
<font size="1">association sans but lucratif</font></p>
示例15: _sybase_field_flags
/**
* Get the flags for a field
*
* Currently supports:
* + <samp>unique_key</samp> (unique index, unique check or primary_key)
* + <samp>multiple_key</samp> (multi-key index)
*
* @param string $table the table name
* @param string $column the field name
*
* @return string space delimited string of flags. Empty string if none.
*
* @access private
*/
function _sybase_field_flags($table, $column)
{
static $tableName = null;
static $flags = array();
if ($table != $tableName) {
$flags = array();
$tableName = $table;
/* We're running sp_helpindex directly because it doesn't exist in
* older versions of ASE -- unfortunately, we can't just use
* DB::isError() because the user may be using callback error
* handling. */
$res = @sybase_query("sp_helpindex {$table}", $this->connection);
if ($res === false || $res === true) {
// Fake a valid response for BC reasons.
return '';
}
while (($val = sybase_fetch_assoc($res)) !== false) {
if (!isset($val['index_keys'])) {
/* No useful information returned. Break and be done with
* it, which preserves the pre-1.7.9 behaviour. */
break;
}
$keys = explode(', ', trim($val['index_keys']));
if (sizeof($keys) > 1) {
foreach ($keys as $key) {
$this->_add_flag($flags[$key], 'multiple_key');
}
}
if (strpos($val['index_description'], 'unique')) {
foreach ($keys as $key) {
$this->_add_flag($flags[$key], 'unique_key');
}
}
}
sybase_free_result($res);
}
if (array_key_exists($column, $flags)) {
return implode(' ', $flags[$column]);
}
return '';
}