X7ROOT File Manager
Current Path:
/home/cbholdings/pasukulu/lib/adodb/drivers
home
/
cbholdings
/
pasukulu
/
lib
/
adodb
/
drivers
/
📁
..
📄
adodb-access.inc.php
(2.15 KB)
📄
adodb-ado.inc.php
(16.24 KB)
📄
adodb-ado5.inc.php
(17.33 KB)
📄
adodb-ado_access.inc.php
(1.48 KB)
📄
adodb-ado_mssql.inc.php
(4.02 KB)
📄
adodb-ads.inc.php
(19.39 KB)
📄
adodb-borland_ibase.inc.php
(2.43 KB)
📄
adodb-csv.inc.php
(5.09 KB)
📄
adodb-db2.inc.php
(44.21 KB)
📄
adodb-db2oci.inc.php
(4.31 KB)
📄
adodb-db2ora.inc.php
(2.23 KB)
📄
adodb-fbsql.inc.php
(6.84 KB)
📄
adodb-firebird.inc.php
(33.29 KB)
📄
adodb-ibase.inc.php
(22.51 KB)
📄
adodb-informix.inc.php
(1.21 KB)
📄
adodb-informix72.inc.php
(14.81 KB)
📄
adodb-ldap.inc.php
(10.93 KB)
📄
adodb-mssql.inc.php
(30.57 KB)
📄
adodb-mssql_n.inc.php
(7.75 KB)
📄
adodb-mssqlnative.inc.php
(35.32 KB)
📄
adodb-mssqlpo.inc.php
(1.41 KB)
📄
adodb-mysqli.inc.php
(52.6 KB)
📄
adodb-netezza.inc.php
(5.12 KB)
📄
adodb-oci8.inc.php
(47.65 KB)
📄
adodb-oci805.inc.php
(1.79 KB)
📄
adodb-oci8po.inc.php
(7.12 KB)
📄
adodb-oci8quercus.inc.php
(2.3 KB)
📄
adodb-odbc.inc.php
(18.56 KB)
📄
adodb-odbc_db2.inc.php
(6.87 KB)
📄
adodb-odbc_mssql.inc.php
(12.34 KB)
📄
adodb-odbc_mssql2012.inc.php
(1.08 KB)
📄
adodb-odbc_oracle.inc.php
(3.34 KB)
📄
adodb-odbtp.inc.php
(23.25 KB)
📄
adodb-odbtp_unicode.inc.php
(1.42 KB)
📄
adodb-oracle.inc.php
(9.39 KB)
📄
adodb-pdo.inc.php
(20.93 KB)
📄
adodb-pdo_dblib.inc.php
(5.8 KB)
📄
adodb-pdo_firebird.inc.php
(10.33 KB)
📄
adodb-pdo_mssql.inc.php
(1.84 KB)
📄
adodb-pdo_mysql.inc.php
(9.75 KB)
📄
adodb-pdo_oci.inc.php
(3.41 KB)
📄
adodb-pdo_pgsql.inc.php
(10.2 KB)
📄
adodb-pdo_sqlite.inc.php
(6.33 KB)
📄
adodb-pdo_sqlsrv.inc.php
(4.42 KB)
📄
adodb-postgres.inc.php
(1008 B)
📄
adodb-postgres64.inc.php
(31.63 KB)
📄
adodb-postgres7.inc.php
(9.27 KB)
📄
adodb-postgres8.inc.php
(2.1 KB)
📄
adodb-postgres9.inc.php
(1.13 KB)
📄
adodb-proxy.inc.php
(1.12 KB)
📄
adodb-sapdb.inc.php
(5 KB)
📄
adodb-sqlanywhere.inc.php
(3.43 KB)
📄
adodb-sqlite.inc.php
(11.83 KB)
📄
adodb-sqlite3.inc.php
(18.66 KB)
📄
adodb-sqlitepo.inc.php
(2.05 KB)
📄
adodb-sybase.inc.php
(12.19 KB)
📄
adodb-sybase_ase.inc.php
(3.5 KB)
📄
adodb-text.inc.php
(8.14 KB)
📄
adodb-vfp.inc.php
(2.6 KB)
Editing: adodb-postgres7.inc.php
<?php /** * ADOdb PostgreSQL 7 driver * * This file is part of ADOdb, a Database Abstraction Layer library for PHP. * * @package ADOdb * @link https://adodb.org Project's web site and documentation * @link https://github.com/ADOdb/ADOdb Source code and issue tracker * * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option, * any later version. This means you can use it in proprietary products. * See the LICENSE.md file distributed with this source code for details. * @license BSD-3-Clause * @license LGPL-2.1-or-later * * @copyright 2000-2013 John Lim * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community */ // security - hide paths if (!defined('ADODB_DIR')) die(); include_once(ADODB_DIR."/drivers/adodb-postgres64.inc.php"); class ADODB_postgres7 extends ADODB_postgres64 { var $databaseType = 'postgres7'; var $hasLimit = true; // set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 var $ansiOuter = true; var $charSet = true; //set to true for Postgres 7 and above - PG client supports encodings // Richard 3/18/2012 - Modified SQL to return SERIAL type correctly AS old driver no longer return SERIAL as data type. var $metaColumnsSQL = " SELECT a.attname, CASE WHEN x.sequence_name != '' THEN 'SERIAL' ELSE t.typname END AS typname, a.attlen, a.atttypmod, a.attnotnull, a.atthasdef, a.attnum FROM pg_class c, pg_attribute a JOIN pg_type t ON a.atttypid = t.oid LEFT JOIN ( SELECT c.relname as sequence_name, c1.relname as related_table, a.attname as related_column FROM pg_class c JOIN pg_depend d ON d.objid = c.oid LEFT JOIN pg_class c1 ON d.refobjid = c1.oid LEFT JOIN pg_attribute a ON (d.refobjid, d.refobjsubid) = (a.attrelid, a.attnum) WHERE c.relkind = 'S' AND c1.relname = '%s' ) x ON x.related_column= a.attname WHERE c.relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) AND a.attname not like '....%%' AND a.attnum > 0 AND a.attrelid = c.oid ORDER BY a.attnum"; // used when schema defined var $metaColumnsSQL1 = " SELECT a.attname, CASE WHEN x.sequence_name != '' THEN 'SERIAL' ELSE t.typname END AS typname, a.attlen, a.atttypmod, a.attnotnull, a.atthasdef, a.attnum FROM pg_class c, pg_namespace n, pg_attribute a JOIN pg_type t ON a.atttypid = t.oid LEFT JOIN ( SELECT c.relname as sequence_name, c1.relname as related_table, a.attname as related_column FROM pg_class c JOIN pg_depend d ON d.objid = c.oid LEFT JOIN pg_class c1 ON d.refobjid = c1.oid LEFT JOIN pg_attribute a ON (d.refobjid, d.refobjsubid) = (a.attrelid, a.attnum) WHERE c.relkind = 'S' AND c1.relname = '%s' ) x ON x.related_column= a.attname WHERE c.relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) AND c.relnamespace=n.oid and n.nspname='%s' AND a.attname not like '....%%' AND a.attnum > 0 AND a.atttypid = t.oid AND a.attrelid = c.oid ORDER BY a.attnum"; function __construct() { parent::__construct(); if (ADODB_ASSOC_CASE !== ADODB_ASSOC_CASE_NATIVE) { $this->rsPrefix .= 'assoc_'; } $this->_bindInputArray = true; } // the following should be compat with postgresql 7.2, // which makes obsolete the LIMIT limit,offset syntax function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) { $nrows = (int) $nrows; $offset = (int) $offset; $offsetStr = ($offset >= 0) ? " OFFSET ".((integer)$offset) : ''; $limitStr = ($nrows >= 0) ? " LIMIT ".((integer)$nrows) : ''; if ($secs2cache) $rs = $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr); else $rs = $this->Execute($sql."$limitStr$offsetStr",$inputarr); return $rs; } /* function Prepare($sql) { $info = $this->ServerInfo(); if ($info['version']>=7.3) { return array($sql,false); } return $sql; } */ /** * Generate the SQL to retrieve MetaColumns data * @param string $table Table name * @param string $schema Schema name (can be blank) * @return string SQL statement to execute */ protected function _generateMetaColumnsSQL($table, $schema) { if ($schema) { return sprintf($this->metaColumnsSQL1, $table, $table, $table, $schema); } else { return sprintf($this->metaColumnsSQL, $table, $table, $schema); } } public function metaForeignKeys($table, $owner = '', $upper = false, $associative = false) { # Regex isolates the 2 terms between parenthesis using subexpressions $regex = '^.*\((.*)\).*\((.*)\).*$'; $sql=" SELECT lookup_table, regexp_replace(consrc, '$regex', '\\2') AS lookup_field, dep_table, regexp_replace(consrc, '$regex', '\\1') AS dep_field FROM ( SELECT pg_get_constraintdef(c.oid) AS consrc, t.relname AS dep_table, ft.relname AS lookup_table FROM pg_constraint c JOIN pg_class t ON (t.oid = c.conrelid) JOIN pg_class ft ON (ft.oid = c.confrelid) JOIN pg_namespace nft ON (nft.oid = ft.relnamespace) LEFT JOIN pg_description ds ON (ds.objoid = c.oid) JOIN pg_namespace n ON (n.oid = t.relnamespace) WHERE c.contype = 'f'::\"char\" ORDER BY t.relname, n.nspname, c.conname, c.oid ) constraints WHERE dep_table='".strtolower($table)."' ORDER BY lookup_table, dep_table, dep_field"; $rs = $this->Execute($sql); if (!$rs || $rs->EOF) return false; $a = array(); while (!$rs->EOF) { $lookup_table = $rs->fields('lookup_table'); $fields = $rs->fields('dep_field') . '=' . $rs->fields('lookup_field'); if ($upper) { $lookup_table = strtoupper($lookup_table); $fields = strtoupper($fields); } $a[$lookup_table][] = str_replace('"','', $fields); $rs->MoveNext(); } return $a; } function _query($sql,$inputarr=false) { if (! $this->_bindInputArray) { // We don't have native support for parameterized queries, so let's emulate it at the parent return ADODB_postgres64::_query($sql, $inputarr); } $this->_pnum = 0; $this->_errorMsg = false; // -- added Cristiano da Cunha Duarte if ($inputarr) { $sqlarr = explode('?',trim($sql)); $sql = ''; $i = 1; $last = sizeof($sqlarr)-1; foreach($sqlarr as $v) { if ($last < $i) $sql .= $v; else $sql .= $v.' $'.$i; $i++; } $rez = pg_query_params($this->_connectionID,$sql, $inputarr); } else { $rez = pg_query($this->_connectionID,$sql); } // check if no data returned, then no need to create real recordset if ($rez && pg_num_fields($rez) <= 0) { if ($this->_resultid !== false) { pg_free_result($this->_resultid); } $this->_resultid = $rez; return true; } return $rez; } /** * Retrieve the client connection's current character set. * If no charsets were compiled into the server, the function will always * return 'SQL_ASCII'. * @see https://www.php.net/manual/en/function.pg-client-encoding.php * * @return string|false The character set, or false if it can't be determined. */ function getCharSet() { if (!$this->_connectionID) { return false; } $this->charSet = pg_client_encoding($this->_connectionID); return $this->charSet ?: false; } /** * Sets the client-side character set (encoding). * * Allows managing client encoding - very important if the database and * the output target (i.e. HTML) don't match; for instance, you may have a * UNICODE database and server your pages as WIN1251, etc. * * Supported on PostgreSQL 7.0 and above. Available charsets depend on * PostgreSQL version and the distribution's compile flags. * * @param string $charset The character set to switch to. * * @return bool True if the character set was changed successfully, false otherwise. */ function setCharSet($charset) { if ($this->charSet !== $charset) { if (!$this->_connectionID || pg_set_client_encoding($this->_connectionID, $charset) != 0) { return false; } $this->getCharSet(); } return true; } } /*-------------------------------------------------------------------------------------- Class Name: Recordset --------------------------------------------------------------------------------------*/ class ADORecordSet_postgres7 extends ADORecordSet_postgres64{ var $databaseType = "postgres7"; // 10% speedup to move MoveNext to child class function MoveNext() { if (!$this->EOF) { $this->_currentRow++; if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) { $this->_prepfields(); if ($this->fields !== false) { return true; } } $this->fields = false; $this->EOF = true; } return false; } } class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{ var $databaseType = "postgres7"; function _fetch() { if ($this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0) { return false; } $this->_prepfields(); if ($this->fields !== false) { $this->_updatefields(); return true; } return false; } function MoveNext() { if (!$this->EOF) { $this->_currentRow++; if ($this->_numOfRows < 0 || $this->_numOfRows > $this->_currentRow) { $this->_prepfields(); if ($this->fields !== false) { $this->_updatefields(); return true; } } $this->fields = false; $this->EOF = true; } return false; } }
Upload File
Create Folder