当前位置: 首页>>代码示例>>PHP>>正文


PHP SQLite3::lastErrorMsg方法代码示例

本文整理汇总了PHP中SQLite3::lastErrorMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLite3::lastErrorMsg方法的具体用法?PHP SQLite3::lastErrorMsg怎么用?PHP SQLite3::lastErrorMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLite3的用法示例。


在下文中一共展示了SQLite3::lastErrorMsg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * The primary method a driver needs to implement is the execute method, which takes an array of query options.
  * The options in the array varies, but the key type will always be supplied, which will be either SELECT, UPDATE,
  * INSERT, REPLACE or DELETE.
  *
  * @param array $options An array of options that were generated through use of the Query class.
  * @return object It is expected to return an instance of an \Queryer\Driver\DatabaseDriverResult class.
  * @see \Queryer\Query, \Queryer\Driver\DatabaseDriverResult
  */
 public function execute(array $options)
 {
     $query = self::generateQuery($options);
     $query = DatabaseTools::replaceVariables($query, $options['variables']);
     $result = $this->sqlite->query($query);
     return new Sqlite3DriverResult($result, $this->sqlite->changes(), $this->sqlite->lastInsertRowID(), $result === false ? $this->sqlite->lastErrorCode() : null, $result === false ? $this->sqlite->lastErrorMsg() : null, $query);
 }
开发者ID:ianaldrighetti,项目名称:queryer,代码行数:16,代码来源:Sqlite3Driver.php

示例2: executeQuery

 /**
  * {@inheritdoc}
  */
 protected function executeQuery($query, array $parameters)
 {
     if (isset($this->statements[$query])) {
         $statement = $this->statements[$query];
     } else {
         // Temporary set the error reporting level to 0 to avoid any warning.
         $errorReportingLevel = error_reporting(0);
         $statement = $this->sqlite3->prepare($query);
         // Restore the original error reporting level.
         error_reporting($errorReportingLevel);
         $errorCode = $this->sqlite3->lastErrorCode();
         if ($errorCode !== 0) {
             $exception = new SQLite3Exception($this->sqlite3->lastErrorMsg(), $errorCode);
             if ($errorCode === 1) {
                 // SQL error cause by a missing function, this must be reported with a GeometryEngineException.
                 throw GeometryEngineException::operationNotSupportedByEngine($exception);
             } else {
                 // Other SQLite3 error; we cannot trigger the original E_WARNING, so we throw this exception instead.
                 throw $exception;
             }
         } else {
             $this->statements[$query] = $statement;
         }
     }
     $index = 1;
     foreach ($parameters as $parameter) {
         if ($parameter instanceof Geometry) {
             if ($parameter->isEmpty()) {
                 $statement->bindValue($index++, $parameter->asText(), SQLITE3_TEXT);
                 $statement->bindValue($index++, $parameter->SRID(), SQLITE3_INTEGER);
             } else {
                 $statement->bindValue($index++, $parameter->asBinary(), SQLITE3_BLOB);
                 $statement->bindValue($index++, $parameter->SRID(), SQLITE3_INTEGER);
             }
         } else {
             if ($parameter === null) {
                 $type = SQLITE3_NULL;
             } elseif (is_int($parameter)) {
                 $type = SQLITE3_INTEGER;
             } elseif (is_float($parameter)) {
                 $type = SQLITE3_FLOAT;
             } else {
                 $type = SQLITE3_TEXT;
             }
             $statement->bindValue($index++, $parameter, $type);
         }
     }
     $result = $statement->execute();
     return $result->fetchArray(SQLITE3_NUM);
 }
开发者ID:brick,项目名称:geo,代码行数:53,代码来源:SQLite3Engine.php

示例3: __construct

 /**
  * @param string          $dbname database name
  * @param OutputInterface $output standard verbode output
  * @param boolean         $renew  if true delete and recreate database
  *
  * @throws \Exception
  */
 public function __construct($dbname, OutputInterface $output, $renew = false)
 {
     $this->fs = new Filesystem();
     $this->output = $output;
     $this->dbname = $dbname;
     if ($renew) {
         if ($this->fs->exists($this->dbname)) {
             $this->fs->remove($this->dbname);
         }
     }
     $this->db = new \SQLite3($this->dbname);
     if ($this->db->exec('PRAGMA encoding = "UTF-8";') === false) {
         $this->output->writeln($this->db->lastErrorCode() . " : " . $this->db->lastErrorMsg());
         throw new \Exception("cannot set encoding UTF-8");
     }
 }
