本文整理汇总了PHP中sqlite_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_num_rows函数的具体用法?PHP sqlite_num_rows怎么用?PHP sqlite_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
public function set($key, $val, $immutable = false)
{
if ($immutable) {
$this->immutableSet($key, $val);
} else {
if (empty($val)) {
sqlite_query($this->db, "DELETE FROM is4c_local WHERE keystr='{$key}'");
} else {
if (is_array($val)) {
$temp = "";
foreach ($val as $v) {
$temp .= $v . chr(255);
}
$val = substr($temp, 0, strlen($temp) - 1);
} elseif ($val === false) {
$val = 'FALSE';
} elseif ($val === true) {
$val = 'TRUE';
}
$check = sqlite_query($this->db, "SELECT valstr FROM is4c_local WHERE keystr='{$key}'");
if (sqlite_num_rows($check) == 0) {
sqlite_query($this->db, "INSERT INTO is4c_local VALUES ('{$key}','{$val}')");
} else {
sqlite_query($this->db, "UPDATE is4c_local SET valstr='{$val}' WHERE keystr='{$key}'");
}
}
}
$this->debug();
}
示例2: num_rows
function num_rows($query_id = "")
{
if ($query_id == "") {
$query_id = $this->query_id;
}
return @sqlite_num_rows($query_id);
}
示例3: sendQuery
/**
* Method to send SQL query
*
* @param resource $res_conn
* @return void
*/
private function sendQuery($res_conn)
{
// checking query type
// if the query return recordset or not
if (preg_match("/^(SELECT)\\s/i", $this->sql_string)) {
$this->res_result = @sqlite_query($res_conn, $this->sql_string);
// error checking
if (!$this->res_result) {
$this->errno = sqlite_last_error($res_conn);
$this->error = "Query failed to executed. Please check your query again. \n" . sqlite_error_string($this->errno);
} else {
// count number of rows
$this->num_rows = @sqlite_num_rows($this->res_result);
}
} else {
$_query = @sqlite_unbuffered_query($res_conn, $this->sql_string);
$this->insert_id = sqlite_last_insert_rowid($res_conn);
// error checking
if (!$_query) {
$this->errno = sqlite_last_error($res_conn);
$this->error = "Query failed to executed. Please check your query again. \n" . sqlite_error_string($this->errno);
} else {
// get number of affected row
$this->affected_rows = @sqlite_changes($res_conn);
}
// nullify query
$_query = null;
}
}
示例4: numRows
/**
* Returns the number of rows in the recordset
*
* @return int
*/
public function numRows()
{
if ($this->result) {
return sqlite_num_rows($this->result);
} else {
return 0;
}
}
示例5: total_count
protected function total_count()
{
$count = @sqlite_num_rows($this->_result);
if (!$count > 0) {
$count = 0;
}
return $count;
}
示例6: getRecordCount
/**
* @see ResultSet::getRecordCount()
*/
public function getRecordCount()
{
$rows = @sqlite_num_rows($this->result);
if ($rows === null) {
throw new SQLException("Error fetching num rows", sqlite_error_string(sqlite_last_error($this->conn->connection)));
}
return (int) $rows;
}
示例7: write
public static function write($id, $data)
{
$id = "'" . sqlite_escape_string($id) . "'";
$expire = time() + 2 * WEEK;
$R = sqlite_query("SELECT id FROM sess WHERE id = {$id}", SESSION_DB_LINK);
sqlite_query(sqlite_num_rows($R) ? "UPDATE sess SET data = '{$data}', expire = {$expire} WHERE id = {$id}" : "INSERT INTO sess (id, data, expire) VALUES ({$id}, '{$data}', {$expire})", SESSION_DB_LINK);
return sqlite_changes(SESSION_DB_LINK) ? true : false;
}
示例8: count
public function count()
{
$lastresult = $this->results[$this->lasthash];
//print_r($this->results);
$count = sqlite_num_rows($lastresult);
if (!$count) {
$count = 0;
}
return $count;
}
示例9: num_rows
function num_rows($query_results)
{
if (DATABASE_TYPE == "mysql") {
$num_rows = mysqli_num_rows($query_results);
} elseif (DATABASE_TYPE == "sqlite") {
$num_rows = sqlite_num_rows($query_results);
} elseif (DATABASE_TYPE == "pgsql") {
$num_rows = pg_num_rows($query_results);
}
return $num_rows;
}
示例10: sql_numrows
function sql_numrows($query_id = 0)
{
if (!$query_id) {
$query_id = $this->query_result;
}
if ($query_id) {
return @sqlite_num_rows($query_id);
} else {
return false;
}
}
示例11: getLength
public function getLength()
{
if ($this->r === true) {
return sqlite_changes($this->r);
} else {
if ($this->r === false) {
return 0;
}
}
return sqlite_num_rows($this->r);
}
示例12: sql_num_rows
function sql_num_rows($data)
{
if (defined('DB_TYPE')) {
if (DB_TYPE == 'mysql') {
$sql = mysql_num_rows($data);
} elseif (DB_TYPE == 'sqlite') {
$sql = sqlite_num_rows($data);
}
return $sql;
}
}
示例13: checkCredentials
function checkCredentials($userid, $password, Request $message)
{
$db = new dbHandler();
$link = $db->getDbHandler();
$query = "SELECT * FROM Security WHERE UserName = '" . $userid . "' and Password = '" . $password . "'";
$result = sqlite_query($link, $query);
if (sqlite_num_rows($result) < 1) {
$db->close();
throw new WebORBAuthenticationException("invalid userid or password");
}
$db->close();
}
示例14: hasListing
public function hasListing($a_sListingURL)
{
$l_sTmp = md5($a_sListingURL);
$result = sqlite_query($this->db, "SELECT * FROM listings WHERE l_id = '" . $l_sTmp . "'");
$rows = sqlite_num_rows($result);
if ($rows < 1) {
$result = sqlite_exec($this->db, "INSERT INTO listings VALUES ('{$l_sTmp}')");
return false;
} else {
return true;
}
}
示例15: cookielogin
public function cookielogin()
{
if (isset($_COOKIE['userid']) && isset($_COOKIE['pass'])) {
$id = sqlite_escape_string($_COOKIE['userid']);
$pass = sqlite_escape_string($_COOKIE['pass']);
$q = sqlite_query($this->db, "SELECT * FROM users WHERE uid = '{$id}' AND password = '{$pass}' LIMIT 1", $e);
if (sqlite_num_rows($q) > 0) {
$r = sqlite_fetch_array($q);
$_SESSION['uid'] = $r['uid'];
$_SESSION['uname'] = $r['username'];
}
}
}