本文整理汇总了PHP中SQLite3::changes方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLite3::changes方法的具体用法?PHP SQLite3::changes怎么用?PHP SQLite3::changes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite3
的用法示例。
在下文中一共展示了SQLite3::changes方法的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);
}
示例2: updateFromLocal
/**
* Update compare database with data from local storage
*
* @param Core_FsObject $fsObject file system object
*
* @return void
*/
public function updateFromLocal($fsObject)
{
if (false === $fsObject->md5) {
$prep1 = $this->_prepFromLocal1;
$prep2 = $this->_prepFromLocal2;
} else {
$prep1 = $this->_prepFromLocalFull1;
$prep1->bindValue(":md5", $fsObject->md5);
$prep2 = $this->_prepFromLocalFull2;
$prep2->bindValue(":md5", $fsObject->md5);
}
$prep1->bindValue(":isDir", $fsObject->isDir);
$prep1->bindValue(":path", $fsObject->path);
$prep1->bindValue(":isLocal", 1);
$prep1->bindValue(":size", $fsObject->size);
$prep1->bindValue(":time", $fsObject->time);
$prep1->execute();
if ($this->_db->changes() == 0) {
// record doesn't exists
$prep2->bindValue(":isDir", $fsObject->isDir);
$prep2->bindValue(":path", $fsObject->path);
$prep2->bindValue(":isLocal", 1);
$prep2->bindValue(":size", $fsObject->size);
$prep2->bindValue(":time", $fsObject->time);
$prep2->execute();
}
}
示例3: _gc
public function _gc($maxlifetime) {
$stmt=parent::prepare("delete
from http_sessions
where datetime())-strftime('%s',alive)>:lifetime");
$stmt->bindValue(':lifetime', ini_get('session.gc_maxlifetime'), SQLITE3_INTEGER);
$stmt->execute();
return parent::changes();}
示例4: 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;
}
示例5: 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;
}
示例6: query
public function query($sql)
{
$this->last_query = $sql;
switch (strtoupper(substr($sql, 0, strpos($sql, ' ')))) {
case 'SELECT':
$SQLite3Result = parent::query($sql);
$rs = [];
while ($row = $SQLite3Result->fetchArray(SQLITE3_ASSOC)) {
$rs[] = (object) $row;
}
return $rs;
break;
case 'INSERT':
parent::query($sql);
return $this->lastInsertRowID();
break;
case 'DELETE':
case 'UPDATE':
parent::exec($sql);
return parent::changes();
break;
}
return FALSE;
}
示例7: sumlen_step
}
function sumlen_step($a, $b, $c)
{
return (int) $a + strlen($c);
}
function sumlen_fini($a)
{
return (int) $a;
}
$db = new SQLite3(':memory:test');
$db->exec("DROP TABLE IF EXISTS foo");
$db->exec("CREATE TABLE foo (bar STRING)");
$db->exec("INSERT INTO foo VALUES ('ABC')");
$db->exec("INSERT INTO foo VALUES ('DEF')");
VS($db->lastinsertrowid(), 2);
VS($db->changes(), 1);
VS($db->lasterrorcode(), 0);
VS($db->lasterrormsg(), "not an error");
VS($db->escapestring("'\""), "''\"");
VS($db->querysingle("SELECT * FROM foo"), "ABC");
VS($db->querysingle("SELECT * FROM foo", true), array("bar" => "ABC"));
$res = $db->query("SELECT * FROM foo");
VS($res->fetcharray(), array(0 => "ABC", "bar" => "ABC"));
VS($res->numcolumns(), 1);
VS($res->columnname(0), "bar");
VS($res->columntype(0), SQLITE3_TEXT);
VS($res->fetcharray(SQLITE3_NUM), array("DEF"));
$stmt = $db->prepare("SELECT * FROM foo WHERE bar = :id");
VS($stmt->paramcount(), 1);
$id = "DEF";
VERIFY($stmt->bindvalue(":id", $id, SQLITE3_TEXT));
示例8: delete
/**
* Deletes a particular message from the specified catalogue.
*
* @param string $message the source message to delete.
* @param string $catalogue the catalogue to delete from.
* @return boolean true if deleted, false otherwise.
*/
function delete($message, $catalogue = 'messages')
{
$details = $this->getCatalogueDetails($catalogue);
if ($details) {
list($cat_id, $variant, $count) = $details;
} else {
return false;
}
$db = new SQLite3($this->source, SQLITE3_OPEN_READWRITE);
$text = $db->escapeString($message);
$db->exec("DELETE FROM trans_unit WHERE cat_id = {$cat_id} AND source = '{$message}'");
if ($db->changes()) {
$this->updateCatalogueTime($cat_id, $variant);
$deleted = true;
} else {
$deleted = false;
}
$db->close();
return $deleted;
}
示例9: exec
/**
* 执行
* @param $query
* @return mixed
*/
public function exec($query)
{
$this->debug($query);
$this->_sqlite->exec($query);
return $this->_sqlite->changes();
}
示例10: affectedRows
function affectedRows()
{
return $this->connection->changes();
}
示例11: IN
<?php
include "SubVideo.php";
$db1 = new SQLite3('videoworld.sqlite');
$db2 = new SQLite3('MyVideos105.db');
$res2 = $db2->query('SELECT c09 FROM movie');
$updates = '';
while ($row2 = $res2->fetchArray(SQLITE3_ASSOC)) {
if (!empty($row2['c09'])) {
$db1->exec('UPDATE movies SET status=2 WHERE status<>2 AND imdb_id="' . $row2['c09'] . '"');
if ($db1->changes()) {
if (empty($updates)) {
$updates = '"' . $row2['c09'] . '"';
} else {
$updates .= ',"' . $row2['c09'] . '"';
}
}
}
}
$db1->close();
$db2->close();
if (!empty($updates)) {
$stmt = 'SELECT * FROM movies WHERE imdb_id IN (' . $updates . ') ORDER BY title';
PrintVideos($stmt, 0);
}
示例12: getAffectedRows
/**
* This function returns the number of database rows that were changed or inserted or deleted by the most recently completed SQL statement
*
* @return int
*/
public function getAffectedRows()
{
return $this->sqlite->changes();
}
示例13: addColumn
function addColumn($settingRes,$newColName,$newColVal){
if(!isset($settingRes[$newColName])){
$db=new SQLite3('./admin/admin.db');
$altercmd = 'ALTER TABLE admin ADD COLUMN '.$newColName.' TEXT';
$result = $db->exec($altercmd);
if(!$result){
$settingRes['dbmod']=$db->lastErrorMsg();
}
else{
$settingRes['dbmod']=$db->changes().' Record updated successfully.';
}
#Add initial data
$update = $newColName."='".$newColVal."'";
$result = $db->exec('UPDATE admin SET '.$update.' WHERE id=1');
if(!$result){
$addcolRes['dbset']=$db->lastErrorMsg();
}
else{
$addcolRes['dbset']=$db->changes().' Record updated successfully.';
}
$db->close();
return $addcolRes;
}
}
示例14: rowCount
/**
* {@inheritdoc}
*/
public function rowCount()
{
return $this->_conn->changes();
}
示例15: json_encode
require "../includes/include.php";
if (is_numeric($_POST["id"]) && intval($_POST["id"]) > 0) {
$sqlite = new SQLite3($db_str, SQLITE3_OPEN_READWRITE);
$id = intval($_POST["id"]);
$section = findSectionById($id);
$container = null;
if ($section !== false) {
$container = $section["container"];
}
$changes = 0;
$success = false;
if ($sqlite->exec("pragma foreign_keys = on")) {
$delete = $sqlite->prepare("delete from sections where s_id=:id");
$delete->bindValue("id", $id, SQLITE3_INTEGER);
$success = $delete->execute() !== false;
$changes = $sqlite->changes();
} else {
$success = deleteSection($id);
}
if ($success) {
sortSection($container);
$message = date("Y-m-d H:i:s");
} else {
$message = "Unable to delete some links or sections";
}
$result = ["delete" => $section, "success" => $success, "message" => $message, "changes" => $changes, "anchor" => "s" . ($container != null ? $container : "null")];
$sqlite->close();
} else {
$result = ["delete" => $_POST["id"], "success" => false, "message" => "Bad request", "changes" => 0];
}
print json_encode($result);