开发者ID:emmanuelroecker,项目名称:js-php-real-time-search,代码行数:23,代码来源:GlServerEngine.php

示例4: error

 /**
  * Returns the error string.
  *
  * @return string
  */
 public function error()
 {
     if (0 === $this->conn->lastErrorCode()) {
         return '';
     }
     return $this->conn->lastErrorMsg();
 }
开发者ID:atlcurling,项目名称:tkt,代码行数:12,代码来源:Sqlite3.php

示例5: open

 /**
  * open database, on failure send message tot syslog
  * creates structure needed for this captiveportal zone
  * @return SQLite3
  */
 public function open()
 {
     // open database
     $db_path = "/var/db/captiveportal{$this->zone}.db";
     try {
         $this->handle = new Sqlite(array("dbname" => $db_path));
         $sql = array();
         // create structure on new database
         $sql[] = "CREATE TABLE IF NOT EXISTS captiveportal (" . "allow_time INTEGER, pipeno_in INTEGER, pipeno_out INTEGER, ip TEXT, mac TEXT, username TEXT, " . "sessionid TEXT, bpassword TEXT, session_timeout INTEGER, idle_timeout INTEGER, " . "session_terminate_time INTEGER, interim_interval INTEGER, radiusctx TEXT)";
         $sql[] = "CREATE UNIQUE INDEX IF NOT EXISTS idx_active ON captiveportal (sessionid, username)";
         $sql[] = "CREATE INDEX IF NOT EXISTS user ON captiveportal (username)";
         $sql[] = "CREATE INDEX IF NOT EXISTS ip ON captiveportal (ip)";
         $sql[] = "CREATE INDEX IF NOT EXISTS starttime ON captiveportal (allow_time)";
         $sql[] = "CREATE TABLE IF NOT EXISTS captiveportal_mac (" . "mac TEXT, ip TEXT,pipeno_in INTEGER, pipeno_out INTEGER, last_checked INTEGER )";
         $sql[] = "CREATE UNIQUE INDEX IF NOT EXISTS idx_mac ON captiveportal_mac (mac)";
         $sql[] = "CREATE TABLE IF NOT EXISTS captiveportal_ip (" . "ip TEXT,pipeno_in INTEGER, pipeno_out INTEGER, last_checked INTEGER )";
         $sql[] = "CREATE UNIQUE INDEX IF NOT EXISTS idx_ip ON captiveportal_ip (ip)";
         foreach ($sql as $cmd) {
             if (!$this->handle->execute($cmd)) {
                 $logger = new Syslog("logportalauth", array('option' => LOG_PID, 'facility' => LOG_LOCAL4));
                 $msg = "Error during table {$this->zone} creation. Error message: {$this->handle->lastErrorMsg()}";
                 $logger->error($msg);
                 $this->handle = null;
                 break;
             }
         }
     } catch (\Exception $e) {
         $logger = new Syslog("logportalauth", array('option' => LOG_PID, 'facility' => LOG_LOCAL4));
         $logger->error("Error opening database for zone " . $this->zone . " : " . $e->getMessage() . " ");
         $this->handle = null;
     }
     return $this->handle;
 }
开发者ID:nasaa0528,项目名称:core,代码行数:38,代码来源:DB.php

示例6: anubisFILE

