當前位置: 首頁>>代碼示例>>PHP>>正文


PHP db::Query方法代碼示例

本文整理匯總了PHP中db::Query方法的典型用法代碼示例。如果您正苦於以下問題:PHP db::Query方法的具體用法?PHP db::Query怎麽用?PHP db::Query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在db的用法示例。


在下文中一共展示了db::Query方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: register

 public function register()
 {
     if ($this->get_uid()) {
         return $this->get_uid();
     }
     $res = db::Query("INSERT INTO users.info DEFAULT VALUES RETURNING uid", [], true);
     return $this->get_login($res->uid);
 }
開發者ID:Exsul,項目名稱:inyo,代碼行數:8,代碼來源:auth.php

示例2: CheckForRequestFrame

 private function CheckForRequestFrame($network)
 {
     try {
         $res = db::Query("UPDATE personal.frequency\n          SET last_access=now()\n          WHERE network=\$1\n          AND now() - last_access > min_interval\n          RETURNING *", [$network], true);
         return $res();
     } catch (Exception $e) {
         return false;
     }
 }
開發者ID:synchrotalk,項目名稱:synchrotalk,代碼行數:9,代碼來源:network.php

示例3: new_income

 private function new_income($data = [])
 {
     $trans = db::Begin();
     $handle = db::Query("INSERT INTO transactions(system, data) VALUES (\$1, \$2) RETURNING id", ["yandex.wallet", json_encode($data)], true);
     $result = $trans->Commit();
     if (!$result) {
         header('500 Failed to store transaction');
         exit;
     }
 }
開發者ID:Exsul,項目名稱:endpoint,代碼行數:10,代碼來源:wallet.php

示例4: get_account_object

 private function get_account_object($account_id)
 {
     if (!empty($this->loaded_accounts[$account_id])) {
         return $this->loaded_accounts[$account_id];
     }
     $account = db::Query("SELECT *\n      FROM personal.tokens\n      WHERE uid=\$1\n        AND account_id=\$2", [db::UID(), $account_id], true);
     phoxy_protected_assert($account(), "Account not found. Please connect again");
     list($obj, $user) = $this->network_signin($account->network, json_decode($account->token_data, true));
     db::Query("UPDATE personal.tokens\n        SET profile_id=\$2\n        WHERE account_id=\$1", [$account_id, $user->id]);
     return $this->loaded_accounts[$account_id] = $obj;
 }
開發者ID:synchrotalk,項目名稱:synchrotalk,代碼行數:11,代碼來源:accounts.php

示例5: register

 protected function register()
 {
     if (isset($_POST["register"])) {
         if (!empty($_POST['username']) && !empty($_POST['password'])) {
             $username = $_POST['username'];
             $password = $_POST['password'];
             $sameusers = db::Query("select * from users WHERE username=\$1", [$username]);
             if ($sameusers() == 0) {
                 $useradd = "INSERT INTO users (username,password) VALUES (\$1,\$2) RETURNING id";
                 $result = db::Query($useradd, [$username, $password], true);
                 if ($result() != 0) {
                     return "Аккаунт создан, вы прекрасны";
                 } else {
                     return "Ошибка :p";
                 }
             } else {
                 return "Такой чувак уже есть.";
             }
         } else {
             return "Поля незаполнены!";
         }
     }
 }
開發者ID:Exsul,項目名稱:inyo,代碼行數:23,代碼來源:user.php

示例6: vote

 protected function vote($id, $delta)
 {
     return db::Query("UPDATE quotes SET ratio=ratio+\$2 WHERE id=\$1 RETURNING ratio", [$id, $delta], true)->ratio;
 }
開發者ID:Exsul,項目名稱:inyo,代碼行數:4,代碼來源:ratio.php

示例7: error_reporting

<?php

require_once 'vendor/autoload.php';
if (!PRODUCTION) {
    error_reporting(E_ALL);
    ini_set('display_errors', 'On');
}
function phoxy_conf()
{
    $ret = phoxy_default_conf();
    $ret["api_xss_prevent"] = PRODUCTION;
    return $ret;
}
function default_addons()
{
    $ret = ["cache" => PRODUCTION ? ['global' => '10m'] : "no", "result" => "canvas"];
    return $ret;
}
include 'phoxy/phoxy_return_worker.php';
phoxy_return_worker::$add_hook_cb = function ($that) {
    global $USER_SENSITIVE;
    if ($USER_SENSITIVE) {
        $that->obj['cache'] = 'no';
    }
};
phpsql\OneLineConfig(conf()->db->connection_string);
db::Query("INSERT INTO requests(url, get, post, headers, server) VALUES (\$1, \$2, \$3, \$4, \$5)", [$_SERVER['QUERY_STRING'], json_encode($_GET), json_encode($_POST), json_encode(getallheaders()), json_encode($_SERVER)]);
include 'phoxy/load.php';
開發者ID:Exsul,項目名稱:endpoint,代碼行數:28,代碼來源:rpc.php

示例8: info

 public function info($account_id)
 {
     $account = db::Query("SELECT *\n      FROM personal.tokens\n      WHERE uid=\$1 AND account_id=\$2", [db::UID(), $account_id], true);
     phoxy_protected_assert($account(), "Internal issue: account not found");
     return $this->PrepareAccount($account);
 }
開發者ID:synchrotalk,項目名稱:synchrotalk,代碼行數:6,代碼來源:tokens.php

示例9: rendertags

 protected function rendertags($id)
 {
     $sql_tags = db::Query("SELECT tag FROM tags WHERE quote_id=\$1", [$id]);
     return ["design" => "quotes/tags", "data" => ["tags" => $sql_tags]];
 }
開發者ID:Exsul,項目名稱:inyo,代碼行數:5,代碼來源:main.php

示例10: Update

 public function Update($type, $resource_id, $data, $expiration)
 {
     // TODO: Update if exists
     db::Query("DELETE FROM personal.account_cache WHERE expired < now()");
     db::Query("INSERT INTO personal.account_cache\n        (account_id, type, resource_id, data, expired)\n        VALUES (\$1, \$2, \$3, \$4, 'epoch'::timestamp + \$5::int8 * '1 second'::interval)", [$this->AccountID(), $type, $resource_id, json_encode($data, true), $expiration]);
 }
開發者ID:synchrotalk,項目名稱:synchrotalk,代碼行數:6,代碼來源:cache.php

示例11: SQLLoad

}
function SQLLoad($file)
{
    header("SQL: {$file}", false);
    $con = db::RawConnection();
    $sql = file_get_contents($file);
    pg_send_query($con, $sql);
    if (($error = pg_last_error($con)) !== '') {
        die("Failure at loading {{$file}} with {{$error}}");
    }
    while (pg_connection_busy($con)) {
        sleep(1);
    }
    while (pg_get_result($con) !== false) {
        if (($error = pg_last_error($con)) !== '') {
            die("Failure at loading {{$file}} with {{$error}}");
        }
    }
}
if (db::RawConnection() == false) {
    EmergencyCreateDB();
}
$res = @db::Query("SELECT * FROM quotes LIMIT 1");
if (is_string($res)) {
    // then its error
    SQLLoad("sql/schema.sql");
} else {
    if (!$res()) {
    }
}
header("SQL: OK", false);
開發者ID:Exsul,項目名稱:inyo,代碼行數:31,代碼來源:loader.php

示例12: Register

 public function Register()
 {
     return db::Query("INSERT INTO personal.users DEFAULT VALUES RETURNING uid", [], true)->uid;
 }
開發者ID:synchrotalk,項目名稱:synchrotalk,代碼行數:4,代碼來源:store.php


注:本文中的db::Query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。