当前位置: 首页>>代码示例>>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;未经允许,请勿转载。