The latest thinkphp v5.2 work order system Show Pgsql.class.php Source code
Return
Download The latest thinkphp v5.2 work order system:
download Pgsql.class.php Source code
- Download The latest thinkphp v5.2 work order system Source code - Type:.php
- <?php
- // +----------------------------------------------------------------------
- // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: liu21st <liu21st@gmail.com>
- // +----------------------------------------------------------------------
- namespace Think\Db\Driver;
- use Think\Db\Driver;
- /**
- * Pgsql数据库驱动
- */
- class Pgsql extends Driver{
- /**
- * 解析pdo连接的dsn信息
- * @access public
- * @param array $config 连接信息
- * @return string
- */
- protected function parseDsn($config){
- $dsn = 'pgsql:dbname='.$config['database'].';host='.$config['hostname'];
- if(!empty($config['hostport'])) {
- $dsn .= ';port='.$config['hostport'];
- }
- return $dsn;
- }
- /**
- * 取得数据表的字段信息
- * @access public
- * @return array
- */
- public function getFields($tableName) {
- list($tableName) = explode(' ', $tableName);
- $result = $this->query('select fields_name as "field",fields_type as "type",fields_not_null as "null",fields_key_name as "key",fields_default as "default",fields_default as "extra" from table_msg('.$tableName.');');
- $info = [];
- if($result){
- foreach ($result as $key => $val) {
- $info[$val['field']] = array(
- 'name' => $val['field'],
- 'type' => $val['type'],
- 'notnull' => (bool) ($val['null'] === ''), // not null is empty, null is yes
- 'default' => $val['default'],
- 'primary' => (strtolower($val['key']) == 'pri'),
- 'autoinc' => (strtolower($val['extra']) == 'auto_increment'),
- );
- }
- }
- return $info;
- }
- /**
- * 取得数据库的表信息
- * @access public
- * @return array
- */
- public function getTables($dbName='') {
- $result = $this->query("select tablename as Tables_in_test from pg_tables where schemaname ='public'");
- $info = array();
- foreach ($result as $key => $val) {
- $info[$key] = current($val);
- }
- return $info;
- }
- /**
- * limit分析
- * @access protected
- * @param mixed $lmit
- * @return string
- */
- public function parseLimit($limit) {
- $limitStr = '';
- if(!empty($limit)) {
- $limit = explode(',',$limit);
- if(count($limit)>1) {
- $limitStr .= ' LIMIT '.$limit[1].' OFFSET '.$limit[0].' ';
- }else{
- $limitStr .= ' LIMIT '.$limit[0].' ';
- }
- }
- return $limitStr;
- }
- }
downloadPgsql.class.php Source code
- Download The latest thinkphp v5.2 work order system Source code
Related Source Codes/Software:
V3.3.6 Workerman high-performance PHP Socket (framework) - High performance PHP Socket framework Workerman re... 2017-05-03
The phosphor meeting room reservation system MRBS (loop reservation v16.0) - The phosphor meeting room reservation system MRBS ... 2017-05-03
IDC v5.2.3 agent center - IDC Centre IDC for exploitation is a PHP+MySQL age... 2017-05-03
Zen master v9.0.1 project management software - Zen is the first domestic open source project mana... 2017-05-03
Ray speed v7.03 employee files management system - Employee files project is various, and some conten... 2017-05-03
HITCMS Haitian responsive electronic mechanical v3.0 foreign trade website source code - HITCMS Haitian response electronic machinery trade... 2017-05-03
Ray v7.02 speed survey system - Lightning speed survey system is a. NET+MSSQL deve... 2017-05-03
Cool HITCMS reactive black v3.0 enterprise website source code - HITCMS-Haitian response black enterprises website ... 2017-05-03
WebOA v17.2 network office automation system - WebOA network using b/s structure development of o... 2017-05-03
Pure imitation of han site source code, one a 】 【 c9cms kernel v1.0 - Generic http://www.wufazhuce.com/Han one ·
Config... 2017-05-04
zone.js - Implements Zones for JavaScript
... 2017-05-11
dragonfly - A Ruby gem for on-the-fly processing - suitable fo... 2017-05-11
oh-my-fish - The Fishshell Framework. 2017-05-11
canvas-lms - The open LMS by Instructure, Inc. 2017-05-11
ledger - Double-entry accounting system with a command-line... 2017-05-11
Python - My Python Examples
http://w... 2017-05-11
blade - 2017-05-11
LaZagne - Credentials recovery project 2017-05-10
Pull-to-Refresh.Rentals-iOS - This project aims to provide a simple and customiz... 2017-05-10
spoon - Distributing instrumentation tests to all your And... 2017-05-10