本文整理汇总了PHP中MDB::isManip方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB::isManip方法的具体用法?PHP MDB::isManip怎么用?PHP MDB::isManip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB
的用法示例。
在下文中一共展示了MDB::isManip方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isManip
function isManip($query)
{
return MDB::isManip($query);
}
示例2: query
/**
* Send a query to the database and return any results
*
* @access public
*
* @param string $query the SQL query
* @param mixed $types array that contains the types of the columns in
* the result set
*
* @return mixed a result handle or MDB_OK on success, a MDB error on failure
*/
function query($query, $types = NULL)
{
$this->debug("Query: {$query}");
if ($this->database_name) {
$ismanip = MDB::isManip($query);
$this->last_query = $query;
$first = $this->first_selected_row;
$limit = $this->selected_row_limit;
$this->first_selected_row = $this->selected_row_limit = 0;
$last_connection = $this->connection;
$result = $this->connect();
if (MDB::isError($result)) {
return $result;
}
if ($limit > 0) {
$fetch = $first + $limit;
if (!$ismanip) {
$query = str_replace('SELECT', "SELECT TOP {$fetch}", $query);
}
}
if ($last_connection != $this->connection || !strcmp($this->selected_database, '') || strcmp($this->selected_database, $this->database_name)) {
if (!@mssql_select_db($this->database_name, $this->connection)) {
return $this->mssqlRaiseError();
}
}
if ($result = $this->_doQuery($query)) {
if ($ismanip) {
$this->affected_rows = @mssql_rows_affected($this->connection);
return MDB_OK;
} else {
$result_value = intval($result);
if ($first > 0 || $limit > 0) {
$this->limits[$result_value] = array($first, $limit);
}
$this->highest_fetched_row[$result_value] = -1;
if ($types != NULL) {
if (!is_array($types)) {
$types = array($types);
}
$err = $this->setResultTypes($result, $types);
if (MDB::isError($err)) {
$this->freeResult($result);
return $err;
}
}
return $result;
}
}
}
return $this->mssqlRaiseError();
}
示例3: query
/**
* Send a query to the database and return any results
*
* @access public
*
* @param string $query the SQL query
* @param mixed $types array that contains the types of the columns in
* the result set
*
* @return mixed a result handle or MDB_OK on success, a MDB error on failure
*/
function query($query, $types = NULL)
{
$this->debug("Query: {$query}");
$ismanip = MDB::isManip($query);
$this->last_query = $query;
$first = $this->first_selected_row;
$limit = $this->selected_row_limit;
$this->first_selected_row = $this->selected_row_limit = 0;
$result = $this->connect();
if (MDB::isError($result)) {
return $result;
}
if ($limit > 0) {
if ($ismanip) {
$query .= " LIMIT {$limit}";
} else {
$query .= " LIMIT {$first},{$limit}";
}
}
if ($this->database_name) {
if (!@mysql_select_db($this->database_name, $this->connection)) {
return $this->mysqlRaiseError();
}
}
if ($result = @mysql_query($query, $this->connection)) {
if ($ismanip) {
$this->affected_rows = @mysql_affected_rows($this->connection);
return MDB_OK;
} else {
$result_value = intval($result);
$this->highest_fetched_row[$result_value] = -1;
if ($types != NULL) {
if (!is_array($types)) {
$types = array($types);
}
if (MDB::isError($err = $this->setResultTypes($result, $types))) {
$this->freeResult($result);
return $err;
}
}
return $result;
}
}
return $this->mysqlRaiseError();
}
示例4: query
/**
* Send a query to the database and return any results
*
* @access public
*
* @param string $query the SQL query
* @param mixed $types array that contains the types of the columns in
* the result set
*
* @return mixed a result handle or MDB_OK on success, a MDB error on failure
*/
function query($query, $types = NULL)
{
$this->debug("Query: {$query}");
$ismanip = MDB::isManip($query);
$this->last_query = $query;
$first = $this->first_selected_row;
$limit = $this->selected_row_limit;
$this->first_selected_row = $this->selected_row_limit = 0;
$result = $this->connect();
if (MDB::isError($result)) {
return $result;
}
if ($limit > 0) {
if (!$ismanip) {
$query = str_replace('SELECT', "SELECT TOP({$first},{$limit})", $query);
}
}
if ($this->database_name != '') {
if (!@fbsql_select_db($this->database_name, $this->connection)) {
return $this->fbsqlRaiseError();
}
}
// Add ; to the end of the query. This is required by FrontBase
$query .= ';';
if ($result = @fbsql_query($query, $this->connection)) {
if ($ismanip) {
$this->affected_rows = @fbsql_affected_rows($this->connection);
return MDB_OK;
} else {
$result_value = intval($result);
$this->highest_fetched_row[$result_value] = -1;
if ($types != NULL) {
if (!is_array($types)) {
$types = array($types);
}
if (MDB::isError($err = $this->setResultTypes($result, $types))) {
$this->freeResult($result);
return $err;
}
}
return $result;
}
}
return $this->fbsqlRaiseError();
}
示例5: _doQuery
/**
* Execute a query
* @param string $query the SQL query
* @return mixed result identifier if query executed, else MDB_error
* @access private
**/
function _doQuery($query, $first = 0, $limit = 0, $prepared_query = 0)
{
$connection = $this->auto_commit ? $this->connection : $this->transaction_id;
if ($prepared_query && isset($this->query_parameters[$prepared_query]) && count($this->query_parameters[$prepared_query]) > 2) {
$this->query_parameters[$prepared_query][0] = $connection;
$this->query_parameters[$prepared_query][1] = $query;
$result = @call_user_func_array("ibase_query", $this->query_parameters[$prepared_query]);
} else {
//Not Prepared Query
$result = @ibase_query($connection, $query);
while (@ibase_errmsg() == 'Query argument missed') {
//ibase_errcode() only available in PHP5
//connection lost, try again...
$this->connect();
//rollback the failed transaction to prevent deadlock and execute the query again
if ($this->transaction_id) {
$this->rollback();
}
$result = @ibase_query($this->connection, $query);
}
}
if ($result) {
if (!MDB::isManip($query)) {
$result_value = intval($result);
$this->current_row[$result_value] = -1;
if ($limit > 0) {
$this->limits[$result_value] = array($first, $limit, 0);
}
$this->highest_fetched_row[$result_value] = -1;
} else {
$this->affected_rows = -1;
}
} else {
return $this->raiseError(MDB_ERROR, NULL, NULL, '_doQuery: Could not execute query ("' . $query . '"): ' . @ibase_errmsg());
}
return $result;
}
示例6: query
/**
* Send a query to the database and return any results
*
* @param string $query the SQL query
* @param array $types array that contains the types of the columns in
* the result set
* @return mixed result identifier if query executed, else MDB_error
* @access public
**/
function query($query, $types = NULL)
{
$this->debug("Query: {$query}");
$ismanip = MDB::isManip($query);
$this->last_query = $query;
$first = $this->first_selected_row;
$limit = $this->selected_row_limit;
$this->first_selected_row = $this->selected_row_limit = 0;
$connected = $this->connect();
if (MDB::isError($connected)) {
return $connected;
}
if (!$ismanip && $limit > 0) {
if ($this->auto_commit && MDB::isError($this->_doQuery('BEGIN'))) {
return $this->raiseError(MDB_ERROR);
}
$result = $this->_doQuery('DECLARE select_cursor SCROLL CURSOR FOR ' . $query);
if (!MDB::isError($result)) {
if ($first > 0 && MDB::isError($result = $this->_doQuery("MOVE FORWARD {$first} FROM select_cursor"))) {
$this->freeResult($result);
return $result;
}
if (MDB::isError($result = $this->_doQuery("FETCH FORWARD {$limit} FROM select_cursor"))) {
$this->freeResult($result);
return $result;
}
} else {
return $result;
}
if ($this->auto_commit && MDB::isError($result2 = $this->_doQuery('END'))) {
$this->freeResult($result);
return $result2;
}
} else {
$result = $this->_doQuery($query);
if (MDB::isError($result)) {
return $result;
}
}
if ($ismanip) {
$this->affected_rows = @pg_cmdtuples($result);
return MDB_OK;
} elseif (preg_match('/^\\s*\\(?\\s*SELECT\\s+/si', $query) && !preg_match('/^\\s*\\(?\\s*SELECT\\s+INTO\\s/si', $query) || preg_match('/^\\s*EXPLAIN/si', $query)) {
/* PostgreSQL commands:
ABORT, ALTER, BEGIN, CLOSE, CLUSTER, COMMIT, COPY,
CREATE, DECLARE, DELETE, DROP TABLE, EXPLAIN, FETCH,
GRANT, INSERT, LISTEN, LOAD, LOCK, MOVE, NOTIFY, RESET,
REVOKE, ROLLBACK, SELECT, SELECT INTO, SET, SHOW,
UNLISTEN, UPDATE, VACUUM
*/
$result_value = intval($result);
$this->highest_fetched_row[$result_value] = -1;
if ($types != NULL) {
if (!is_array($types)) {
$types = array($types);
}
if (MDB::isError($err = $this->setResultTypes($result, $types))) {
$this->freeResult($result);
return $err;
}
}
return $result;
} else {
$this->affected_rows = 0;
return MDB_OK;
}
return $this->raiseError(MDB_ERROR);
}