function anubisFILE($idmd5, $fileName)
{
    #Execute the Python Script
    #python /var/www/anubis/submit_to_anubis.py /var/www/mastiff/MD5/filename.VIR
    $command = 'python /var/www/anubis/submit_to_anubis.py -u ' . $anubisUser . ' -p ' . $anubisPass . ' "/var/www/mastiff/' . $idmd5 . '/' . $fileName . '"';
    $output = shell_exec($command);
    $anubisRes['out'] = $output;
    $pattern = '/https?\\:\\/\\/[^\\" ]+/i';
    preg_match($pattern, $output, $matches);
    #echo '<pre>';
    #	echo '$matches: ';
    #	var_dump($matches);
    #echo '</pre>';
    $anubisLink = $matches[0];
    $anubisLink = strstr($anubisLink, "\n", true);
    $anubisRes['link'] = $anubisLink;
    #Update the Database
    $db = new SQLite3('../mastiff/mastiff.db');
    $result = $db->exec('UPDATE mastiff SET anubis = "' . $anubisLink . '" WHERE md5 = "' . $idmd5 . '"');
    if (!$result) {
        $anubisRes['db'] = $db->lastErrorMsg();
    } else {
        $anubisRes['db'] = $db->changes() . ' Record updated successfully.';
    }
    return $anubisRes;
}
开发者ID:bhargavz,项目名称:WIPSTER,代码行数:26,代码来源:anubis.php

示例7: check_links

function check_links()
{
    //Before checking anything, check if laurentian.concat.ca is resolving.
    $catalogue_link = fopen("http://laurentian.concat.ca/", "r");
    if (!$catalogue_link) {
        die("There may be a problem with laurentian.concat.ca so this process is going to halt. If this persists, contact Kevin Beswick");
    }
    fclose($catalogue_link);
    //Check all links from database, if active, leave alone, if not active, delete them.
    $db_session = new SQLite3('reserves.db');
    $query = "SELECT bookbag_id from reserve";
    $results = $db_session->query($query) or die($db_session->lastErrorMsg());
    $begin_link = "http://laurentian.concat.ca/opac/extras/feed/bookbag/opac/";
    $end_link = "?skin=lul";
    $count = 0;
    while ($row = $results->fetchArray()) {
        $file = fopen($begin_link . $row["bookbag_id"] . $end_link, "r");
        if (!$file) {
            //remove from list
            $query = "DELETE from reserve where bookbag_id = " . $row["bookbag_id"];
            $db_session->exec($query) or die("not working... " . $db_session->lastErrorMsg());
            $count++;
        }
        fclose($file);
    }
    echo "Done removing dead links... " . $count . " were removed.";
}
开发者ID:kbeswick,项目名称:library,代码行数:27,代码来源:admin.php

示例8: error

 /**
  * Return the last MySQL error
  */
 function error()
 {
     if ($this->sqlite === null) {
         return null;
     }
     return $this->sqlite->lastErrorMsg();
 }
开发者ID:splitice,项目名称:radical-db,代码行数:10,代码来源:SQLiteConnection.php

示例9: testError

 /**
  * Test if a error exist, if yes than throw error
  *
  * @throws CHOQ_Exception
  * @param string $query
  */
 public function testError($query = null)
 {
     if ($this->sqlite->lastErrorCode()) {
         $error = $this->sqlite->lastErrorMsg();
         if ($query) {
             $error .= "\nSQL Query: {$query}";
         }
         error($error);
     }
 }
开发者ID:nonconforme,项目名称:nreeda,代码行数:16,代码来源:Sqlite3.class.php

示例10: execute

 function execute($query)
 {
     if (!$this->isConnected()) {
         throw new NotConnectedException();
     }
     Connection::startMeasuring($this);
     if (func_num_args() > 1) {
         $query = call_user_func_array('sprintf', func_get_args());
     }
     $result = $this->connection->query($query);
     Connection::endMeasuring($this);
     if (!$result) {
         throw new QueryException($this->connection->lastErrorMsg(), $this->connection->lastErrorCode());
     }
     if ($result instanceof \SQLite3Result) {
         return new RecordSet($result);
     }
     return $result;
 }
开发者ID:maniaplanet,项目名称:manialive-lib,代码行数:19,代码来源:Connection.php

示例11: db_connect

