本文整理汇总了PHP中sqlite_last_error函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_last_error函数的具体用法?PHP sqlite_last_error怎么用?PHP sqlite_last_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite_last_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _catch
function _catch($msg = "")
{
if (!($this->error = sqlite_error_string(sqlite_last_error($this->conn)))) {
return true;
}
$this->error($msg . "<br>{$this->query}\n {$this->error}");
}
示例2: _set_stmt_error
protected function _set_stmt_error($state = null, $mode = PDO::ERRMODE_SILENT, $func = '')
{
$errno = sqlite_last_error($this->_link);
if ($state === null) {
$state = 'HY000';
}
$this->_set_error($errno, sqlite_error_string($errno), $state, $mode, $func);
}
示例3: real_execute_sql
public function real_execute_sql($sql)
{
$result_set_handle = sqlite_query($this->connection_handle, $sql);
if (!$result_set_handle) {
throw new AnewtDatabaseQueryException('SQLite error: %s', sqlite_error_string(sqlite_last_error($this->connection_handle)));
}
return new AnewtDatabaseResultSetSQLite($sql, $this->connection_handle, $result_set_handle);
}
示例4: SqliteResultSet
/**
* Constructs a new SqliteResultSet
*
* \param $sql
* The sql query to execute.
*
* \param $backend
* A reference to the used backend.
*/
function SqliteResultSet($sql, &$backend)
{
assert('is_string($sql)');
$this->sql = $sql;
$this->backend =& $backend;
$this->rs = sqlite_query($this->backend->handle, $sql) or trigger_error(sprintf('Query failed (%s)', sqlite_error_string(sqlite_last_error($this->backend->handle))), E_USER_ERROR);
$this->rows_affected = sqlite_changes($this->backend->handle);
}
示例5: _error_handler
function _error_handler(array $errarray, $query = '')
{
$err = sprintf('%s on line %d.', $errarray[0], $errarray[1]);
$errno = sqlite_last_error($this->con);
if (defined('DEBUG') && DEBUG) {
$err .= sprintf(PHP_EOL . "Description: #%d: %s" . PHP_EOL . "SQL: %s", $errno, sqlite_error_string($errno), $query);
}
throw new RuntimeException($err, $errno);
}
示例6: query
/**
* query
*
* @param mixed $query
* @access public
* @return mixed
* @throws AdapterException
*/
public function query($query)
{
$handle = @sqlite_query($query, $this->_dbHandle);
if (!$handle) {
$errorCode = sqlite_last_error($this->_dbHandle);
throw new AdapterException(sqlite_error_string($errorCode), $errorCode);
}
return $handle;
}
示例7: query
public function query($sql)
{
LogMaster::log($sql);
$res = sqlite_query($this->connection, $sql);
if ($res === false) {
throw new Exception("SQLLite - sql execution failed\n" . sqlite_error_string(sqlite_last_error($this->connection)));
}
return $res;
}
示例8: query
/**
* 执行数据库查询
*
* @param string $query
* @param mixed $handle
* @param int $op
* @param null $action
* @return resource|SQLiteResult
* @throws Typecho_Db_Query_Exception
*/
public function query($query, $handle, $op = Typecho_Db::READ, $action = NULL)
{
if ($resource = @sqlite_query($query instanceof Typecho_Db_Query ? $query->__toString() : $query, $handle)) {
return $resource;
}
/** 数据库异常 */
$errorCode = sqlite_last_error($this->_dbHandle);
throw new Typecho_Db_Query_Exception(sqlite_error_string($errorCode), $errorCode);
}
示例9: __construct
/**
* This function initializes the class.
*
* @access public
* @override
* @param DB_Connection_Driver $connection the connection to be used
* @param string $sql the SQL statement to be queried
* @param integer $mode the execution mode to be used
* @throws Throwable_SQL_Exception indicates that the query failed
*/
public function __construct(DB_Connection_Driver $connection, $sql, $mode = NULL)
{
$resource = $connection->get_resource();
$command = @sqlite_query($resource, $sql);
if ($command === FALSE) {
throw new Throwable_SQL_Exception('Message: Failed to query SQL statement. Reason: :reason', array(':reason' => sqlite_error_string(sqlite_last_error($resource))));
}
$this->command = $command;
$this->record = FALSE;
}
示例10: safe_query
function safe_query($query)
{
$res = sqlite_query($query, sqlite_r);
if (!$res) {
$err_code = sqlite_last_error(sqlite_r);
printf("Query Failed %d:%s\n", $err_code, sqlite_error_string($err_code));
exit;
}
return $res;
}
示例11: query
function query($sql)
{
global $page;
if (!($this->result = sqlite_query($this->dbres, $sql))) {
print "Query failed, <span style=\"color: blue;\"><pre>{$sql}</pre></style>\n";
print sqlite_error_string(sqlite_last_error($this->dbres));
$page->footer();
exit;
}
}
示例12: DriverSqliteExec
function DriverSqliteExec($conn, $sql, $check_result = true)
{
if ($check_result) {
if (!($result = sqlite_query($conn, $sql))) {
throw new lmbDbException('SQLite error happened: ' . sqlite_error_string(sqlite_last_error($conn)));
}
} else {
$result = @sqlite_query($conn, $sql);
}
return $result;
}
示例13: error
public function error($status = '')
{
$error = sqlite_last_error($this->connection);
if ($status = 'show') {
return sqlite_error_string($error);
} elseif ($error != 0) {
return true;
} else {
return false;
}
}
示例14: getError
function getError($errorCode = null)
{
if (!$this->error) {
$this->error = sqlite_last_error($this->connId);
}
if ($errorCode == null) {
$errorCode = $this->error;
}
$this->errorMessage = sqlite_error_string($errorCode);
return $this->errorMessage;
}
示例15: initTables
/**
* @throws SQLException
* @return void
*/
protected function initTables()
{
include_once 'creole/drivers/sqlite/metadata/SQLiteTableInfo.php';
$sql = "SELECT name FROM sqlite_master WHERE type='table' UNION ALL SELECT name FROM sqlite_temp_master WHERE type='table' ORDER BY name;";
$result = sqlite_query($this->dblink, $sql);
if (!$result) {
throw new SQLException("Could not list tables", sqlite_last_error($this->dblink));
}
while ($row = sqlite_fetch_array($result)) {
$this->tables[strtoupper($row[0])] = new SQLiteTableInfo($this, $row[0]);
}
}