本文整理汇总了PHP中Sql::pSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::pSelect方法的具体用法?PHP Sql::pSelect怎么用?PHP Sql::pSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::pSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntries
public static function getEntries($user_id)
{
if (!is_numeric($user_id)) {
throw new \Exception('ehm');
}
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE owner = ?' . ' ORDER BY time_created DESC';
$list = Sql::pSelect($q, 'i', $user_id);
return SqlObject::loadObjects($list, __CLASS__);
}
示例2: getByType
public static function getByType($type)
{
if (!is_numeric($type)) {
throw new \Exception('hmmm');
}
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE type = ?' . ' ORDER BY time_created DESC';
$list = Sql::pSelect($q, 'i', $type);
return SqlObject::ListToObjects($list, __CLASS__);
}
示例3: getList
public static function getList($type, $owner)
{
if (!is_numeric($owner) || !is_numeric($type)) {
throw new \Exception('noo');
}
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE owner = ? AND type = ?';
$list = Sql::pSelect($q, 'ii', $owner, $type);
return SqlObject::ListToObjects($list, __CLASS__);
}
示例4: getRecent
/**
* @return list of most recent blogs (by publish time)
*/
public static function getRecent($count)
{
if (!is_numeric($count)) {
return false;
}
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE time_published IS NOT NULL' . ' ORDER BY time_published DESC' . ' LIMIT ' . $count;
$list = Sql::pSelect($q);
return SqlObject::loadObjects($list, __CLASS__);
}
示例5: getByCategory
public static function getByCategory($type, $cat, $uploader = 0)
{
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE type = ?' . ' AND category = ?' . ($uploader ? ' AND uploader = ?' : '') . ' AND time_deleted IS NULL';
if ($uploader) {
$list = Sql::pSelect($q, 'iii', $type, $cat, $uploader);
} else {
$list = Sql::pSelect($q, 'ii', $type, $cat);
}
return SqlObject::loadObjects($list, __CLASS__);
}
示例6: getAllBetween
public static function getAllBetween($time_start, $time_end)
{
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE timeCreated BETWEEN "' . sql_datetime($time_start) . '" AND "' . sql_datetime($time_end) . '"' . ' ORDER BY timeCreated DESC';
return Sql::pSelect($q);
}
示例7: getOutbox
/** @return all messages in the Outbox */
public static function getOutbox($user_id)
{
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE `from` = ?' . ' ORDER BY time_sent DESC';
$list = Sql::pSelect($q, 'i', $user_id);
return SqlObject::loadObjects($list, __CLASS__);
}
示例8: getAll
/**
* @return 2d array of all settings for owner
*/
public static function getAll($type, $owner)
{
$q = 'SELECT id, name, value, category' . ' FROM ' . self::$tbl_name . ' WHERE type = ? AND owner = ?';
return Sql::pSelect($q, 'ii', $type, $owner);
}
示例9: get_class
$session->requireSuperAdmin();
echo '<h1>MySQL information</h1>';
echo 'Driver: <b>' . get_class($db) . '</b><br/>';
echo 'Server version: <b>' . $db->db_handle->server_info . '</b><br/>';
echo 'Client version: <b>' . $db->db_handle->client_info . '</b><br/>';
echo 'Host: <b>' . $db->host . ':' . $db->port . '</b><br/>';
echo 'Username: <b>' . $db->username . '</b><br/>';
// echo 'Password: '.($db->password ? $db->password : '(blank)').'<br/>';
echo 'Database: <b>' . $db->database . '</b><br/>';
echo 'Configured charset: <b>' . $db->charset . '</b><br/>';
echo 'Connection charset: <b>' . $db->db_handle->character_set_name() . '</b><br/>';
echo 'Host info: <b>' . $db->db_handle->host_info . '</b><br/>';
echo '<br/>';
$q = 'SHOW GRANTS FOR CURRENT_USER';
$priv = Sql::pSelect($q);
// ex: GRANT USAGE ON *.* TO 'savak'@'%' IDENTIFIED BY PASSWORD '*0...
// ex: GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '*xxx'
// ex: GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*xxx' WITH GRANT OPTION
/// XXXXX FIXME: censor password from string instead of cut it!!!!
//d($priv);
echo '<h2>Privileges</h2>';
foreach ($priv as $p) {
$key = key($p);
$val = current($p);
echo $key . ': <b>' . substr($val, 0, 60) . '</b>...<br/>';
}
echo '<br/>';
echo '<h2>Time</h2>';
$db_time = Sql::pSelectItem('SELECT NOW()');
echo 'Database time: ' . $db_time . '<br/>';
示例10: getOtherThan
/**
* @return all most recent coordinates for objects not owned by $exclude_owner
*/
public static function getOtherThan($type, $exclude_owner)
{
$q = 'SELECT MAX(time_saved) AS time_saved,id,owner,type,country,name,latitude,longitude,accuracy' . ' FROM ' . self::$tbl_name . ' WHERE type = ? AND owner != ?' . ' GROUP BY owner';
$list = Sql::pSelect($q, 'ii', COORD_EXACT, $exclude_owner);
return SqlObject::loadObjects($list, __CLASS__);
}
示例11: getDenied
public static function getDenied()
{
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE time_handled IS NOT NULL AND approved = ?';
$list = Sql::pSelect($q, 'i', 0);
return SqlObject::loadObjects($list, __CLASS__);
}
示例12: getRecent
public static function getRecent($room, $microtime, $limit)
{
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE room = ? AND microtime > ?' . ' ORDER BY microtime DESC' . ' LIMIT ?';
$list = Sql::pSelect($q, 'idi', $room, $microtime, $limit);
return SqlObject::loadObjects($list, __CLASS__);
}
示例13: getActivePolls
static function getActivePolls($type, $owner = 0)
{
$q = 'SELECT * FROM tblPolls' . ' WHERE type = ? AND owner = ? AND deleted_by = ? AND NOW() BETWEEN time_start AND time_end' . ' ORDER BY time_start ASC,text ASC';
$list = Sql::pSelect($q, 'iii', $type, $owner, 0);
return SqlObject::loadObjects($list, __CLASS__);
}
示例14: d
d($x);
$q = 'REPLACE tblSessionData (session_id,session_data,expires) VALUES(?, ?, ?)';
$xxx = Sql::pUpdate($q, 'sss', 666, "hejhej", sql_datetime( time() ) );
d($xxx);
$q = 'INSERT INTO tblLikes (owner,type) VALUES (?, ?)';
$id = Sql::pInsert($q, 'ii', 4,9);
if ($id < 2) echo "FAIL 5\n";
$w = new Word();
$w->id = 8;
$w->value = "sten";
if (SqlObject::exists($w, 'oWord') != true) echo "FAIL 10\n";
$w = new Word();
$w->id = 8;
$w->value = "st2en";
if (SqlObject::exists($w, 'oWord') == true) echo "FAIL 11\n";
*/
// TODO more reliable test of ListToObjects
$q = 'SELECT * FROM tblBookmarks' . ' WHERE owner = ? AND type = ?';
$list = Sql::pSelect($q, 'ii', 2, 100);
$objs = SqlObject::ListToObjects($list, 'Bookmark');
if (count($objs) < 5) {
echo "FAIL 20\n";
}
$q = 'SELECT * FROM tblBookmarks' . ' WHERE id = ?';
$row = Sql::pSelectRow($q, 'i', 66);
$obj = SqlObject::RowToObject($row, 'Bookmark');
if ($obj->id != 66) {
echo "FAIL 30\n";
}
$bb = Bookmark::get(66);
d($bb);
示例15: getAll
public static function getAll($type)
{
$q = 'SELECT * FROM ' . self::$tbl_name . ' WHERE type = ?' . ' ORDER BY value ASC';
$res = Sql::pSelect($q, 'i', $type);
return SqlObject::loadObjects($res, __CLASS__);
}