本文整理汇总了PHP中MDB2::isManip方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB2::isManip方法的具体用法?PHP MDB2::isManip怎么用?PHP MDB2::isManip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB2
的用法示例。
在下文中一共展示了MDB2::isManip方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Send a query to the database and return any results
*
* @param string $query the SQL query
* @param mixed $types array that contains the types of the columns in
* the result set
* @param mixed $result_class string which specifies which result class to use
* @param mixed $result_wrap_class string which specifies which class to wrap results in
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &query($query, $types = null, $result_class = true, $result_wrap_class = false)
{
$isManip = MDB2::isManip($query);
$offset = $this->row_offset;
$limit = $this->row_limit;
$this->row_offset = $this->row_limit = 0;
$query = $this->_modifyQuery($query, $isManip, $limit, $offset);
$connected = $this->connect();
if (PEAR::isError($connected)) {
return $connected;
}
$result = $this->_doQuery($query, $isManip, $this->connection, $this->database_name);
if (PEAR::isError($result)) {
return $result;
}
if ($isManip) {
return $result;
}
return $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset);
}
示例2: isManip
function isManip($query)
{
return MDB2::isManip($query);
}
示例3: isset
/**
* Send a query to the database and return any results
*
* @param string $query the SQL query
* @param mixed $types string or array that contains the types of the
* columns in the result set
* @param mixed $result_class string which specifies which result class to use
* @param mixed $result_wrap_class string which specifies which class to wrap results in
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
*
* @access public
*/
function &query($query, $types = null, $result_class = false, $result_wrap_class = false)
{
$ismanip = MDB2::isManip($query);
$offset = $this->row_offset;
$limit = $this->row_limit;
$this->row_offset = $this->row_limit = 0;
if ($limit > 0) {
if ($ismanip) {
$query .= " LIMIT {$limit}";
} else {
$query .= " LIMIT {$limit} OFFSET {$offset}";
}
}
if ($this->options['portability'] & MDB2_PORTABILITY_DELETE_COUNT) {
$query = $this->_modifyQuery($query);
}
$this->last_query = $query;
$this->debug($query, 'query');
$connected = $this->connect();
if (MDB2::isError($connected)) {
return $connected;
}
$function = $this->options['result_buffering'] ? 'sqlite_query' : 'sqlite_unbuffered_query';
ini_set('track_errors', true);
$result = @$function($query . ';', $this->connection);
ini_restore('track_errors');
$this->_lasterror = isset($php_errormsg) ? $php_errormsg : '';
if ($result) {
if ($ismanip) {
return MDB2_OK;
} else {
if (!$result_class) {
$result_class = $this->options['result_buffering'] ? $this->options['buffered_result_class'] : $this->options['result_class'];
}
$class_name = sprintf($result_class, $this->phptype);
$result =& new $class_name($this, $result);
if ($types) {
$err = $result->setResultTypes($types);
if (MDB2::isError($err)) {
$result->free();
return $err;
}
}
if (!$result_wrap_class) {
$result_wrap_class = $this->options['result_wrap_class'];
}
if ($result_wrap_class) {
$result =& new $result_wrap_class($result);
}
return $result;
}
}
$error =& $this->raiseError();
return $error;
}
示例4: sprintf
/**
* Send a query to the database and return any results
*
* @param string $query the SQL query
* @param mixed $types array that contains the types of the columns in
* the result set
* @param mixed $result_class string which specifies which result class to use
* @param mixed $result_wrap_class string which specifies which class to wrap results in
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
*
* @access public
*/
function &query($query, $types = null, $result_class = false, $result_wrap_class = false)
{
$ismanip = MDB2::isManip($query);
$offset = $this->row_offset;
$limit = $this->row_limit;
$this->row_offset = $this->row_limit = 0;
if ($limit > 0) {
$fetch = $offset + $limit;
if (!$ismanip) {
$query = str_replace('SELECT', "SELECT TOP {$fetch}", $query);
}
}
$this->last_query = $query;
$this->debug($query, 'query');
$connected = $this->connect();
if (MDB2::isError($connected)) {
return $connected;
}
if ($this->database_name) {
if (!@mssql_select_db($this->database_name, $this->connection)) {
$error =& $this->raiseError();
return $error;
}
$this->connected_database_name = $this->database_name;
}
if ($result = $this->_doQuery($query)) {
if ($ismanip) {
return MDB2_OK;
} else {
if (!$result_class) {
$result_class = $this->options['result_buffering'] ? $this->options['buffered_result_class'] : $this->options['result_class'];
}
$class_name = sprintf($result_class, $this->phptype);
$result =& new $class_name($this, $result, $offset, $limit);
if ($types) {
$err = $result->setResultTypes($types);
if (MDB2::isError($err)) {
$result->free();
return $err;
}
}
if (!$result_wrap_class) {
$result_wrap_class = $this->options['result_wrap_class'];
}
if ($result_wrap_class) {
$result =& new $result_wrap_class($result);
}
return $result;
}
}
$error =& $this->raiseError();
return $error;
}
示例5: sprintf
/**
* Execute a prepared query statement.
*
* @param int $prepared_query argument is a handle that was returned by
* the function prepare()
* @param string $query query to be executed
* @param array $types array that contains the types of the columns in the result set
* @param mixed $result_class string which specifies which result class to use
* @param mixed $result_wrap_class string which specifies which class to wrap results in
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
*
* @access private
*/
function &_executePrepared($prepared_query, $query, $types = null, $result_class = false, $result_wrap_class = false)
{
$ismanip = MDB2::isManip($query);
$offset = $this->row_offset;
$limit = $this->row_limit;
$this->row_offset = $this->row_limit = 0;
$query = $this->_modifyQuery($query);
$this->last_query = $query;
$this->debug($query, 'query');
$connected = $this->connect();
if (MDB2::isError($connected)) {
return $connected;
}
$result = $this->_doQuery($query, $ismanip, $prepared_query);
if (!MDB2::isError($result)) {
if ($ismanip) {
return MDB2_OK;
} else {
if (!$result_class) {
$result_class = $this->options['result_buffering'] ? $this->options['buffered_result_class'] : $this->options['result_class'];
}
$class_name = sprintf($result_class, $this->phptype);
$result =& new $class_name($this, $result, $offset, $limit);
if ($types) {
$err = $result->setResultTypes($types);
if (MDB2::isError($err)) {
$result->free();
return $err;
}
}
if (!$result_wrap_class) {
$result_wrap_class = $this->options['result_wrap_class'];
}
if ($result_wrap_class) {
$result =& new $result_wrap_class($result);
}
return $result;
}
}
return $result;
}
示例6: elseif
/**
* 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
* @param mixed $result_class string which specifies which result class to use
* @param mixed $result_wrap_class string which specifies which class to wrap results in
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
*
* @access public
*/
function &query($query, $types = null, $result_class = false, $result_wrap_class = false)
{
$ismanip = MDB2::isManip($query);
$offset = $this->row_offset;
$limit = $this->row_limit;
$this->row_offset = $this->row_limit = 0;
$this->last_query = $query;
$this->debug($query, 'query');
$connected = $this->connect();
if (MDB2::isError($connected)) {
return $connected;
}
if (!$ismanip && $limit > 0) {
if ($this->auto_commit && MDB2::isError($result = $this->_doQuery('BEGIN'))) {
return $result;
}
$result = $this->_doQuery('DECLARE select_cursor SCROLL CURSOR FOR ' . $query);
if (!MDB2::isError($result)) {
if ($offset > 0 && MDB2::isError($result = $this->_doQuery("MOVE FORWARD {$offset} FROM select_cursor"))) {
@pg_free_result($result);
return $result;
}
$result = $this->_doQuery("FETCH FORWARD {$limit} FROM select_cursor");
if (MDB2::isError($result)) {
@pg_free_result($result);
return $result;
}
} else {
return $result;
}
if ($this->auto_commit && MDB2::isError($result2 = $this->_doQuery('END'))) {
@pg_free_result($result);
return $result2;
}
} else {
$result = $this->_doQuery($query);
if (MDB2::isError($result)) {
return $result;
}
}
if (!MDB2::isError($result)) {
if ($ismanip) {
$this->affected_rows = @pg_cmdtuples($result);
return MDB2_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)) {
if (!$result_class) {
$result_class = $this->options['result_buffering'] ? $this->options['buffered_result_class'] : $this->options['result_class'];
}
$class_name = sprintf($result_class, $this->phptype);
$result =& new $class_name($this, $result);
if ($types) {
$err = $result->setResultTypes($types);
if (MDB2::isError($err)) {
$result->free();
return $err;
}
}
if (!$result_wrap_class) {
$result_wrap_class = $this->options['result_wrap_class'];
}
if ($result_wrap_class) {
$result =& new $result_wrap_class($result);
}
return $result;
} else {
$this->affected_rows = 0;
return MDB2_OK;
}
}
return $result;
}
示例7: sprintf
/**
* Send a query to the database and return any results
*
* @param string $query the SQL query
* @param mixed $types string or array that contains the types of the
* columns in the result set
* @param mixed $result_class string which specifies which result class to use
* @param mixed $result_wrap_class string which specifies which class to wrap results in
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
*
* @access public
*/
function &query($query, $types = null, $result_class = false, $result_wrap_class = false)
{
$ismanip = MDB2::isManip($query);
$offset = $this->row_offset;
$limit = $this->row_limit;
$this->row_offset = $this->row_limit = 0;
if ($limit > 0) {
if ($ismanip) {
$query .= " LIMIT {$limit}";
} else {
$query .= " LIMIT {$offset},{$limit}";
}
}
if ($this->options['portability'] & MDB2_PORTABILITY_DELETE_COUNT) {
$query = $this->_modifyQuery($query);
}
$this->last_query = $query;
$this->debug($query, 'query');
$connected = $this->connect();
if (MDB2::isError($connected)) {
return $connected;
}
if ($this->database_name && $this->database_name != $this->connected_database_name) {
if (!@mysql_select_db($this->database_name, $this->connection)) {
$error =& $this->raiseError();
return $error;
}
$this->connected_database_name = $this->database_name;
}
$function = $this->options['result_buffering'] ? 'mysql_query' : 'mysql_unbuffered_query';
if ($result = @$function($query, $this->connection)) {
if ($ismanip) {
return MDB2_OK;
} else {
if (!$result_class) {
$result_class = $this->options['result_buffering'] ? $this->options['buffered_result_class'] : $this->options['result_class'];
}
$class_name = sprintf($result_class, $this->phptype);
$result =& new $class_name($this, $result);
if ($types) {
$err = $result->setResultTypes($types);
if (MDB2::isError($err)) {
$result->free();
return $err;
}
}
if (!$result_wrap_class) {
$result_wrap_class = $this->options['result_wrap_class'];
}
if ($result_wrap_class) {
$result =& new $result_wrap_class($result);
}
return $result;
}
}
$error =& $this->raiseError();
return $error;
}