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


PHP SQLite3::changes方法代码示例

本文整理汇总了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);
 }
开发者ID:ianaldrighetti,项目名称:queryer,代码行数:16,代码来源:Sqlite3Driver.php

示例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();
     }
 }
开发者ID:dannypenrose,项目名称:xtbackup,代码行数:34,代码来源:Sqlite.php

示例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();}
开发者ID:VPtvfy,项目名称:php_sqlite_session,代码行数:7,代码来源:sqlite.inc.php

示例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;
}
开发者ID:bhargavz,项目名称:WIPSTER,代码行数:26,代码来源:anubis.php

示例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;
 }
开发者ID:bhargavz,项目名称:WIPSTER,代码行数:53,代码来源:config.php

示例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;
 }
开发者ID:enozoom,项目名称:es,代码行数:24,代码来源:SQLite.php

示例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));
开发者ID:ezoic,项目名称:hhvm,代码行数:31,代码来源:ext_sqlite3.php

示例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;
 }
开发者ID:mmonguilod,项目名称:symfony1,代码行数:27,代码来源:sfMessageSource_SQLite3.class.php

示例9: exec

 /**
  * 执行
  * @param $query
  * @return mixed
  */
 public function exec($query)
 {
     $this->debug($query);
     $this->_sqlite->exec($query);
     return $this->_sqlite->changes();
 }
开发者ID:shizg,项目名称:index,代码行数:11,代码来源:index.php

示例10: affectedRows

 function affectedRows()
 {
     return $this->connection->changes();
 }
开发者ID:maniaplanet,项目名称:manialive-lib,代码行数:4,代码来源:Connection.php

示例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);
}
开发者ID:0ldiron,项目名称:KellerKino,代码行数:25,代码来源:ServiceSync.php

示例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();
 }
开发者ID:nonconforme,项目名称:nreeda,代码行数:9,代码来源:Sqlite3.class.php

示例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;
	}
}
开发者ID:bhargavz,项目名称:WIPSTER,代码行数:26,代码来源:admin.php

示例14: rowCount

 /**
  * {@inheritdoc}
  */
 public function rowCount()
 {
     return $this->_conn->changes();
 }
开发者ID:jsor,项目名称:dbal-sqlite3,代码行数:7,代码来源:Statement.php

示例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);
开发者ID:jatolmed,项目名称:links,代码行数:31,代码来源:delete_section.php


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