function db_connect() 
{
    global $dbname;
	$conn = new SQLite3($dbname);
	if (!$conn) 
	{
	  trigger_error($conn->lastErrorMsg(), E_USER_ERROR);
	}
	return $conn;
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:10,代码来源:dbconnection.sqlite3.php

示例12: getSettings

 function getSettings()
 {
     $db = new SQLite3('/var/www/admin/admin.db');
     $result = $db->query('SELECT * FROM admin WHERE id = 1');
     if (isset($result)) {
         while ($res = $result->fetchArray()) {
             #$_SESSION['size']=$res['size'];
             #$malwrRes['uuid']=$res['uuid'];
             $settingRes = array();
             $settingRes = $res;
             /*	remver
              * 	mastiffconf
              * 	mastiffpy
              * 	tridloc
              * 	malwrPlugin
              * 	malwrAPI
              *  critsPlugin
              *  critsPage
              *  critsLogin
              * 	threatanalyzerplugin
              * 	threatapi
              * 	threatbase
              * 	threatpage
              * 	threatargs
              * 	tasubpriority
              * 	tasubsandbox
              * 	tasubreanalyze
              * 	anubisuser
              * 	anubispass
              * 	wotapi
              * 	vtapi
              * 	googapi
              * 	gcsekey
              * 	gcsesig
              * 	gcsecx
              * 	gcsequery
              * 	autopbua
              * 	twitterapi
              * 	twittertoken
              * 	twitterquery
              * 	twitterconsec
              * 	twitteroauthsec
              */
         }
     }
     if (!$result) {
         $settingRes['db'] = $db->lastErrorMsg();
     } else {
         $settingRes['db'] = $db->changes() . ' Record updated successfully.';
     }
     $db->close();
     return $settingRes;
 }
开发者ID:bhargavz,项目名称:WIPSTER,代码行数:53,代码来源:config.php

示例13: checkError

 /**
  * Checks the last error code and decide if and what kind of exception to throw.
  * @return true if nothing is wrong
  * @throws CoreXEngine\Cache\AccessException if we want to write a read-only file
  * @throws CoreXEngine\Cache\Exception for no special typed problem
  */
 protected function checkError()
 {
     switch ($code = $this->database->lastErrorCode()) {
         case 8:
             throw new AccessException($this->database->lastErrorMsg(), $this->database->lastErrorCode());
             break;
         default:
             if (0 < $code) {
                 throw new Exception($this->database->lastErrorMsg(), $this->database->lastErrorCode());
             }
     }
     return true;
 }
开发者ID:anthraxx,项目名称:CoreXEngine,代码行数:19,代码来源:SQLite.php

示例14: do_query

function do_query($query)
{
    global $db_hostname, $db_user, $db_pass, $db_db, $db_type;
    /* Connecting, selecting database */
    if ($db_type == "mysql") {
        $link = new mysqli($db_hostname, $db_user, $db_pass, $db_db) or die("Error " . mysqli_error($link));
        $result = $link->query($query) or die("Error in the query: " . mysqli_error($link));
        /* Closing connection */
        mysqli_close($link);
    } elseif ($db_type == "sqlite") {
        $link = new SQLite3($db_hostname) or die("Error " . $link->lastErrorMsg());
        $result = $link->query($query) or die("Error in the query: " . $link->lastErrorMsg() . " - Query: " . $query);
        /* Closing connection */
        $link->close;
    } else {
        $link = pg_connect("host={$db_hostname} dbname={$db_db} user={$db_user} password={$db_pass}") or die("Could not connect to database");
        $result = pg_query($link, $query) or die("Query failed");
        /* Closing connection */
        pg_close($link);
    }
    return $result;
}
开发者ID:kupschke,项目名称:sgwi,代码行数:22,代码来源:functions.inc.php

示例15: getUserPrivilege

function getUserPrivilege($login)
{
    $db = new SQLite3("db/db.sqlite3");
    if (!$db) {
        echo $db->lastErrorMsg();
        return false;
    }
    $sql = "SELECT login,privilege FROM users WHERE login = \"{$login}\"";
    $ret = $db->query($sql);
    while ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
        $privilege = $row["privilege"];
    }
    return $privilege;
}
开发者ID:atchyutn,项目名称:Appointment,代码行数:14,代码来源:loginFunctions.php


注:本文中的SQLite3::lastErrorMsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。