您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
webman-查詢構造器-自增id與postgresql的序列
发布时间:2022-02-06 20:13:08编辑:雪饮阅读()
實例:
public function index(Request $request)
{
ini_set('memory_limit','4096M');
$data=(Array)Db::table('ecms_news')->first();
unset($data["id"]);
//mysql插入
$id = Db::table('ecms_news')->insertGetId($data);
//pgsql插入
//假定這裏從序列獲取id
$xuelieid=date("His",time());
$pgsql_id = Db::connection('pgsql')->table('user')->insertGetId(
['name' => 'xy',"id"=>$xuelieid],"id"
);
//因爲默認就是從id字段獲取,所以是等同下面這個
$xuelieid=$xuelieid+1;
$pgsql_id = Db::connection('pgsql')->table('user')->insertGetId(
['name' => 'xy',"id"=>$xuelieid]
);
$all=compact("id","pgsql_id");
var_dump($all);
return response("ok");
}
實例被訪問時:
[root@localhost webman]# /usr/local/php734/bin/php -c /usr/local/php734/lib/php.ini start.php start
Workerman[start.php] start in DEBUG mode
----------------------------------------- WORKERMAN -----------------------------------------
Workerman version:4.0.26 PHP version:7.3.4
------------------------------------------ WORKERS ------------------------------------------
proto user worker listen processes status
tcp root webman http://0.0.0.0:8787 4 [OK]
tcp root monitor none 1 [OK]
---------------------------------------------------------------------------------------------
Press Ctrl+C to stop. Start success.
訪問了全局中間件!
array(2) {
["id"]=>
int(3301)
["pgsql_id"]=>
int(200914)
}
关键字词:webman,查詢構造器,自增,id,postgresql,序列
上一篇:webman-查詢構造器-插入
相关文章
- webman-查詢構造器-插入
- webman-查詢構造器-offset,limit的用法
- webman-查詢構造器-groupBy與having的用法
- webman-查詢構造器-orderBy,随机排序的用法
- webman-查詢構造器-参数分组,whereExists的用法
- webman-查詢構造器-orWhereColumn 的用法
- webman-查詢構造器-whereColumn 的用法
- webman-查詢構造器-whereDate,whereMonth,whereDay,wh
- webman-查詢構造器-whereNull ,whereNotNull,orWhereN
- webman-查詢構造器-whereIn、whereNotIn、orWhereIn