首页 > 数据库技术 > 详细

postgreSQL 一些基础操作

时间:2016-08-26 20:03:24      阅读:324      评论:0      收藏:0      [点我收藏+]

获取every_check_accident表中的自增id的最大值

SELECT last_value FROM every_check_accident_id_seq;

 $list = DB::getInstance(self::DBNAME)->pg_insert_id(‘every_check_accident‘,‘id‘);

 

查看postgre的版本

select version();

$list = DB::getInstance(self::DBNAME)->ServerInfo(); # 获取数据库版本

 

锁行 (没测试)

select 1 as adodbignore from $tables where $where for update

$list = DB::getInstance(self::DBNAME)->RowLock($tables,$where);

 

查询库中的所有表名(排除系统目录资料表)

select table_name,‘T‘ from information_schema.tables where table_schema not in ( ‘pg_catalog‘,‘information_schema‘)
union
select table_name,‘V‘ from information_schema.views where table_schema not in ( ‘pg_catalog‘,‘information_schema‘)

$list = DB::getInstance(self::DBNAME)->MetaTables(false, false); 获取所有表名

$list = DB::getInstance(self::DBNAME)->MetaTables(true, true); 获取所有的视图

 

技术分享

 

postgreSQL 一些基础操作

原文:http://www.cnblogs.com/fsgblog/p/5811422.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!