本文整理汇总了PHP中sqlite_array_query函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_array_query函数的具体用法?PHP sqlite_array_query怎么用?PHP sqlite_array_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite_array_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBUCKET
function DBUCKET($db, $sql)
{
$search = array('CAN I PLZ GET ', ' ALL UP IN ', ' OMG ');
$replace = array('SELECT ', ' FROM ', ' WHERE ');
$sql = str_replace($search, $replace, $sql);
return sqlite_array_query($db, $sql);
}
示例2: loadIndexes
function loadIndexes()
{
if (!$this->isExisting || $this->isIndexesLoaded) {
return;
}
$this->loadColumns();
$connection_id = $this->database->getConnection()->getConnectionId();
$rs = sqlite_array_query($connection_id, "PRAGMA index_list('{$this->name}')", SQLITE_ASSOC);
foreach ($rs as $item) {
$index = new lmbSqliteIndexInfo();
$index->table = $this;
$index->name = $item['name'];
list($index_info) = sqlite_array_query($connection_id, "PRAGMA index_info('{$index->name}')", SQLITE_ASSOC);
$index->column_name = $index_info['name'];
if (1 == $item['unique']) {
// if column is defined exactly as INTEGER PRIMARY KEY, primary index is not created
// instead it becomes an alias of system ROWID, see http://www.sqlite.org/lang_createtable.html#rowid for more info
$index->type = in_array($index['column_name'], $this->pk) ? lmbDbIndexInfo::TYPE_PRIMARY : lmbDbIndexInfo::TYPE_UNIQUE;
} else {
$index->type = lmbDbIndexInfo::TYPE_COMMON;
}
$this->indexes[$index->name] = $index;
}
$this->isIndexesLoaded = true;
}
示例3: array_query
function array_query($sqlString, $result_type = SQLITE_BOTH, $decode_binary = true)
{
if (DEBUG) {
return sqlite_array_query($this->connId, $sqlString, $result_type, $decode_binary);
} else {
return @sqlite_array_query($this->connId, $sqlString, $result_type, $decode_binary);
}
}
示例4: singleQuery
/**
* Executes a query that might return just one row.
* @param $query the query.
* @return an array with the requested row data.
*/
public function singleQuery($query)
{
checkQuery($query);
#echo "$query\n";
$ret = sqlite_array_query($query, $this->link, SQLITE_ASSOC);
if (count($ret)) {
return $ret[0];
}
}
示例5: iteratorKeys
public function iteratorKeys()
{
$data = sqlite_array_query($this->db, 'SELECT keystr FROM is4c_local', SQLITE_NUM);
$keys = array();
foreach ($data as $row) {
$keys[] = $row[0];
}
return array_merge(parent::iteratorKeys(), $keys);
}
示例6: get_stats
function get_stats()
{
global $db;
$query = "SELECT SUM(nb_view) AS nb_views, SUM(nb_play) AS nb_plays FROM fuu WHERE 1";
$res = sqlite_array_query($db, $query, SQLITE_ASSOC);
if (count($res) > 0) {
return $res[0];
}
return array('nb_views' => 0, 'nb_plays' => 0);
}
示例7: SingleQuery
public function SingleQuery($query)
{
if (!$this->IsConnected()) {
throw new Exception("Not Connected to DB.");
}
#echo "$query\n";
$ret = sqlite_array_query($query, $this->link, SQLITE_ASSOC);
if (count($ret)) {
return $ret[0];
}
}
示例8: getProducts
public function getProducts()
{
try {
$db = new dbHandler();
$link = $db->getDbHandler();
/*String*/
$query = "SELECT Name, Price FROM Products";
$result = sqlite_array_query($link, $query, SQLITE_ASSOC);
$db->close();
return $result;
} catch (Exception $exception) {
Log::log(LoggingConstants::EXCEPTION, $exception);
}
return null;
}
示例9: getRecords
function getRecords()
{
global $dbPath, $dbHandle;
if ($dbHandle == 0) {
$dbHandle = sqlite_open($dbPath, 0666, $sqliteError) or die("SQL error: {$sqliteError}");
}
//NO! $ra = sqlite_fetch_array(dbQuery("select id from list"));
$ra = sqlite_array_query($dbHandle, 'SELECT * FROM list LIMIT 200');
/*
echo "<pre>\n";
print_r($ra);
echo "<pre>\n";
//var_dump(sqlite_fetch_array($result));
*/
return $ra;
}
示例10: getmicrotime
echo "Time Taken: ".($e-$s)."\n";
$s = getmicrotime();
$r = sqlite_unbuffered_query("SELECT * FROM foo", $db);
while (sqlite_fetch_array($r, SQLITE_NUM));
$e = getmicrotime();
echo "Time Taken: ".($e-$s)."\n";
$db = new sqlite_db("db2.sqlite");
$s = getmicrotime();
$r = $db->unbuffered_query("SELECT * FROM foo", SQLITE_NUM);
foreach($r as $row);
$e = getmicrotime();
echo "Time Taken: ".($e-$s)."\n";
sqlite_query("DROP TABLE messages", $db);
sqlite_query("CREATE TABLE messages ( timestamp INTEGER, title VARCHAR(255) )", $db);
sqlite_query("DROP TABLE profile", $db);
sqlite_query("CREATE TABLE profile ( time_format VARCHAR(255), login VARCHAR(255) )", $db);
sqlite_query("INSERT INTO profile (login, time_format) VALUES('ilia', 'l dS of F Y h:i:s A')", $db);
for ($i = 0; $i < 5; $i++) {
sqlite_query("INSERT INTO messages (timestamp, title) VALUES(".rand(time(), (time() + 86400 * 365)).", 'message #{$i}')", $db);
}
*/
sqlite_query("PRAGMA show_datatypes = ON", $db);
// sqlite_query("PRAGMA full_column_names = ON", $db);
print_r(sqlite_array_query("SELECT * FROM messages", $db));
sqlite_close($db);
示例11: WHERE
echo "<rejectWithBusy>".checkRejectWithBusy()."</rejectWithBusy>";
echo "<ifRecordFound>".getOnANIMatchCondition()."</ifRecordFound>";
if(getOnANIMatchCondition()=="acceptCall"){
print('<rejectCallWithBusy value="false">' . getRedirectRoute("acceptCall") . '</rejectCallWithBusy>');
}else{
if(checkRejectWithBusy()=='false'){
print('<rejectCallWithBusy value="false">' . getRedirectRoute("rejectCall") . '</rejectCallWithBusy>');
}else{
print('<rejectCallWithBusy value="true"/>');
}
}
echo("<queryResults recordsFound=\"".$recordsFound."\">");
echo('<!-- Multiple Records Found-->');
// Print out records found if there are more then one
$query = "SELECT * FROM userRecords WHERE (ANI='".$_REQUEST['callerID']."') ORDER BY 1 DESC";
$dbhandle = sqlite_open($dbPath,0666);
$result = sqlite_array_query($dbhandle,$query, SQLITE_ASSOC);
foreach ($result as $entry) {
echo "<recordName number=\"" . $recordCounterVar . "\">". ($entry['firstName'])." ".($entry['lastName']). "</recordName>";
$recordCounterVar++;
}
echo "</queryResults>";
}
print('</xmlData>');
exit;
?>
示例12: sqlite_array_query
<?php
require "../config/main.php";
$rows = sqlite_array_query($dbmain, "SELECT database,nombre FROM tbempresas where codigo='" . $_POST["login-empresa"] . "' limit 1", SQLITE_ASSOC);
foreach ($rows as $row) {
mssql_select_db($row[database]);
///falta la clave
$sql = mssql_query("select OBJECT_ID('dbo.VBENCRIPTA')");
if (mssql_result($sql, 0, 0) == '') {
mssql_query("\n\t\t\tCREATE FUNCTION [dbo].[VBENCRIPTA](@str VARCHAR(50))\n\t\t\tRETURNS VARCHAR(50)\n\t\t\tAS\n\t\t\tBEGIN\n\t\t\t\tdeclare @istr as int;\n\t\t\t\tdeclare @strend as nvarchar(50);\n\t\t\t\tset @istr = 0;\n\t\t\t\tset @strend = '';\n\t\t\t\twhile len(@str)>@istr\n\t\t\t\tbegin\n\t\t\t\t\tset @strend = @strend + CHAR(ASCII(substring(@str,@istr+1,1))+80);\n\t\t\t\t\tset @istr = @istr+1;\n\t\t\t\tend\n\t\t\t\treturn @strend;\n\t\t\tEND");
}
if ($sql = @mssql_query("select * from tbusuarios where LOGIN='" . $_POST["login-user"] . "' and CLAVE=dbo.VBENCRIPTA('" . $_POST["login-pass"] . "') and inactivo=0")) {
if (mssql_num_rows($sql) > 0) {
$rowu = sqlite_array_query($dbmain, "SELECT * FROM tbsession where user='" . md5(strtoupper($_POST["login-user"])) . "' limit 1", SQLITE_ASSOC);
if (count($rowu) == 0 || time() - $rowu[0][time] > 25) {
sqlite_exec($dbmain, "delete from tbsession where user='" . md5(strtoupper($_POST["login-user"])) . "'");
sqlite_exec($dbmain, "insert into tbsession (id,user,time) values ('" . session_id() . "','" . md5(strtoupper($_POST["login-user"])) . "','" . time() . "')");
session_register("octa-lite-empresa");
$_SESSION["octa-lite-empresa"]["codigo"] = $_POST["login-empresa"];
$_SESSION["octa-lite-empresa"]["database"] = $row[database];
$_SESSION["octa-lite-empresa"]["nombre"] = $row[nombre];
session_register("octa-lite-user");
$_SESSION["octa-lite-user"] = mssql_fetch_array($sql, MSSQL_ASSOC);
$_SESSION["octa-lite-user"]["CLAVE"] = "+++++";
echo "logged";
} else {
echo utf8_encode("Este usuario ya esta activo en otro equipo!");
}
} else {
echo "Contraseña inválida!";
}
示例13: tableInfo
/**
* Returns information about a table
*
* @param string $result a string containing the name of a table
* @param int $mode a valid tableInfo mode
*
* @return array an associative array with the information requested.
* A DB_Error object on failure.
*
* @see DB_common::tableInfo()
* @since Method available since Release 1.7.0
*/
function tableInfo($result, $mode = null)
{
if (is_string($result)) {
/*
* Probably received a table name.
* Create a result resource identifier.
*/
$id = @sqlite_array_query($this->connection, "PRAGMA table_info('{$result}');", SQLITE_ASSOC);
$got_string = true;
} else {
$this->last_query = '';
return $this->raiseError(DB_ERROR_NOT_CAPABLE, null, null, null, 'This DBMS can not obtain tableInfo' . ' from result sets');
}
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
$case_func = 'strtolower';
} else {
$case_func = 'strval';
}
$count = count($id);
$res = array();
if ($mode) {
$res['num_fields'] = $count;
}
for ($i = 0; $i < $count; $i++) {
if (strpos($id[$i]['type'], '(') !== false) {
$bits = explode('(', $id[$i]['type']);
$type = $bits[0];
$len = rtrim($bits[1], ')');
} else {
$type = $id[$i]['type'];
$len = 0;
}
$flags = '';
if ($id[$i]['pk']) {
$flags .= 'primary_key ';
if (strtoupper($type) == 'INTEGER') {
$flags .= 'auto_increment ';
}
}
if ($id[$i]['notnull']) {
$flags .= 'not_null ';
}
if ($id[$i]['dflt_value'] !== null) {
$flags .= 'default_' . rawurlencode($id[$i]['dflt_value']);
}
$flags = trim($flags);
$res[$i] = array('table' => $case_func($result), 'name' => $case_func($id[$i]['name']), 'type' => $type, 'len' => $len, 'flags' => $flags);
if ($mode & DB_TABLEINFO_ORDER) {
$res['order'][$res[$i]['name']] = $i;
}
if ($mode & DB_TABLEINFO_ORDERTABLE) {
$res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
}
}
return $res;
}
示例14: sqlite_open
<?php
$db = sqlite_open(dirname(__FILE__) . "/db2.sqlite");
/* arguments:
* 1 database resource
* 2 sqlite function name
* 3 php function name
* 4 number of arguments (optional)
*/
sqlite_create_function($db, "my_date", "date", 2);
/*
* The above function makes PHP date() avaliable
* from SQLite as my_date() and for highest
* performance indicates that it requires
* exactly 2 arguments
*/
$res = sqlite_array_query("\n\tSELECT title, \n\tmy_date((SELECT time_format FROM profile WHERE login='ilia'), timestamp) AS date\n\tFROM messages", $db, SQLITE_ASSOC);
foreach ($res as $v) {
echo $v['title'] . " was posted on " . $v['date'] . "<br />\n";
}
示例15: queryAll
public function queryAll($sql)
{
$result = sqlite_array_query($this->lnk, $sql, SQLITE_ASSOC);
return $result;
}