文档中有写支持Db::raw的写法,一些integer[]的插入写法也需要这个。
这个能加进db库中不?
ubuntu workerman/webman-framework 2.1 webman/database 2.1.6
支持 Db:raw() ,我用过,好像是 IDE 没提示出来。
Db:raw()
可以了,我是原来用tpORM,切换到webman/database(先remove,再require),运行也报错,Db::raw未定义,我试着重新创建项目,再重新安装这些扩展,然后再跑,可以用了。 $res = Db::table('test')->select(Db::raw('count(*) as total'))->first();
$test = [ 'id' => rand(), 'c_id' => Db::raw("'{" . 123 . "}'::integer[]") ]; $res = Db::table('test')->insertGetId($test);
select(['id',Db::raw()])
这样试试呢
Db::raw可以用,估计是我的依赖包的问题, select只能在查询中用,在插入时要写原生,直接用Db::raw
嗯 更新依赖在试试了
支持
Db:raw(),我用过,好像是 IDE 没提示出来。可以了,我是原来用tpORM,切换到webman/database(先remove,再require),运行也报错,Db::raw未定义,我试着重新创建项目,再重新安装这些扩展,然后再跑,可以用了。
$res = Db::table('test')->select(Db::raw('count(*) as total'))->first();
$test = [
'id' => rand(),
'c_id' => Db::raw("'{" . 123 . "}'::integer[]")
];
$res = Db::table('test')->insertGetId($test);
这样试试呢
Db::raw可以用,估计是我的依赖包的问题, select只能在查询中用,在插入时要写原生,直接用Db::raw
嗯 更新依赖在试试了