├── scripts ├── .gitignore ├── TARADO5.BAT └── uploadrelease.py ├── docs ├── adodb.gif └── adodb2.gif ├── cute_icons_for_site ├── adodb.gif └── adodb2.gif ├── .gitignore ├── .mailmap ├── .gitattributes ├── session ├── adodb-sessions.oracle.clob.sql ├── adodb-sessions.oracle.sql ├── adodb-sessions.mysql.sql ├── adodb-encrypt-sha1.php ├── session_schema.xml ├── adodb-session-clob.php ├── adodb-session-clob2.php ├── adodb-cryptsession.php ├── adodb-cryptsession2.php ├── session_schema2.xml ├── adodb-encrypt-md5.php ├── adodb-encrypt-secret.php ├── old │ └── crypt.inc.php ├── adodb-compress-gzip.php ├── adodb-encrypt-mcrypt.php ├── adodb-compress-bzip2.php └── crypt.inc.php ├── adodb-php4.inc.php ├── tests ├── time.php ├── test2.php ├── testgenid.php ├── test_rs_array.php ├── xmlschema-mssql.xml ├── testcache.php ├── xmlschema.xml ├── test-perf.php ├── testpear.php ├── test3.php ├── test-xmlschema.php ├── test5.php ├── test-active-recs2.php ├── pdo.php ├── tmssql.php ├── test-pgblob.php ├── testmssql.php ├── benchmark.php ├── testpaging.php ├── testoci8.php ├── testsessions.php ├── test-php5.php ├── test-active-relations.php └── testoci8cursor.php ├── pear ├── readme.Auth.txt └── auth_adodb_example.php ├── drivers ├── adodb-postgres.inc.php ├── adodb-postgres9.inc.php ├── adodb-proxy.inc.php ├── adodb-informix.inc.php ├── adodb-pdo_sqlsrv.inc.php ├── adodb-odbtp_unicode.inc.php ├── adodb-ado_access.inc.php ├── adodb-postgres8.inc.php ├── adodb-mssqlpo.inc.php ├── adodb-pdo_mssql.inc.php ├── adodb-oci805.inc.php ├── adodb-db2ora.inc.php ├── adodb-sqlitepo.inc.php ├── adodb-firebird.inc.php ├── adodb-borland_ibase.inc.php ├── adodb-access.inc.php ├── adodb-oci8quercus.inc.php ├── adodb-vfp.inc.php ├── adodb-pdo_oci.inc.php ├── adodb-odbc_oracle.inc.php ├── adodb-mysqlpo.inc.php ├── adodb-sybase_ase.inc.php └── adodb-mysqlt.inc.php ├── composer.json ├── adodb-iterator.inc.php ├── lang ├── adodb-th.inc.php ├── adodb-ar.inc.php ├── adodb-fr.inc.php ├── adodb-cn.inc.php ├── adodb-sv.inc.php ├── adodb-cz.inc.php ├── adodb-fa.inc.php ├── adodb-nl.inc.php ├── adodb-da.inc.php ├── adodb-ro.inc.php ├── adodb-uk.inc.php ├── adodb-eo.inc.php ├── adodb-pl.inc.php ├── adodb-es.inc.php ├── adodb-pt-br.inc.php ├── adodb-hu.inc.php ├── adodb-ru.inc.php ├── adodb-en.inc.php ├── adodb-it.inc.php ├── adodb-ca.inc.php ├── adodb-de.inc.php └── adodb-bg.inc.php ├── xmlschema.dtd ├── xsl ├── remove-0.2.xsl └── remove-0.3.xsl ├── datadict ├── datadict-ibase.inc.php ├── datadict-informix.inc.php ├── datadict-access.inc.php ├── datadict-sqlite.inc.php ├── datadict-generic.inc.php └── datadict-sapdb.inc.php ├── xmlschema03.dtd ├── rsfilter.inc.php ├── perf ├── perf-informix.inc.php └── perf-db2.inc.php ├── adodb-exceptions.inc.php ├── adodb-errorpear.inc.php ├── server.php ├── adodb-errorhandler.inc.php └── toexport.inc.php /scripts/.gitignore: -------------------------------------------------------------------------------- 1 | # Python byte code 2 | *.pyc 3 | -------------------------------------------------------------------------------- /docs/adodb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marinaglancy/ADOdb/master/docs/adodb.gif -------------------------------------------------------------------------------- /docs/adodb2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marinaglancy/ADOdb/master/docs/adodb2.gif -------------------------------------------------------------------------------- /cute_icons_for_site/adodb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marinaglancy/ADOdb/master/cute_icons_for_site/adodb.gif -------------------------------------------------------------------------------- /cute_icons_for_site/adodb2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marinaglancy/ADOdb/master/cute_icons_for_site/adodb2.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE/Editor temporary files 2 | *~ 3 | *.swp 4 | *.bak 5 | *.tmp 6 | .project 7 | .settings/ 8 | /nbproject/ 9 | 10 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | Andreas Fernandez 2 | Mike Benoit MikeB 3 | Mike Benoit mike.benoit 4 | 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Default behavior 2 | * text=auto 3 | 4 | # Text files to be normalized to lf line endings 5 | *.php text 6 | *.htm* text 7 | *.sql text 8 | *.txt text 9 | *.xml text 10 | *.xsl text 11 | 12 | # Windows-only files 13 | *.bat eol=crlf 14 | 15 | # Binary files 16 | *.gif binary 17 | 18 | -------------------------------------------------------------------------------- /session/adodb-sessions.oracle.clob.sql: -------------------------------------------------------------------------------- 1 | -- $CVSHeader$ 2 | 3 | DROP TABLE adodb_sessions; 4 | 5 | CREATE TABLE sessions ( 6 | sesskey CHAR(32) DEFAULT '' NOT NULL, 7 | expiry INT DEFAULT 0 NOT NULL, 8 | expireref VARCHAR(64) DEFAULT '', 9 | data CLOB DEFAULT '', 10 | PRIMARY KEY (sesskey) 11 | ); 12 | 13 | CREATE INDEX ix_expiry ON sessions (expiry); 14 | 15 | QUIT; 16 | -------------------------------------------------------------------------------- /session/adodb-sessions.oracle.sql: -------------------------------------------------------------------------------- 1 | -- $CVSHeader$ 2 | 3 | DROP TABLE adodb_sessions; 4 | 5 | CREATE TABLE sessions ( 6 | sesskey CHAR(32) DEFAULT '' NOT NULL, 7 | expiry INT DEFAULT 0 NOT NULL, 8 | expireref VARCHAR(64) DEFAULT '', 9 | data VARCHAR(4000) DEFAULT '', 10 | PRIMARY KEY (sesskey), 11 | INDEX expiry (expiry) 12 | ); 13 | 14 | CREATE INDEX ix_expiry ON sessions (expiry); 15 | 16 | QUIT; 17 | -------------------------------------------------------------------------------- /session/adodb-sessions.mysql.sql: -------------------------------------------------------------------------------- 1 | -- $CVSHeader$ 2 | 3 | CREATE DATABASE /*! IF NOT EXISTS */ adodb_sessions; 4 | 5 | USE adodb_sessions; 6 | 7 | DROP TABLE /*! IF EXISTS */ sessions; 8 | 9 | CREATE TABLE /*! IF NOT EXISTS */ sessions ( 10 | sesskey CHAR(32) /*! BINARY */ NOT NULL DEFAULT '', 11 | expiry INT(11) /*! UNSIGNED */ NOT NULL DEFAULT 0, 12 | expireref VARCHAR(64) DEFAULT '', 13 | data LONGTEXT DEFAULT '', 14 | PRIMARY KEY (sesskey), 15 | INDEX expiry (expiry) 16 | ); 17 | -------------------------------------------------------------------------------- /adodb-php4.inc.php: -------------------------------------------------------------------------------- 1 | encrypt($data, $key); 17 | 18 | } 19 | 20 | 21 | function read($data, $key) 22 | { 23 | $sha1crypt = new SHA1Crypt(); 24 | return $sha1crypt->decrypt($data, $key); 25 | 26 | } 27 | } 28 | 29 | 30 | 31 | return 1; 32 | -------------------------------------------------------------------------------- /tests/time.php: -------------------------------------------------------------------------------- 1 | 6 | " ); 16 | echo( "Converted: $convertedDate" ); //why is string returned as one day (3 not 4) less for this example?? 17 | -------------------------------------------------------------------------------- /pear/readme.Auth.txt: -------------------------------------------------------------------------------- 1 | From: Rich Tango-Lowy (richtl#arscognita.com) 2 | Date: Sat, May 29, 2004 11:20 am 3 | 4 | OK, I hacked out an ADOdb container for PEAR-Auth. The error handling's 5 | a bit of a mess, but all the methods work. 6 | 7 | Copy ADOdb.php to your pear/Auth/Container/ directory. 8 | 9 | Use the ADOdb container exactly as you would the DB 10 | container, but specify 'ADOdb' instead of 'DB': 11 | 12 | $dsn = "mysql://myuser:mypass@localhost/authdb"; 13 | $a = new Auth("ADOdb", $dsn, "loginFunction"); 14 | 15 | 16 | ------------------- 17 | 18 | John Lim adds: 19 | 20 | See http://pear.php.net/manual/en/package.authentication.php 21 | -------------------------------------------------------------------------------- /session/session_schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | table for ADOdb session-management 5 | 6 | 7 | session key 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 | -------------------------------------------------------------------------------- /tests/test2.php: -------------------------------------------------------------------------------- 1 | debug=1; 9 | $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; 10 | $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;' 11 | . 'DATA SOURCE=' . $access . ';'; 12 | 13 | echo "

PHP ",PHP_VERSION,"

"; 14 | 15 | $db->Connect($myDSN) || die('fail'); 16 | 17 | print_r($db->ServerInfo()); 18 | 19 | try { 20 | $rs = $db->Execute("select $db->sysTimeStamp,* from adoxyz where id>02xx"); 21 | print_r($rs->fields); 22 | } catch(exception $e) { 23 | print_r($e); 24 | echo "

Date m/d/Y =",$db->UserDate($rs->fields[4],'m/d/Y'); 25 | } 26 | -------------------------------------------------------------------------------- /drivers/adodb-postgres.inc.php: -------------------------------------------------------------------------------- 1 | =5.3.2" 31 | }, 32 | 33 | "autoload" : { 34 | "files" : ["adodb.inc.php"] 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /pear/auth_adodb_example.php: -------------------------------------------------------------------------------- 1 | 7 |

8 | 9 | 10 | 11 |
12 | $dsn, 'table' => 'auth', 'cryptType' => 'none', 18 | 'usernamecol' => 'username', 'passwordcol' => 'password'); 19 | $a = new Auth("ADOdb", $params, "loginFunction"); 20 | $a->start(); 21 | 22 | if ($a->getAuth()) { 23 | echo "Success"; 24 | // * The output of your site goes here. 25 | } 26 | -------------------------------------------------------------------------------- /tests/testgenid.php: -------------------------------------------------------------------------------- 1 | Execute("drop table $table"); 17 | //$db->debug=true; 18 | 19 | $ctr = 5000; 20 | $lastnum = 0; 21 | 22 | while (--$ctr >= 0) { 23 | $num = $db->GenID($table); 24 | if ($num === false) { 25 | print "GenID returned false"; 26 | break; 27 | } 28 | if ($lastnum + 1 == $num) print " $num "; 29 | else { 30 | print " $num "; 31 | flush(); 32 | } 33 | $lastnum = $num; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /session/session_schema2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | table for ADOdb session-management 5 | 6 | 7 | session key 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 | -------------------------------------------------------------------------------- /tests/test_rs_array.php: -------------------------------------------------------------------------------- 1 | InitArray($array,$typearr); 17 | 18 | while (!$rs->EOF) { 19 | print_r($rs->fields);echo "
"; 20 | $rs->MoveNext(); 21 | } 22 | 23 | echo "
1 Seek
"; 24 | $rs->Move(1); 25 | while (!$rs->EOF) { 26 | print_r($rs->fields);echo "
"; 27 | $rs->MoveNext(); 28 | } 29 | 30 | echo "
2 Seek
"; 31 | $rs->Move(2); 32 | while (!$rs->EOF) { 33 | print_r($rs->fields);echo "
"; 34 | $rs->MoveNext(); 35 | } 36 | 37 | echo "
3 Seek
"; 38 | $rs->Move(3); 39 | while (!$rs->EOF) { 40 | print_r($rs->fields);echo "
"; 41 | $rs->MoveNext(); 42 | } 43 | 44 | 45 | 46 | die(); 47 | -------------------------------------------------------------------------------- /adodb-iterator.inc.php: -------------------------------------------------------------------------------- 1 | Execute("select * from adoxyz"); 17 | foreach($rs as $k => $v) { 18 | echo $k; print_r($v); echo "
"; 19 | } 20 | 21 | 22 | Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2 23 | 24 | 25 | Moved to adodb.inc.php to improve performance. 26 | */ 27 | -------------------------------------------------------------------------------- /drivers/adodb-postgres9.inc.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | id 15 | 16 | 17 | id 18 | 19 | 20 | 21 |
22 | 23 | SQL to be executed only on specific platforms 24 | 25 | insert into mytable ( row1, row2 ) values ( 12, 'postgres stuff' ) 26 | 27 | 28 | insert into mytable ( row1, row2 ) values ( 12, 'mysql stuff' ) 29 | 30 | 31 | INSERT into simple_table ( name, description ) values ( '12', 'Microsoft stuff' ) 32 | 33 | 34 |
-------------------------------------------------------------------------------- /tests/testcache.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | PConnect('nwind'); 22 | } else { 23 | $db = ADONewConnection('mysql'); 24 | $db->PConnect('mangrove','root','','xphplens'); 25 | } 26 | if (isset($cache)) $rs = $db->CacheExecute(120,'select * from products'); 27 | else $rs = $db->Execute('select * from products'); 28 | 29 | $arr = $rs->GetArray(); 30 | print sizeof($arr); 31 | -------------------------------------------------------------------------------- /drivers/adodb-proxy.inc.php: -------------------------------------------------------------------------------- 1 | encrypt($data, $key); 28 | } 29 | 30 | /** 31 | */ 32 | function read($data, $key) { 33 | $md5crypt = new MD5Crypt(); 34 | return $md5crypt->decrypt($data, $key); 35 | } 36 | 37 | } 38 | 39 | return 1; 40 | -------------------------------------------------------------------------------- /tests/xmlschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | An integer row that's a primary key and autoincrements 6 | 7 | 8 | 9 | 10 | A 16 character varchar row that can't be null 11 | 12 | 13 | 14 | row1 15 | row2 16 | 17 |
18 | 19 | SQL to be executed only on specific platforms 20 | 21 | insert into mytable ( row1, row2 ) values ( 12, 'postgres stuff' ) 22 | 23 | 24 | insert into mytable ( row1, row2 ) values ( 12, 'mysql stuff' ) 25 | 26 | 27 | insert into mytable ( row1, row2 ) values ( 12, 'Microsoft stuff' ) 28 | 29 | 30 | 31 | 32 |
33 |
-------------------------------------------------------------------------------- /tests/test-perf.php: -------------------------------------------------------------------------------- 1 | $v) { 10 | if (strncmp($k,'test',4) == 0) $_SESSION['_db'] = $k; 11 | } 12 | } 13 | 14 | if (isset($_SESSION['_db'])) { 15 | $_db = $_SESSION['_db']; 16 | $_GET[$_db] = 1; 17 | $$_db = 1; 18 | } 19 | 20 | echo "

Performance Monitoring

"; 21 | include_once('testdatabases.inc.php'); 22 | 23 | 24 | function testdb($db) 25 | { 26 | if (!$db) return; 27 | echo "";print_r($db->ServerInfo()); echo " user=".$db->user.""; 28 | 29 | $perf = NewPerfMonitor($db); 30 | 31 | # unit tests 32 | if (0) { 33 | //$DB->debug=1; 34 | echo "Data Cache Size=".$perf->DBParameter('data cache size').'

'; 35 | echo $perf->HealthCheck(); 36 | echo($perf->SuspiciousSQL()); 37 | echo($perf->ExpensiveSQL()); 38 | echo($perf->InvalidSQL()); 39 | echo $perf->Tables(); 40 | 41 | echo "

";
42 | 		echo $perf->HealthCheckCLI();
43 | 		$perf->Poll(3);
44 | 		die();
45 | 	}
46 | 
47 | 	if ($perf) $perf->UI(3);
48 | }
49 | 


--------------------------------------------------------------------------------
/tests/testpear.php:
--------------------------------------------------------------------------------
 1 | setFetchMode(ADODB_FETCH_ASSOC);
27 | $rs = $db->Query('select firstname,lastname from adoxyz');
28 | $cnt = 0;
29 | while ($arr = $rs->FetchRow()) {
30 | 	print_r($arr);
31 | 	print "
"; 32 | $cnt += 1; 33 | } 34 | 35 | if ($cnt != 50) print "Error in \$cnt = $cnt"; 36 | -------------------------------------------------------------------------------- /tests/test3.php: -------------------------------------------------------------------------------- 1 | Connect('','scott','natsoft'); 23 | $db->debug=1; 24 | 25 | $cnt = $db->GetOne("select count(*) from adoxyz"); 26 | $rs = $db->Execute("select * from adoxyz order by id"); 27 | 28 | $i = 0; 29 | foreach($rs as $k => $v) { 30 | $i += 1; 31 | echo $k; adodb_pr($v); 32 | flush(); 33 | } 34 | 35 | if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n"); 36 | 37 | 38 | 39 | $rs = $db->Execute("select bad from badder"); 40 | 41 | } catch (exception $e) { 42 | adodb_pr($e); 43 | $e = adodb_backtrace($e->trace); 44 | } 45 | -------------------------------------------------------------------------------- /drivers/adodb-informix.inc.php: -------------------------------------------------------------------------------- 1 | hasTransactions = true; 16 | $parentDriver->_bindInputArray = true; 17 | $parentDriver->hasInsertID = true; 18 | $parentDriver->fmtTimeStamp = "'Y-m-d H:i:s'"; 19 | $parentDriver->fmtDate = "'Y-m-d'"; 20 | } 21 | 22 | function BeginTrans() 23 | { 24 | $returnval = parent::BeginTrans(); 25 | return $returnval; 26 | } 27 | 28 | function MetaColumns($table, $normalize = true) 29 | { 30 | return false; 31 | } 32 | 33 | function MetaTables($ttype = false, $showSchema = false, $mask = false) 34 | { 35 | return false; 36 | } 37 | 38 | function SelectLimit($sql, $nrows = -1, $offset = -1, $inputarr = false, $secs2cache = 0) 39 | { 40 | $ret = ADOConnection::SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache); 41 | return $ret; 42 | } 43 | 44 | function ServerInfo() 45 | { 46 | return ADOConnection::ServerInfo(); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /session/adodb-encrypt-secret.php: -------------------------------------------------------------------------------- 1 | 14 | 15 | // security - hide paths 16 | if (!defined('ADODB_DIR')) die(); 17 | 18 | /* 19 | Because the ODBTP server sends and reads UNICODE text data using UTF-8 20 | encoding, the following HTML meta tag must be included within the HTML 21 | head section of every HTML form and script page: 22 | 23 | 24 | 25 | Also, all SQL query strings must be submitted as UTF-8 encoded text. 26 | */ 27 | 28 | if (!defined('_ADODB_ODBTP_LAYER')) { 29 | include(ADODB_DIR."/drivers/adodb-odbtp.inc.php"); 30 | } 31 | 32 | class ADODB_odbtp_unicode extends ADODB_odbtp { 33 | var $databaseType = 'odbtp'; 34 | var $_useUnicodeSQL = true; 35 | } 36 | -------------------------------------------------------------------------------- /scripts/TARADO5.BAT: -------------------------------------------------------------------------------- 1 | @rem REQUIRES P:\INSTALLS\CMDUTILS 2 | 3 | echo Don't forget to strip LF's !!!!!!!!!!! 4 | pause 5 | 6 | 7 | set VER=518a 8 | 9 | d: 10 | cd \inetpub\wwwroot\php 11 | 12 | @del /s /q zadodb\*.* 13 | @mkdir zadodb 14 | 15 | @REM not for release -- make sure in VSS 16 | attrib -r adodb5\drivers\adodb-text.inc.php 17 | del adodb5\*.bak 18 | del adodb5\drivers\*.bak 19 | del adodb5\hs~*.* 20 | del adodb5\drivers\hs~*.* 21 | del adodb5\tests\hs~*.* 22 | del adodb5\drivers\adodb-text.inc.php 23 | del adodb5\.#* 24 | del adodb5\replicate\replicate-steps.php 25 | del adodb5\replicate\test*.php 26 | del adodb5\adodb-lite.inc.php 27 | attrib -r adodb5\*.php 28 | del adodb5\cute_icons_for_site\*.png 29 | 30 | del tmp.tar 31 | del adodb5*.tgz 32 | del adodb5*.zip 33 | 34 | @mkdir adodb5\docs 35 | move /y adodb5\*.htm adodb5\docs 36 | 37 | @rem CREATE TAR FILE 38 | tar -f adodb%VER%.tar -c adodb5/*.* adodb5/perf/*.* adodb5/session/*.* adodb5/pear/*.txt adodb5/pear/Auth/Container/ADOdb.php adodb5/session/old/*.* adodb5/drivers/*.* adodb5/lang/*.* adodb5/tests/*.* adodb5/cute_icons_for_site/*.* adodb5/datadict/*.* adodb5/contrib/*.* adodb5/xsl/*.* adodb5/docs/*.* 39 | 40 | @rem CREATE ZIP FILE 41 | cd zadodb 42 | tar -xf ..\adodb%VER%.TAR 43 | zip -r ..\adodb%VER%.zip adodb5 44 | cd .. 45 | 46 | @rem CREATE TGZ FILE, THE RENAME CHANGES UPPERCASE TO LOWERCASE 47 | gzip -v ADODB%VER%.tar -S .tgz -9 48 | rename ADODB%VER%.tar.TGZ adodb%VER%.tgz 49 | 50 | -------------------------------------------------------------------------------- /lang/adodb-th.inc.php: -------------------------------------------------------------------------------- 1 | 3 | $ADODB_LANG_ARRAY = array ( 4 | 'LANG' => 'th', 5 | DB_ERROR => 'error ไม่รู้สาเหตุ', 6 | DB_ERROR_ALREADY_EXISTS => 'มี�?ล้ว', 7 | DB_ERROR_CANNOT_CREATE => 'สร้างไม่ได้', 8 | DB_ERROR_CANNOT_DELETE => 'ลบไม่ได้', 9 | DB_ERROR_CANNOT_DROP => 'drop ไม่ได้', 10 | DB_ERROR_CONSTRAINT => 'constraint violation', 11 | DB_ERROR_DIVZERO => 'หา�?ด้วยสู�?', 12 | DB_ERROR_INVALID => 'ไม่ valid', 13 | DB_ERROR_INVALID_DATE => 'วันที่ เวลา ไม่ valid', 14 | DB_ERROR_INVALID_NUMBER => 'เลขไม่ valid', 15 | DB_ERROR_MISMATCH => 'mismatch', 16 | DB_ERROR_NODBSELECTED => 'ไม่ได้เลือ�?�?านข้อมูล', 17 | DB_ERROR_NOSUCHFIELD => 'ไม่มีฟีลด์นี้', 18 | DB_ERROR_NOSUCHTABLE => 'ไม่มีตารางนี้', 19 | DB_ERROR_NOT_CAPABLE => 'DB backend not capable', 20 | DB_ERROR_NOT_FOUND => 'ไม่พบ', 21 | DB_ERROR_NOT_LOCKED => 'ไม่ได้ล๊อ�?', 22 | DB_ERROR_SYNTAX => 'ผิด syntax', 23 | DB_ERROR_UNSUPPORTED => 'ไม่ support', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row', 25 | DB_ERROR_INVALID_DSN => 'invalid DSN', 26 | DB_ERROR_CONNECT_FAILED => 'ไม่สามารถ connect', 27 | 0 => 'no error', 28 | DB_ERROR_NEED_MORE_DATA => 'ข้อมูลไม่เพียงพอ', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'ไม่พบ extension', 30 | DB_ERROR_NOSUCHDB => 'ไม่มีข้อมูลนี้', 31 | DB_ERROR_ACCESS_VIOLATION => 'permissions ไม่พอ' 32 | ); 33 | -------------------------------------------------------------------------------- /tests/test-xmlschema.php: -------------------------------------------------------------------------------- 1 | Connect( 'localhost', 'root', '', 'test' ) || die('fail connect1'); 12 | 13 | // To create a schema object and build the query array. 14 | $schema = new adoSchema( $db ); 15 | 16 | // To upgrade an existing schema object, use the following 17 | // To upgrade an existing database to the provided schema, 18 | // uncomment the following line: 19 | #$schema->upgradeSchema(); 20 | 21 | print "SQL to build xmlschema.xml:\n
";
22 | // Build the SQL array
23 | $sql = $schema->ParseSchema( "xmlschema.xml" );
24 | 
25 | var_dump( $sql );
26 | print "
\n"; 27 | 28 | // Execute the SQL on the database 29 | //$result = $schema->ExecuteSchema( $sql ); 30 | 31 | // Finally, clean up after the XML parser 32 | // (PHP won't do this for you!) 33 | //$schema->Destroy(); 34 | 35 | 36 | 37 | print "SQL to build xmlschema-mssql.xml:\n
";
38 | 
39 | $db2 = ADONewConnection('mssql');
40 | $db2->Connect('','adodb','natsoft','northwind') || die("Fail 2");
41 | 
42 | $db2->Execute("drop table simple_table");
43 | 
44 | $schema = new adoSchema( $db2 );
45 | $sql = $schema->ParseSchema( "xmlschema-mssql.xml" );
46 | 
47 | print_r( $sql );
48 | print "
\n"; 49 | 50 | $db2->debug=1; 51 | 52 | foreach ($sql as $s) 53 | $db2->Execute($s); 54 | -------------------------------------------------------------------------------- /xmlschema.dtd: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | ] > -------------------------------------------------------------------------------- /lang/adodb-ar.inc.php: -------------------------------------------------------------------------------- 1 | 3 | $ADODB_LANG_ARRAY = array ( 4 | 'LANG' => 'ar', 5 | DB_ERROR => 'خطأ غير محدد', 6 | DB_ERROR_ALREADY_EXISTS => 'موجود مسبقا', 7 | DB_ERROR_CANNOT_CREATE => 'لا يمكن إنشاء', 8 | DB_ERROR_CANNOT_DELETE => 'لا يمكن حذف', 9 | DB_ERROR_CANNOT_DROP => 'لا يمكن حذف', 10 | DB_ERROR_CONSTRAINT => 'عملية إدخال ممنوعة', 11 | DB_ERROR_DIVZERO => 'عملية التقسيم على صفر', 12 | DB_ERROR_INVALID => 'غير صحيح', 13 | DB_ERROR_INVALID_DATE => 'صيغة وقت أو تاريخ غير صحيحة', 14 | DB_ERROR_INVALID_NUMBER => 'صيغة رقم غير صحيحة', 15 | DB_ERROR_MISMATCH => 'غير متطابق', 16 | DB_ERROR_NODBSELECTED => 'لم يتم إختيار قاعدة البيانات بعد', 17 | DB_ERROR_NOSUCHFIELD => 'ليس هنالك حقل بهذا الاسم', 18 | DB_ERROR_NOSUCHTABLE => 'ليس هنالك جدول بهذا الاسم', 19 | DB_ERROR_NOT_CAPABLE => 'قاعدة البيانات المرتبط بها غير قادرة', 20 | DB_ERROR_NOT_FOUND => 'لم يتم إيجاده', 21 | DB_ERROR_NOT_LOCKED => 'غير مقفول', 22 | DB_ERROR_SYNTAX => 'خطأ في الصيغة', 23 | DB_ERROR_UNSUPPORTED => 'غير مدعوم', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'عدد القيم في السجل', 25 | DB_ERROR_INVALID_DSN => 'DSN غير صحيح', 26 | DB_ERROR_CONNECT_FAILED => 'فشل عملية الإتصال', 27 | 0 => 'ليس هنالك أخطاء', // DB_OK 28 | DB_ERROR_NEED_MORE_DATA => 'البيانات المزودة غير كافية', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'لم يتم إيجاد الإضافة المتعلقة', 30 | DB_ERROR_NOSUCHDB => 'ليس هنالك قاعدة بيانات بهذا الاسم', 31 | DB_ERROR_ACCESS_VIOLATION => 'سماحيات غير كافية' 32 | ); 33 | -------------------------------------------------------------------------------- /drivers/adodb-ado_access.inc.php: -------------------------------------------------------------------------------- 1 | = 5) include(ADODB_DIR."/drivers/adodb-ado5.inc.php"); 21 | else include(ADODB_DIR."/drivers/adodb-ado.inc.php"); 22 | } 23 | 24 | class ADODB_ado_access extends ADODB_ado { 25 | var $databaseType = 'ado_access'; 26 | var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE 27 | var $fmtDate = "#Y-m-d#"; 28 | var $fmtTimeStamp = "#Y-m-d h:i:sA#";// note no comma 29 | var $sysDate = "FORMAT(NOW,'yyyy-mm-dd')"; 30 | var $sysTimeStamp = 'NOW'; 31 | var $upperCase = 'ucase'; 32 | 33 | /*function BeginTrans() { return false;} 34 | 35 | function CommitTrans() { return false;} 36 | 37 | function RollbackTrans() { return false;}*/ 38 | 39 | } 40 | 41 | 42 | class ADORecordSet_ado_access extends ADORecordSet_ado { 43 | 44 | var $databaseType = "ado_access"; 45 | 46 | function __construct($id,$mode=false) 47 | { 48 | return parent::__construct($id,$mode); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /drivers/adodb-postgres8.inc.php: -------------------------------------------------------------------------------- 1 | GetOne("SELECT lastval()") 38 | : $this->GetOne("SELECT currval(pg_get_serial_sequence('$table', '$column'))"); 39 | } 40 | } 41 | 42 | class ADORecordSet_postgres8 extends ADORecordSet_postgres7 43 | { 44 | var $databaseType = "postgres8"; 45 | } 46 | 47 | class ADORecordSet_assoc_postgres8 extends ADORecordSet_assoc_postgres7 48 | { 49 | var $databaseType = "postgres8"; 50 | } 51 | -------------------------------------------------------------------------------- /tests/test5.php: -------------------------------------------------------------------------------- 1 | debug=1; 25 | $conn->PConnect("localhost","root","","xphplens"); 26 | print $conn->databaseType.':'.$conn->GenID().'
'; 27 | } 28 | 29 | if (0) { 30 | $conn = ADONewConnection("oci8"); // create a connection 31 | $conn->debug=1; 32 | $conn->PConnect("falcon", "scott", "tiger", "juris8.ecosystem.natsoft.com.my"); // connect to MySQL, testdb 33 | print $conn->databaseType.':'.$conn->GenID(); 34 | } 35 | 36 | if (0) { 37 | $conn = ADONewConnection("ibase"); // create a connection 38 | $conn->debug=1; 39 | $conn->Connect("localhost:c:\\Interbase\\Examples\\Database\\employee.gdb", "sysdba", "masterkey", ""); // connect to MySQL, testdb 40 | print $conn->databaseType.':'.$conn->GenID().'
'; 41 | } 42 | 43 | if (0) { 44 | $conn = ADONewConnection('postgres'); 45 | $conn->debug=1; 46 | @$conn->PConnect("susetikus","tester","test","test"); 47 | print $conn->databaseType.':'.$conn->GenID().'
'; 48 | } 49 | -------------------------------------------------------------------------------- /xsl/remove-0.2.xsl: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | ADODB XMLSchema 11 | http://adodb-xmlschema.sourceforge.net 12 | 13 | 14 | 15 | Uninstallation Schema 16 | 17 | 18 | 19 | 0.2 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /xsl/remove-0.3.xsl: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | ADODB XMLSchema 11 | http://adodb-xmlschema.sourceforge.net 12 | 13 | 14 | 15 | Uninstallation Schema 16 | 17 | 18 | 19 | 0.3 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /session/old/crypt.inc.php: -------------------------------------------------------------------------------- 1 | 3 | class MD5Crypt{ 4 | function keyED($txt,$encrypt_key) 5 | { 6 | $encrypt_key = md5($encrypt_key); 7 | $ctr=0; 8 | $tmp = ""; 9 | for ($i=0;$ikeyED($tmp,$key)); 31 | } 32 | 33 | function Decrypt($txt,$key) 34 | { 35 | $txt = $this->keyED(base64_decode($txt),$key); 36 | $tmp = ""; 37 | for ($i=0;$i= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96)) 54 | { 55 | $randnumber = rand(48,120); 56 | } 57 | 58 | $randomPassword .= chr($randnumber); 59 | } 60 | return $randomPassword; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /lang/adodb-fr.inc.php: -------------------------------------------------------------------------------- 1 | 'fr', 5 | DB_ERROR => 'erreur inconnue', 6 | DB_ERROR_ALREADY_EXISTS => 'existe déjà', 7 | DB_ERROR_CANNOT_CREATE => 'création impossible', 8 | DB_ERROR_CANNOT_DELETE => 'effacement impossible', 9 | DB_ERROR_CANNOT_DROP => 'suppression impossible', 10 | DB_ERROR_CONSTRAINT => 'violation de contrainte', 11 | DB_ERROR_DIVZERO => 'division par zéro', 12 | DB_ERROR_INVALID => 'invalide', 13 | DB_ERROR_INVALID_DATE => 'date ou heure invalide', 14 | DB_ERROR_INVALID_NUMBER => 'nombre invalide', 15 | DB_ERROR_MISMATCH => 'erreur de concordance', 16 | DB_ERROR_NODBSELECTED => 'pas de base de données sélectionnée', 17 | DB_ERROR_NOSUCHFIELD => 'nom de colonne invalide', 18 | DB_ERROR_NOSUCHTABLE => 'table ou vue inexistante', 19 | DB_ERROR_NOT_CAPABLE => 'fonction optionnelle non installée', 20 | DB_ERROR_NOT_FOUND => 'pas trouvé', 21 | DB_ERROR_NOT_LOCKED => 'non verrouillé', 22 | DB_ERROR_SYNTAX => 'erreur de syntaxe', 23 | DB_ERROR_UNSUPPORTED => 'non supporté', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'valeur insérée trop grande pour colonne', 25 | DB_ERROR_INVALID_DSN => 'DSN invalide', 26 | DB_ERROR_CONNECT_FAILED => 'échec à la connexion', 27 | 0 => "pas d'erreur", // DB_OK 28 | DB_ERROR_NEED_MORE_DATA => 'données fournies insuffisantes', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'extension non trouvée', 30 | DB_ERROR_NOSUCHDB => 'base de données inconnue', 31 | DB_ERROR_ACCESS_VIOLATION => 'droits insuffisants' 32 | ); 33 | -------------------------------------------------------------------------------- /lang/adodb-cn.inc.php: -------------------------------------------------------------------------------- 1 | 'cn', 6 | DB_ERROR => '未知错误', 7 | DB_ERROR_ALREADY_EXISTS => '已经存在', 8 | DB_ERROR_CANNOT_CREATE => '不能创建', 9 | DB_ERROR_CANNOT_DELETE => '不能删除', 10 | DB_ERROR_CANNOT_DROP => '不能丢弃', 11 | DB_ERROR_CONSTRAINT => '约束限制', 12 | DB_ERROR_DIVZERO => '被0除', 13 | DB_ERROR_INVALID => '无效', 14 | DB_ERROR_INVALID_DATE => '无效的日期或者时间', 15 | DB_ERROR_INVALID_NUMBER => '无效的数字', 16 | DB_ERROR_MISMATCH => '不匹配', 17 | DB_ERROR_NODBSELECTED => '没有数据库被选择', 18 | DB_ERROR_NOSUCHFIELD => '没有相应的字段', 19 | DB_ERROR_NOSUCHTABLE => '没有相应的表', 20 | DB_ERROR_NOT_CAPABLE => '数据库后台不兼容', 21 | DB_ERROR_NOT_FOUND => '没有发现', 22 | DB_ERROR_NOT_LOCKED => '没有被锁定', 23 | DB_ERROR_SYNTAX => '语法错误', 24 | DB_ERROR_UNSUPPORTED => '不支持', 25 | DB_ERROR_VALUE_COUNT_ON_ROW => '在行上累计值', 26 | DB_ERROR_INVALID_DSN => '无效的数据源 (DSN)', 27 | DB_ERROR_CONNECT_FAILED => '连接失败', 28 | 0 => '没有错误', // DB_OK 29 | DB_ERROR_NEED_MORE_DATA => '提供的数据不能符合要求', 30 | DB_ERROR_EXTENSION_NOT_FOUND=> '扩展没有被发现', 31 | DB_ERROR_NOSUCHDB => '没有相应的数据库', 32 | DB_ERROR_ACCESS_VIOLATION => '没有合适的权限' 33 | ); 34 | -------------------------------------------------------------------------------- /tests/test-active-recs2.php: -------------------------------------------------------------------------------- 1 | Connect("localhost","tester","test","test"); 19 | } else 20 | $db = NewADOConnection('oci8://scott:natsoft@/'); 21 | 22 | 23 | $arr = $db->ServerInfo(); 24 | echo "

$db->dataProvider: {$arr['description']}

"; 25 | 26 | $arr = $db->GetActiveRecords('products',' productid<10'); 27 | adodb_pr($arr); 28 | 29 | ADOdb_Active_Record::SetDatabaseAdapter($db); 30 | if (!$db) die('failed'); 31 | 32 | 33 | 34 | 35 | $rec = new ADODB_Active_Record('photos'); 36 | 37 | $rec = new ADODB_Active_Record('products'); 38 | 39 | 40 | adodb_pr($rec->getAttributeNames()); 41 | 42 | echo "
"; 43 | 44 | 45 | $rec->load('productid=2'); 46 | adodb_pr($rec); 47 | 48 | $db->debug=1; 49 | 50 | 51 | $rec->productname = 'Changie Chan'.rand(); 52 | 53 | $rec->insert(); 54 | $rec->update(); 55 | 56 | $rec->productname = 'Changie Chan 99'; 57 | $rec->replace(); 58 | 59 | 60 | $rec2 = new ADODB_Active_Record('products'); 61 | $rec->load('productid=3'); 62 | $rec->save(); 63 | 64 | $rec = new ADODB_Active_record('products'); 65 | $rec->productname = 'John ActiveRec'; 66 | $rec->notes = 22; 67 | #$rec->productid=0; 68 | $rec->discontinued=1; 69 | $rec->Save(); 70 | $rec->supplierid=33; 71 | $rec->Save(); 72 | $rec->discontinued=0; 73 | $rec->Save(); 74 | $rec->Delete(); 75 | 76 | echo "

Affected Rows after delete=".$db->Affected_Rows()."

"; 77 | -------------------------------------------------------------------------------- /drivers/adodb-mssqlpo.inc.php: -------------------------------------------------------------------------------- 1 | _has_mssql_init) { 36 | ADOConnection::outp( "PrepareSP: mssql_init only available since PHP 4.1.0"); 37 | return $sql; 38 | } 39 | if (is_string($sql)) $sql = str_replace('||','+',$sql); 40 | $stmt = mssql_init($sql,$this->_connectionID); 41 | if (!$stmt) return $sql; 42 | return array($sql,$stmt); 43 | } 44 | 45 | function _query($sql,$inputarr=false) 46 | { 47 | if (is_string($sql)) $sql = str_replace('||','+',$sql); 48 | return ADODB_mssql::_query($sql,$inputarr); 49 | } 50 | } 51 | 52 | class ADORecordset_mssqlpo extends ADORecordset_mssql { 53 | var $databaseType = "mssqlpo"; 54 | function __construct($id,$mode=false) 55 | { 56 | parent::__construct($id,$mode); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /drivers/adodb-pdo_mssql.inc.php: -------------------------------------------------------------------------------- 1 | hasTransactions = false; ## <<< BUG IN PDO mssql driver 26 | $parentDriver->_bindInputArray = false; 27 | $parentDriver->hasInsertID = true; 28 | } 29 | 30 | function ServerInfo() 31 | { 32 | return ADOConnection::ServerInfo(); 33 | } 34 | 35 | function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) 36 | { 37 | $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); 38 | return $ret; 39 | } 40 | 41 | function SetTransactionMode( $transaction_mode ) 42 | { 43 | $this->_transmode = $transaction_mode; 44 | if (empty($transaction_mode)) { 45 | $this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED'); 46 | return; 47 | } 48 | if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode; 49 | $this->Execute("SET TRANSACTION ".$transaction_mode); 50 | } 51 | 52 | function MetaTables($ttype=false,$showSchema=false,$mask=false) 53 | { 54 | return false; 55 | } 56 | 57 | function MetaColumns($table,$normalize=true) 58 | { 59 | return false; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /datadict/datadict-ibase.inc.php: -------------------------------------------------------------------------------- 1 | debug) ADOConnection::outp("AlterColumnSQL not supported"); 57 | return array(); 58 | } 59 | 60 | 61 | function DropColumnSQL($tabname, $flds, $tableflds='', $tableoptions='') 62 | { 63 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); 64 | return array(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /drivers/adodb-oci805.inc.php: -------------------------------------------------------------------------------- 1 | 0) { 39 | if ($offset > 0) $nrows += $offset; 40 | $sql = "select * from ($sql) where rownum <= $nrows"; 41 | $nrows = -1; 42 | } 43 | */ 44 | 45 | return ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); 46 | } 47 | } 48 | 49 | class ADORecordset_oci805 extends ADORecordset_oci8 { 50 | var $databaseType = "oci805"; 51 | function __construct($id,$mode=false) 52 | { 53 | parent::__construct($id,$mode); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /xmlschema03.dtd: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | ]> -------------------------------------------------------------------------------- /rsfilter.inc.php: -------------------------------------------------------------------------------- 1 | $v) { 33 | $arr[$k] = ucwords($v); 34 | } 35 | } 36 | $rs = RSFilter($rs,'do_ucwords'); 37 | */ 38 | function RSFilter($rs,$fn) 39 | { 40 | if ($rs->databaseType != 'array') { 41 | if (!$rs->connection) return false; 42 | 43 | $rs = $rs->connection->_rs2rs($rs); 44 | } 45 | $rows = $rs->RecordCount(); 46 | for ($i=0; $i < $rows; $i++) { 47 | if (is_array ($fn)) { 48 | $obj = $fn[0]; 49 | $method = $fn[1]; 50 | $obj->$method ($rs->_array[$i],$rs); 51 | } else { 52 | $fn($rs->_array[$i],$rs); 53 | } 54 | 55 | } 56 | if (!$rs->EOF) { 57 | $rs->_currentRow = 0; 58 | $rs->fields = $rs->_array[0]; 59 | } 60 | 61 | return $rs; 62 | } 63 | -------------------------------------------------------------------------------- /lang/adodb-sv.inc.php: -------------------------------------------------------------------------------- 1 | 'en', 5 | DB_ERROR => 'Okänt fel', 6 | DB_ERROR_ALREADY_EXISTS => 'finns redan', 7 | DB_ERROR_CANNOT_CREATE => 'kan inte skapa', 8 | DB_ERROR_CANNOT_DELETE => 'kan inte ta bort', 9 | DB_ERROR_CANNOT_DROP => 'kan inte släppa', 10 | DB_ERROR_CONSTRAINT => 'begränsning kränkt', 11 | DB_ERROR_DIVZERO => 'division med noll', 12 | DB_ERROR_INVALID => 'ogiltig', 13 | DB_ERROR_INVALID_DATE => 'ogiltigt datum eller tid', 14 | DB_ERROR_INVALID_NUMBER => 'ogiltigt tal', 15 | DB_ERROR_MISMATCH => 'felaktig matchning', 16 | DB_ERROR_NODBSELECTED => 'ingen databas vald', 17 | DB_ERROR_NOSUCHFIELD => 'inget sådant fält', 18 | DB_ERROR_NOSUCHTABLE => 'ingen sådan tabell', 19 | DB_ERROR_NOT_CAPABLE => 'DB backend klarar det inte', 20 | DB_ERROR_NOT_FOUND => 'finns inte', 21 | DB_ERROR_NOT_LOCKED => 'inte låst', 22 | DB_ERROR_SYNTAX => 'syntaxfel', 23 | DB_ERROR_UNSUPPORTED => 'stöds ej', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'värde räknat på rad', 25 | DB_ERROR_INVALID_DSN => 'ogiltig DSN', 26 | DB_ERROR_CONNECT_FAILED => 'anslutning misslyckades', 27 | 0 => 'inget fel', // DB_OK 28 | DB_ERROR_NEED_MORE_DATA => 'otillräckligt med data angivet', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'utökning hittades ej', 30 | DB_ERROR_NOSUCHDB => 'ingen sådan databas', 31 | DB_ERROR_ACCESS_VIOLATION => 'otillräckliga rättigheter' 32 | ); 33 | -------------------------------------------------------------------------------- /lang/adodb-cz.inc.php: -------------------------------------------------------------------------------- 1 | 5 | 6 | $ADODB_LANG_ARRAY = array ( 7 | 'LANG' => 'cz', 8 | DB_ERROR => 'neznámá chyba', 9 | DB_ERROR_ALREADY_EXISTS => 'ji? existuje', 10 | DB_ERROR_CANNOT_CREATE => 'nelze vytvo?it', 11 | DB_ERROR_CANNOT_DELETE => 'nelze smazat', 12 | DB_ERROR_CANNOT_DROP => 'nelze odstranit', 13 | DB_ERROR_CONSTRAINT => 'poru?ení omezující podmínky', 14 | DB_ERROR_DIVZERO => 'd?lení nulou', 15 | DB_ERROR_INVALID => 'neplatné', 16 | DB_ERROR_INVALID_DATE => 'neplatné datum nebo ?as', 17 | DB_ERROR_INVALID_NUMBER => 'neplatné ?íslo', 18 | DB_ERROR_MISMATCH => 'nesouhlasí', 19 | DB_ERROR_NODBSELECTED => '?ádná databáze není vybrána', 20 | DB_ERROR_NOSUCHFIELD => 'pole nenalezeno', 21 | DB_ERROR_NOSUCHTABLE => 'tabulka nenalezena', 22 | DB_ERROR_NOT_CAPABLE => 'nepodporováno', 23 | DB_ERROR_NOT_FOUND => 'nenalezeno', 24 | DB_ERROR_NOT_LOCKED => 'nezam?eno', 25 | DB_ERROR_SYNTAX => 'syntaktická chyba', 26 | DB_ERROR_UNSUPPORTED => 'nepodporováno', 27 | DB_ERROR_VALUE_COUNT_ON_ROW => '', 28 | DB_ERROR_INVALID_DSN => 'neplatné DSN', 29 | DB_ERROR_CONNECT_FAILED => 'p?ipojení selhalo', 30 | 0 => 'bez chyb', // DB_OK 31 | DB_ERROR_NEED_MORE_DATA => 'málo zdrojových dat', 32 | DB_ERROR_EXTENSION_NOT_FOUND=> 'roz?í?ení nenalezeno', 33 | DB_ERROR_NOSUCHDB => 'databáze neexistuje', 34 | DB_ERROR_ACCESS_VIOLATION => 'nedostate?ná práva' 35 | ); 36 | -------------------------------------------------------------------------------- /lang/adodb-fa.inc.php: -------------------------------------------------------------------------------- 1 | */ 4 | 5 | $ADODB_LANG_ARRAY = array ( 6 | 'LANG' => 'fa', 7 | DB_ERROR => 'خطای ناشناخته', 8 | DB_ERROR_ALREADY_EXISTS => 'وجود دارد', 9 | DB_ERROR_CANNOT_CREATE => 'امکان create وجود ندارد', 10 | DB_ERROR_CANNOT_DELETE => 'امکان حذف وجود ندارد', 11 | DB_ERROR_CANNOT_DROP => 'امکان drop وجود ندارد', 12 | DB_ERROR_CONSTRAINT => 'نقض شرط', 13 | DB_ERROR_DIVZERO => 'تقسیم بر صفر', 14 | DB_ERROR_INVALID => 'نامعتبر', 15 | DB_ERROR_INVALID_DATE => 'زمان یا تاریخ نامعتبر', 16 | DB_ERROR_INVALID_NUMBER => 'عدد نامعتبر', 17 | DB_ERROR_MISMATCH => 'عدم مطابقت', 18 | DB_ERROR_NODBSELECTED => 'بانک اطلاعاتی انتخاب نشده است', 19 | DB_ERROR_NOSUCHFIELD => 'چنین ستونی وجود ندارد', 20 | DB_ERROR_NOSUCHTABLE => 'چنین جدولی وجود ندارد', 21 | DB_ERROR_NOT_CAPABLE => 'backend بانک اطلاعاتی قادر نیست', 22 | DB_ERROR_NOT_FOUND => 'پیدا نشد', 23 | DB_ERROR_NOT_LOCKED => 'قفل نشده', 24 | DB_ERROR_SYNTAX => 'خطای دستوری', 25 | DB_ERROR_UNSUPPORTED => 'پشتیبانی نمی شود', 26 | DB_ERROR_VALUE_COUNT_ON_ROW => 'شمارش مقادیر روی ردیف', 27 | DB_ERROR_INVALID_DSN => 'DSN نامعتبر', 28 | DB_ERROR_CONNECT_FAILED => 'ارتباط برقرار نشد', 29 | 0 => 'بدون خطا', // DB_OK 30 | DB_ERROR_NEED_MORE_DATA => 'داده ناکافی است', 31 | DB_ERROR_EXTENSION_NOT_FOUND=> 'extension پیدا نشد', 32 | DB_ERROR_NOSUCHDB => 'چنین بانک اطلاعاتی وجود ندارد', 33 | DB_ERROR_ACCESS_VIOLATION => 'حق دسترسی ناکافی' 34 | ); 35 | -------------------------------------------------------------------------------- /lang/adodb-nl.inc.php: -------------------------------------------------------------------------------- 1 | 'nl', 5 | DB_ERROR => 'onbekende fout', 6 | DB_ERROR_ALREADY_EXISTS => 'bestaat al', 7 | DB_ERROR_CANNOT_CREATE => 'kan niet aanmaken', 8 | DB_ERROR_CANNOT_DELETE => 'kan niet wissen', 9 | DB_ERROR_CANNOT_DROP => 'kan niet verwijderen', 10 | DB_ERROR_CONSTRAINT => 'constraint overtreding', 11 | DB_ERROR_DIVZERO => 'poging tot delen door nul', 12 | DB_ERROR_INVALID => 'ongeldig', 13 | DB_ERROR_INVALID_DATE => 'ongeldige datum of tijd', 14 | DB_ERROR_INVALID_NUMBER => 'ongeldig nummer', 15 | DB_ERROR_MISMATCH => 'is incorrect', 16 | DB_ERROR_NODBSELECTED => 'geen database geselecteerd', 17 | DB_ERROR_NOSUCHFIELD => 'onbekend veld', 18 | DB_ERROR_NOSUCHTABLE => 'onbekende tabel', 19 | DB_ERROR_NOT_CAPABLE => 'database systeem is niet tot uitvoer in staat', 20 | DB_ERROR_NOT_FOUND => 'niet gevonden', 21 | DB_ERROR_NOT_LOCKED => 'niet vergrendeld', 22 | DB_ERROR_SYNTAX => 'syntaxis fout', 23 | DB_ERROR_UNSUPPORTED => 'niet ondersteund', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'waarde telling op rij', 25 | DB_ERROR_INVALID_DSN => 'ongeldige DSN', 26 | DB_ERROR_CONNECT_FAILED => 'connectie mislukt', 27 | 0 => 'geen fout', // DB_OK 28 | DB_ERROR_NEED_MORE_DATA => 'onvoldoende data gegeven', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'extensie niet gevonden', 30 | DB_ERROR_NOSUCHDB => 'onbekende database', 31 | DB_ERROR_ACCESS_VIOLATION => 'onvoldoende rechten' 32 | ); 33 | -------------------------------------------------------------------------------- /lang/adodb-da.inc.php: -------------------------------------------------------------------------------- 1 | 'da', 5 | DB_ERROR => 'ukendt fejl', 6 | DB_ERROR_ALREADY_EXISTS => 'eksisterer allerede', 7 | DB_ERROR_CANNOT_CREATE => 'kan ikke oprette', 8 | DB_ERROR_CANNOT_DELETE => 'kan ikke slette', 9 | DB_ERROR_CANNOT_DROP => 'kan ikke droppe', 10 | DB_ERROR_CONSTRAINT => 'begrænsning krænket', 11 | DB_ERROR_DIVZERO => 'division med nul', 12 | DB_ERROR_INVALID => 'ugyldig', 13 | DB_ERROR_INVALID_DATE => 'ugyldig dato eller klokkeslet', 14 | DB_ERROR_INVALID_NUMBER => 'ugyldigt tal', 15 | DB_ERROR_MISMATCH => 'mismatch', 16 | DB_ERROR_NODBSELECTED => 'ingen database valgt', 17 | DB_ERROR_NOSUCHFIELD => 'felt findes ikke', 18 | DB_ERROR_NOSUCHTABLE => 'tabel findes ikke', 19 | DB_ERROR_NOT_CAPABLE => 'DB backend opgav', 20 | DB_ERROR_NOT_FOUND => 'ikke fundet', 21 | DB_ERROR_NOT_LOCKED => 'ikke låst', 22 | DB_ERROR_SYNTAX => 'syntaksfejl', 23 | DB_ERROR_UNSUPPORTED => 'ikke understøttet', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'resulterende antal felter svarer ikke til forespørgslens antal felter', 25 | DB_ERROR_INVALID_DSN => 'ugyldig DSN', 26 | DB_ERROR_CONNECT_FAILED => 'tilslutning mislykkedes', 27 | 0 => 'ingen fejl', // DB_OK 28 | DB_ERROR_NEED_MORE_DATA => 'utilstrækkelige data angivet', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'udvidelse ikke fundet', 30 | DB_ERROR_NOSUCHDB => 'database ikke fundet', 31 | DB_ERROR_ACCESS_VIOLATION => 'utilstrækkelige rettigheder' 32 | ); 33 | -------------------------------------------------------------------------------- /lang/adodb-ro.inc.php: -------------------------------------------------------------------------------- 1 | */ 4 | 5 | $ADODB_LANG_ARRAY = array ( 6 | 'LANG' => 'ro', 7 | DB_ERROR => 'eroare necunoscuta', 8 | DB_ERROR_ALREADY_EXISTS => 'deja exista', 9 | DB_ERROR_CANNOT_CREATE => 'nu se poate creea', 10 | DB_ERROR_CANNOT_DELETE => 'nu se poate sterge', 11 | DB_ERROR_CANNOT_DROP => 'nu se poate executa drop', 12 | DB_ERROR_CONSTRAINT => 'violare de constrain', 13 | DB_ERROR_DIVZERO => 'se divide la zero', 14 | DB_ERROR_INVALID => 'invalid', 15 | DB_ERROR_INVALID_DATE => 'data sau timp invalide', 16 | DB_ERROR_INVALID_NUMBER => 'numar invalid', 17 | DB_ERROR_MISMATCH => 'nepotrivire-mismatch', 18 | DB_ERROR_NODBSELECTED => 'nu exista baza de date selectata', 19 | DB_ERROR_NOSUCHFIELD => 'camp inexistent', 20 | DB_ERROR_NOSUCHTABLE => 'tabela inexistenta', 21 | DB_ERROR_NOT_CAPABLE => 'functie optionala neinstalata', 22 | DB_ERROR_NOT_FOUND => 'negasit', 23 | DB_ERROR_NOT_LOCKED => 'neblocat', 24 | DB_ERROR_SYNTAX => 'eroare de sintaxa', 25 | DB_ERROR_UNSUPPORTED => 'nu e suportat', 26 | DB_ERROR_VALUE_COUNT_ON_ROW => 'valoare prea mare pentru coloana', 27 | DB_ERROR_INVALID_DSN => 'DSN invalid', 28 | DB_ERROR_CONNECT_FAILED => 'conectare esuata', 29 | 0 => 'fara eroare', // DB_OK 30 | DB_ERROR_NEED_MORE_DATA => 'data introduse insuficiente', 31 | DB_ERROR_EXTENSION_NOT_FOUND=> 'extensie negasita', 32 | DB_ERROR_NOSUCHDB => 'nu exista baza de date', 33 | DB_ERROR_ACCESS_VIOLATION => 'permisiuni insuficiente' 34 | ); 35 | -------------------------------------------------------------------------------- /lang/adodb-uk.inc.php: -------------------------------------------------------------------------------- 1 | 'uk', 7 | DB_ERROR => 'невідома помилка', 8 | DB_ERROR_ALREADY_EXISTS => 'вже існує', 9 | DB_ERROR_CANNOT_CREATE => 'неможливо створити', 10 | DB_ERROR_CANNOT_DELETE => 'неможливо видалити', 11 | DB_ERROR_CANNOT_DROP => 'неможливо знищити (drop)', 12 | DB_ERROR_CONSTRAINT => 'порушення умов перевірки', 13 | DB_ERROR_DIVZERO => 'ділення на 0', 14 | DB_ERROR_INVALID => 'неправильно', 15 | DB_ERROR_INVALID_DATE => 'неправильна дата чи час', 16 | DB_ERROR_INVALID_NUMBER => 'неправильне число', 17 | DB_ERROR_MISMATCH => 'помилка', 18 | DB_ERROR_NODBSELECTED => 'не вибрано БД', 19 | DB_ERROR_NOSUCHFIELD => 'не існує поле', 20 | DB_ERROR_NOSUCHTABLE => 'не існує таблиця', 21 | DB_ERROR_NOT_CAPABLE => 'СУБД не в стані', 22 | DB_ERROR_NOT_FOUND => 'не знайдено', 23 | DB_ERROR_NOT_LOCKED => 'не заблоковано', 24 | DB_ERROR_SYNTAX => 'синтаксична помилка', 25 | DB_ERROR_UNSUPPORTED => 'не підтримується', 26 | DB_ERROR_VALUE_COUNT_ON_ROW => 'рахівник значень в стрічці', 27 | DB_ERROR_INVALID_DSN => 'неправильна DSN', 28 | DB_ERROR_CONNECT_FAILED => 'з\'єднання неуспішне', 29 | 0 => 'все гаразд', // DB_OK 30 | DB_ERROR_NEED_MORE_DATA => 'надано недостатньо даних', 31 | DB_ERROR_EXTENSION_NOT_FOUND=> 'розширення не знайдено', 32 | DB_ERROR_NOSUCHDB => 'не існує БД', 33 | DB_ERROR_ACCESS_VIOLATION => 'недостатньо прав доступа' 34 | ); 35 | -------------------------------------------------------------------------------- /lang/adodb-eo.inc.php: -------------------------------------------------------------------------------- 1 | 'eo', 7 | DB_ERROR => 'nekonata eraro', 8 | DB_ERROR_ALREADY_EXISTS => 'jam ekzistas', 9 | DB_ERROR_CANNOT_CREATE => 'maleblas krei', 10 | DB_ERROR_CANNOT_DELETE => 'maleblas elimini', 11 | DB_ERROR_CANNOT_DROP => 'maleblas elimini (drop)', 12 | DB_ERROR_CONSTRAINT => 'rompo de kondiĉoj de provo', 13 | DB_ERROR_DIVZERO => 'divido per 0 (nul)', 14 | DB_ERROR_INVALID => 'malregule', 15 | DB_ERROR_INVALID_DATE => 'malregula dato kaj tempo', 16 | DB_ERROR_INVALID_NUMBER => 'malregula nombro', 17 | DB_ERROR_MISMATCH => 'eraro', 18 | DB_ERROR_NODBSELECTED => 'datumbazo ne elektita', 19 | DB_ERROR_NOSUCHFIELD => 'ne ekzistas kampo', 20 | DB_ERROR_NOSUCHTABLE => 'ne ekzistas tabelo', 21 | DB_ERROR_NOT_CAPABLE => 'DBMS ne povas', 22 | DB_ERROR_NOT_FOUND => 'ne trovita', 23 | DB_ERROR_NOT_LOCKED => 'ne blokita', 24 | DB_ERROR_SYNTAX => 'sintaksa eraro', 25 | DB_ERROR_UNSUPPORTED => 'ne apogata', 26 | DB_ERROR_VALUE_COUNT_ON_ROW => 'nombrilo de valoroj en linio', 27 | DB_ERROR_INVALID_DSN => 'malregula DSN-o', 28 | DB_ERROR_CONNECT_FAILED => 'konekto malsukcesa', 29 | 0 => 'ĉio bone', // DB_OK 30 | DB_ERROR_NEED_MORE_DATA => 'ne sufiĉe da datumo', 31 | DB_ERROR_EXTENSION_NOT_FOUND=> 'etendo ne trovita', 32 | DB_ERROR_NOSUCHDB => 'datumbazo ne ekzistas', 33 | DB_ERROR_ACCESS_VIOLATION => 'ne sufiĉe da rajto por atingo' 34 | ); 35 | -------------------------------------------------------------------------------- /lang/adodb-pl.inc.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | $ADODB_LANG_ARRAY = array ( 6 | 'LANG' => 'pl', 7 | DB_ERROR => 'niezidentyfikowany błąd', 8 | DB_ERROR_ALREADY_EXISTS => 'już istnieją', 9 | DB_ERROR_CANNOT_CREATE => 'nie można stworzyć', 10 | DB_ERROR_CANNOT_DELETE => 'nie można usunąć', 11 | DB_ERROR_CANNOT_DROP => 'nie można porzucić', 12 | DB_ERROR_CONSTRAINT => 'pogwałcenie uprawnień', 13 | DB_ERROR_DIVZERO => 'dzielenie przez zero', 14 | DB_ERROR_INVALID => 'błędny', 15 | DB_ERROR_INVALID_DATE => 'błędna godzina lub data', 16 | DB_ERROR_INVALID_NUMBER => 'błędny numer', 17 | DB_ERROR_MISMATCH => 'niedopasowanie', 18 | DB_ERROR_NODBSELECTED => 'baza danych nie została wybrana', 19 | DB_ERROR_NOSUCHFIELD => 'nie znaleziono pola', 20 | DB_ERROR_NOSUCHTABLE => 'nie znaleziono tabeli', 21 | DB_ERROR_NOT_CAPABLE => 'nie zdolny', 22 | DB_ERROR_NOT_FOUND => 'nie znaleziono', 23 | DB_ERROR_NOT_LOCKED => 'nie zakmnięty', 24 | DB_ERROR_SYNTAX => 'błąd składni', 25 | DB_ERROR_UNSUPPORTED => 'nie obsługuje', 26 | DB_ERROR_VALUE_COUNT_ON_ROW => 'wartość liczona w szeregu', 27 | DB_ERROR_INVALID_DSN => 'błędny DSN', 28 | DB_ERROR_CONNECT_FAILED => 'połączenie nie zostało zrealizowane', 29 | 0 => 'brak błędów', // DB_OK 30 | DB_ERROR_NEED_MORE_DATA => 'niedostateczna ilość informacji', 31 | DB_ERROR_EXTENSION_NOT_FOUND=> 'nie znaleziono rozszerzenia', 32 | DB_ERROR_NOSUCHDB => 'nie znaleziono bazy', 33 | DB_ERROR_ACCESS_VIOLATION => 'niedostateczne uprawnienia' 34 | ); 35 | -------------------------------------------------------------------------------- /session/adodb-compress-gzip.php: -------------------------------------------------------------------------------- 1 | _level; 36 | } 37 | 38 | /** 39 | */ 40 | function setLevel($level) { 41 | assert('$level >= 0'); 42 | assert('$level <= 9'); 43 | $this->_level = (int) $level; 44 | } 45 | 46 | /** 47 | */ 48 | function getMinLength() { 49 | return $this->_min_length; 50 | } 51 | 52 | /** 53 | */ 54 | function setMinLength($min_length) { 55 | assert('$min_length >= 0'); 56 | $this->_min_length = (int) $min_length; 57 | } 58 | 59 | /** 60 | */ 61 | function __construct($level = null, $min_length = null) { 62 | if (!is_null($level)) { 63 | $this->setLevel($level); 64 | } 65 | 66 | if (!is_null($min_length)) { 67 | $this->setMinLength($min_length); 68 | } 69 | } 70 | 71 | /** 72 | */ 73 | function write($data, $key) { 74 | if (strlen($data) < $this->_min_length) { 75 | return $data; 76 | } 77 | 78 | if (!is_null($this->_level)) { 79 | return gzcompress($data, $this->_level); 80 | } else { 81 | return gzcompress($data); 82 | } 83 | } 84 | 85 | /** 86 | */ 87 | function read($data, $key) { 88 | return $data ? gzuncompress($data) : $data; 89 | } 90 | 91 | } 92 | 93 | return 1; 94 | -------------------------------------------------------------------------------- /lang/adodb-es.inc.php: -------------------------------------------------------------------------------- 1 | 3 | $ADODB_LANG_ARRAY = array ( 4 | 'LANG' => 'es', 5 | DB_ERROR => 'error desconocido', 6 | DB_ERROR_ALREADY_EXISTS => 'ya existe', 7 | DB_ERROR_CANNOT_CREATE => 'imposible crear', 8 | DB_ERROR_CANNOT_DELETE => 'imposible borrar', 9 | DB_ERROR_CANNOT_DROP => 'imposible hacer drop', 10 | DB_ERROR_CONSTRAINT => 'violacion de constraint', 11 | DB_ERROR_DIVZERO => 'division por cero', 12 | DB_ERROR_INVALID => 'invalido', 13 | DB_ERROR_INVALID_DATE => 'fecha u hora invalida', 14 | DB_ERROR_INVALID_NUMBER => 'numero invalido', 15 | DB_ERROR_MISMATCH => 'error', 16 | DB_ERROR_NODBSELECTED => 'no hay base de datos seleccionada', 17 | DB_ERROR_NOSUCHFIELD => 'campo invalido', 18 | DB_ERROR_NOSUCHTABLE => 'tabla no existe', 19 | DB_ERROR_NOT_CAPABLE => 'capacidad invalida para esta DB', 20 | DB_ERROR_NOT_FOUND => 'no encontrado', 21 | DB_ERROR_NOT_LOCKED => 'no bloqueado', 22 | DB_ERROR_SYNTAX => 'error de sintaxis', 23 | DB_ERROR_UNSUPPORTED => 'no soportado', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'la cantidad de columnas no corresponden a la cantidad de valores', 25 | DB_ERROR_INVALID_DSN => 'DSN invalido', 26 | DB_ERROR_CONNECT_FAILED => 'fallo la conexion', 27 | 0 => 'sin error', // DB_OK 28 | DB_ERROR_NEED_MORE_DATA => 'insuficientes datos', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'extension no encontrada', 30 | DB_ERROR_NOSUCHDB => 'base de datos no encontrada', 31 | DB_ERROR_ACCESS_VIOLATION => 'permisos insuficientes' 32 | ); 33 | -------------------------------------------------------------------------------- /drivers/adodb-db2ora.inc.php: -------------------------------------------------------------------------------- 1 | $_COLONSZ) return $p; 30 | $_COLONARR[] = $v; 31 | return '?'; 32 | } 33 | 34 | function _colonscope($sql,$arr) 35 | { 36 | global $_COLONARR,$_COLONSZ; 37 | 38 | $_COLONARR = array(); 39 | $_COLONSZ = sizeof($arr); 40 | 41 | $sql2 = preg_replace_callback('/(:[0-9]+)/', create_function('$m', 'return _colontrack($m[0]);'), $sql); 42 | 43 | if (empty($_COLONARR)) return array($sql,$arr); 44 | 45 | foreach($_COLONARR as $k => $v) { 46 | $arr2[] = $arr[$v]; 47 | } 48 | 49 | return array($sql2,$arr2); 50 | } 51 | 52 | class ADODB_db2oci extends ADODB_db2 { 53 | var $databaseType = "db2oci"; 54 | var $sysTimeStamp = 'sysdate'; 55 | var $sysDate = 'trunc(sysdate)'; 56 | 57 | function _Execute($sql, $inputarr = false) 58 | { 59 | if ($inputarr) list($sql,$inputarr) = _colonscope($sql, $inputarr); 60 | return parent::_Execute($sql, $inputarr); 61 | } 62 | }; 63 | 64 | 65 | class ADORecordSet_db2oci extends ADORecordSet_odbc { 66 | 67 | var $databaseType = "db2oci"; 68 | 69 | function __construct($id,$mode=false) 70 | { 71 | return parent::__construct($id,$mode); 72 | } 73 | } 74 | 75 | } //define 76 | -------------------------------------------------------------------------------- /lang/adodb-pt-br.inc.php: -------------------------------------------------------------------------------- 1 | 'pt-br', 6 | DB_ERROR => 'erro desconhecido', 7 | DB_ERROR_ALREADY_EXISTS => 'já existe', 8 | DB_ERROR_CANNOT_CREATE => 'impossível criar', 9 | DB_ERROR_CANNOT_DELETE => 'impossível excluír', 10 | DB_ERROR_CANNOT_DROP => 'impossível remover', 11 | DB_ERROR_CONSTRAINT => 'violação do confinamente', 12 | DB_ERROR_DIVZERO => 'divisão por zero', 13 | DB_ERROR_INVALID => 'inválido', 14 | DB_ERROR_INVALID_DATE => 'data ou hora inválida', 15 | DB_ERROR_INVALID_NUMBER => 'número inválido', 16 | DB_ERROR_MISMATCH => 'erro', 17 | DB_ERROR_NODBSELECTED => 'nenhum banco de dados selecionado', 18 | DB_ERROR_NOSUCHFIELD => 'campo inválido', 19 | DB_ERROR_NOSUCHTABLE => 'tabela inexistente', 20 | DB_ERROR_NOT_CAPABLE => 'capacidade inválida para este BD', 21 | DB_ERROR_NOT_FOUND => 'não encontrado', 22 | DB_ERROR_NOT_LOCKED => 'não bloqueado', 23 | DB_ERROR_SYNTAX => 'erro de sintaxe', 24 | DB_ERROR_UNSUPPORTED => 25 | 'não suportado', 26 | DB_ERROR_VALUE_COUNT_ON_ROW => 'a quantidade de colunas não corresponde ao de valores', 27 | DB_ERROR_INVALID_DSN => 'DSN inválido', 28 | DB_ERROR_CONNECT_FAILED => 'falha na conexão', 29 | 0 => 'sem erro', // DB_OK 30 | DB_ERROR_NEED_MORE_DATA => 'dados insuficientes', 31 | DB_ERROR_EXTENSION_NOT_FOUND=> 'extensão não encontrada', 32 | DB_ERROR_NOSUCHDB => 'banco de dados não encontrado', 33 | DB_ERROR_ACCESS_VIOLATION => 'permissão insuficiente' 34 | ); 35 | -------------------------------------------------------------------------------- /lang/adodb-hu.inc.php: -------------------------------------------------------------------------------- 1 | 4 | $ADODB_LANG_ARRAY = array ( 5 | 'LANG' => 'hu', 6 | DB_ERROR => 'ismeretlen hiba', 7 | DB_ERROR_ALREADY_EXISTS => 'már létezik', 8 | DB_ERROR_CANNOT_CREATE => 'nem sikerült létrehozni', 9 | DB_ERROR_CANNOT_DELETE => 'nem sikerült törölni', 10 | DB_ERROR_CANNOT_DROP => 'nem sikerült eldobni', 11 | DB_ERROR_CONSTRAINT => 'szabályok megszegése', 12 | DB_ERROR_DIVZERO => 'osztás nullával', 13 | DB_ERROR_INVALID => 'érvénytelen', 14 | DB_ERROR_INVALID_DATE => 'érvénytelen dátum vagy idő', 15 | DB_ERROR_INVALID_NUMBER => 'érvénytelen szám', 16 | DB_ERROR_MISMATCH => 'nem megfelelő', 17 | DB_ERROR_NODBSELECTED => 'nincs kiválasztott adatbázis', 18 | DB_ERROR_NOSUCHFIELD => 'nincs ilyen mező', 19 | DB_ERROR_NOSUCHTABLE => 'nincs ilyen tábla', 20 | DB_ERROR_NOT_CAPABLE => 'DB backend nem támogatja', 21 | DB_ERROR_NOT_FOUND => 'nem található', 22 | DB_ERROR_NOT_LOCKED => 'nincs lezárva', 23 | DB_ERROR_SYNTAX => 'szintaktikai hiba', 24 | DB_ERROR_UNSUPPORTED => 'nem támogatott', 25 | DB_ERROR_VALUE_COUNT_ON_ROW => 'soron végzett érték számlálás', 26 | DB_ERROR_INVALID_DSN => 'hibás DSN', 27 | DB_ERROR_CONNECT_FAILED => 'sikertelen csatlakozás', 28 | 0 => 'nincs hiba', // DB_OK 29 | DB_ERROR_NEED_MORE_DATA => 'túl kevés az adat', 30 | DB_ERROR_EXTENSION_NOT_FOUND=> 'bővítmény nem található', 31 | DB_ERROR_NOSUCHDB => 'nincs ilyen adatbázis', 32 | DB_ERROR_ACCESS_VIOLATION => 'nincs jogosultság' 33 | ); 34 | -------------------------------------------------------------------------------- /lang/adodb-ru.inc.php: -------------------------------------------------------------------------------- 1 | 'ru', 7 | DB_ERROR => 'неизвестная ошибка', 8 | DB_ERROR_ALREADY_EXISTS => 'уже существует', 9 | DB_ERROR_CANNOT_CREATE => 'невозможно создать', 10 | DB_ERROR_CANNOT_DELETE => 'невозможно удалить', 11 | DB_ERROR_CANNOT_DROP => 'невозможно удалить (drop)', 12 | DB_ERROR_CONSTRAINT => 'нарушение условий проверки', 13 | DB_ERROR_DIVZERO => 'деление на 0', 14 | DB_ERROR_INVALID => 'неправильно', 15 | DB_ERROR_INVALID_DATE => 'некорректная дата или время', 16 | DB_ERROR_INVALID_NUMBER => 'некорректное число', 17 | DB_ERROR_MISMATCH => 'ошибка', 18 | DB_ERROR_NODBSELECTED => 'БД не выбрана', 19 | DB_ERROR_NOSUCHFIELD => 'не существует поле', 20 | DB_ERROR_NOSUCHTABLE => 'не существует таблица', 21 | DB_ERROR_NOT_CAPABLE => 'СУБД не в состоянии', 22 | DB_ERROR_NOT_FOUND => 'не найдено', 23 | DB_ERROR_NOT_LOCKED => 'не заблокировано', 24 | DB_ERROR_SYNTAX => 'синтаксическая ошибка', 25 | DB_ERROR_UNSUPPORTED => 'не поддерживается', 26 | DB_ERROR_VALUE_COUNT_ON_ROW => 'счетчик значений в строке', 27 | DB_ERROR_INVALID_DSN => 'неправильная DSN', 28 | DB_ERROR_CONNECT_FAILED => 'соединение неуспешно', 29 | 0 => 'нет ошибки', // DB_OK 30 | DB_ERROR_NEED_MORE_DATA => 'предоставлено недостаточно данных', 31 | DB_ERROR_EXTENSION_NOT_FOUND=> 'расширение не найдено', 32 | DB_ERROR_NOSUCHDB => 'не существует БД', 33 | DB_ERROR_ACCESS_VIOLATION => 'недостаточно прав доступа' 34 | ); 35 | -------------------------------------------------------------------------------- /lang/adodb-en.inc.php: -------------------------------------------------------------------------------- 1 | 'en', 5 | DB_ERROR => 'unknown error', 6 | DB_ERROR_ALREADY_EXISTS => 'already exists', 7 | DB_ERROR_CANNOT_CREATE => 'can not create', 8 | DB_ERROR_CANNOT_DELETE => 'can not delete', 9 | DB_ERROR_CANNOT_DROP => 'can not drop', 10 | DB_ERROR_CONSTRAINT => 'constraint violation', 11 | DB_ERROR_DIVZERO => 'division by zero', 12 | DB_ERROR_INVALID => 'invalid', 13 | DB_ERROR_INVALID_DATE => 'invalid date or time', 14 | DB_ERROR_INVALID_NUMBER => 'invalid number', 15 | DB_ERROR_MISMATCH => 'mismatch', 16 | DB_ERROR_NODBSELECTED => 'no database selected', 17 | DB_ERROR_NOSUCHFIELD => 'no such field', 18 | DB_ERROR_NOSUCHTABLE => 'no such table', 19 | DB_ERROR_NOT_CAPABLE => 'DB backend not capable', 20 | DB_ERROR_NOT_FOUND => 'not found', 21 | DB_ERROR_NOT_LOCKED => 'not locked', 22 | DB_ERROR_SYNTAX => 'syntax error', 23 | DB_ERROR_UNSUPPORTED => 'not supported', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'value count on row', 25 | DB_ERROR_INVALID_DSN => 'invalid DSN', 26 | DB_ERROR_CONNECT_FAILED => 'connect failed', 27 | 0 => 'no error', // DB_OK 28 | DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found', 30 | DB_ERROR_NOSUCHDB => 'no such database', 31 | DB_ERROR_ACCESS_VIOLATION => 'insufficient permissions', 32 | DB_ERROR_DEADLOCK => 'deadlock detected', 33 | DB_ERROR_STATEMENT_TIMEOUT => 'statement timeout', 34 | DB_ERROR_SERIALIZATION_FAILURE => 'could not serialize access' 35 | ); 36 | -------------------------------------------------------------------------------- /lang/adodb-it.inc.php: -------------------------------------------------------------------------------- 1 | 'it', 6 | DB_ERROR => 'errore sconosciuto', 7 | DB_ERROR_ALREADY_EXISTS => 'esiste già', 8 | DB_ERROR_CANNOT_CREATE => 'non posso creare', 9 | DB_ERROR_CANNOT_DELETE => 'non posso cancellare', 10 | DB_ERROR_CANNOT_DROP => 'non posso eliminare', 11 | DB_ERROR_CONSTRAINT => 'violazione constraint', 12 | DB_ERROR_DIVZERO => 'divisione per zero', 13 | DB_ERROR_INVALID => 'non valido', 14 | DB_ERROR_INVALID_DATE => 'data od ora non valida', 15 | DB_ERROR_INVALID_NUMBER => 'numero non valido', 16 | DB_ERROR_MISMATCH => 'diversi', 17 | DB_ERROR_NODBSELECTED => 'nessun database selezionato', 18 | DB_ERROR_NOSUCHFIELD => 'nessun campo trovato', 19 | DB_ERROR_NOSUCHTABLE => 'nessuna tabella trovata', 20 | DB_ERROR_NOT_CAPABLE => 'DB backend non abilitato', 21 | DB_ERROR_NOT_FOUND => 'non trovato', 22 | DB_ERROR_NOT_LOCKED => 'non bloccato', 23 | DB_ERROR_SYNTAX => 'errore di sintassi', 24 | DB_ERROR_UNSUPPORTED => 'non supportato', 25 | DB_ERROR_VALUE_COUNT_ON_ROW => 'valore inserito troppo grande per una colonna', 26 | DB_ERROR_INVALID_DSN => 'DSN non valido', 27 | DB_ERROR_CONNECT_FAILED => 'connessione fallita', 28 | 0 => 'nessun errore', // DB_OK 29 | DB_ERROR_NEED_MORE_DATA => 'dati inseriti insufficienti', 30 | DB_ERROR_EXTENSION_NOT_FOUND=> 'estensione non trovata', 31 | DB_ERROR_NOSUCHDB => 'database non trovato', 32 | DB_ERROR_ACCESS_VIOLATION => 'permessi insufficienti' 33 | ); 34 | -------------------------------------------------------------------------------- /lang/adodb-ca.inc.php: -------------------------------------------------------------------------------- 1 | 'ca', 6 | DB_ERROR => 'error desconegut', 7 | DB_ERROR_ALREADY_EXISTS => 'ja existeix', 8 | DB_ERROR_CANNOT_CREATE => 'no es pot crear', 9 | DB_ERROR_CANNOT_DELETE => 'no es pot esborrar', 10 | DB_ERROR_CANNOT_DROP => 'no es pot eliminar', 11 | DB_ERROR_CONSTRAINT => 'violació de constraint', 12 | DB_ERROR_DIVZERO => 'divisió per zero', 13 | DB_ERROR_INVALID => 'no és vàlid', 14 | DB_ERROR_INVALID_DATE => 'la data o l\'hora no són vàlides', 15 | DB_ERROR_INVALID_NUMBER => 'el nombre no és vàlid', 16 | DB_ERROR_MISMATCH => 'no hi ha coincidència', 17 | DB_ERROR_NODBSELECTED => 'cap base de dades seleccionada', 18 | DB_ERROR_NOSUCHFIELD => 'camp inexistent', 19 | DB_ERROR_NOSUCHTABLE => 'taula inexistent', 20 | DB_ERROR_NOT_CAPABLE => 'l\'execució secundària de DB no pot', 21 | DB_ERROR_NOT_FOUND => 'no trobat', 22 | DB_ERROR_NOT_LOCKED => 'no blocat', 23 | DB_ERROR_SYNTAX => 'error de sintaxi', 24 | DB_ERROR_UNSUPPORTED => 'no suportat', 25 | DB_ERROR_VALUE_COUNT_ON_ROW => 'el nombre de columnes no coincideix amb el nombre de valors en la fila', 26 | DB_ERROR_INVALID_DSN => 'el DSN no és vàlid', 27 | DB_ERROR_CONNECT_FAILED => 'connexió fallida', 28 | 0 => 'cap error', // DB_OK 29 | DB_ERROR_NEED_MORE_DATA => 'les dades subministrades són insuficients', 30 | DB_ERROR_EXTENSION_NOT_FOUND=> 'extensió no trobada', 31 | DB_ERROR_NOSUCHDB => 'base de dades inexistent', 32 | DB_ERROR_ACCESS_VIOLATION => 'permisos insuficients' 33 | ); 34 | -------------------------------------------------------------------------------- /drivers/adodb-sqlitepo.inc.php: -------------------------------------------------------------------------------- 1 | fields = array(); 47 | $fields = @sqlite_fetch_array($this->_queryID,$this->fetchMode); 48 | if(is_array($fields)) 49 | foreach($fields as $n => $v) 50 | { 51 | if(($p = strpos($n, ".")) !== false) 52 | $n = substr($n, $p+1); 53 | $this->fields[$n] = $v; 54 | } 55 | 56 | return !empty($this->fields); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lang/adodb-de.inc.php: -------------------------------------------------------------------------------- 1 | 3 | $ADODB_LANG_ARRAY = array ( 4 | 'LANG' => 'de', 5 | DB_ERROR => 'Unbekannter Fehler', 6 | DB_ERROR_ALREADY_EXISTS => 'existiert bereits', 7 | DB_ERROR_CANNOT_CREATE => 'kann nicht erstellen', 8 | DB_ERROR_CANNOT_DELETE => 'kann nicht löschen', 9 | DB_ERROR_CANNOT_DROP => 'Tabelle oder Index konnte nicht gelöscht werden', 10 | DB_ERROR_CONSTRAINT => 'Constraint Verletzung', 11 | DB_ERROR_DIVZERO => 'Division durch Null', 12 | DB_ERROR_INVALID => 'ungültig', 13 | DB_ERROR_INVALID_DATE => 'ungültiges Datum oder Zeit', 14 | DB_ERROR_INVALID_NUMBER => 'ungültige Zahl', 15 | DB_ERROR_MISMATCH => 'Unverträglichkeit', 16 | DB_ERROR_NODBSELECTED => 'keine Dantebank ausgewählt', 17 | DB_ERROR_NOSUCHFIELD => 'Feld nicht vorhanden', 18 | DB_ERROR_NOSUCHTABLE => 'Tabelle nicht vorhanden', 19 | DB_ERROR_NOT_CAPABLE => 'Funktion nicht installiert', 20 | DB_ERROR_NOT_FOUND => 'nicht gefunden', 21 | DB_ERROR_NOT_LOCKED => 'nicht gesperrt', 22 | DB_ERROR_SYNTAX => 'Syntaxfehler', 23 | DB_ERROR_UNSUPPORTED => 'nicht Unterstützt', 24 | DB_ERROR_VALUE_COUNT_ON_ROW => 'Anzahl der zurückgelieferten Felder entspricht nicht der Anzahl der Felder in der Abfrage', 25 | DB_ERROR_INVALID_DSN => 'ungültiger DSN', 26 | DB_ERROR_CONNECT_FAILED => 'Verbindung konnte nicht hergestellt werden', 27 | 0 => 'kein Fehler', // DB_OK 28 | DB_ERROR_NEED_MORE_DATA => 'Nicht genügend Daten geliefert', 29 | DB_ERROR_EXTENSION_NOT_FOUND=> 'erweiterung nicht gefunden', 30 | DB_ERROR_NOSUCHDB => 'keine Datenbank', 31 | DB_ERROR_ACCESS_VIOLATION => 'ungenügende Rechte' 32 | ); 33 | -------------------------------------------------------------------------------- /tests/pdo.php: -------------------------------------------------------------------------------- 1 | "; 6 | try { 7 | echo "New Connection\n"; 8 | 9 | 10 | $dsn = 'pdo_mysql://root:@localhost/northwind?persist'; 11 | 12 | if (!empty($dsn)) { 13 | $DB = NewADOConnection($dsn) || die("CONNECT FAILED"); 14 | $connstr = $dsn; 15 | } else { 16 | 17 | $DB = NewADOConnection('pdo'); 18 | 19 | echo "Connect\n"; 20 | 21 | $u = ''; $p = ''; 22 | /* 23 | $connstr = 'odbc:nwind'; 24 | 25 | $connstr = 'oci:'; 26 | $u = 'scott'; 27 | $p = 'natsoft'; 28 | 29 | 30 | $connstr ="sqlite:d:\inetpub\adodb\sqlite.db"; 31 | */ 32 | 33 | $connstr = "mysql:dbname=northwind"; 34 | $u = 'root'; 35 | 36 | $connstr = "pgsql:dbname=test"; 37 | $u = 'tester'; 38 | $p = 'test'; 39 | 40 | $DB->Connect($connstr,$u,$p) || die("CONNECT FAILED"); 41 | 42 | } 43 | 44 | echo "connection string=$connstr\n Execute\n"; 45 | 46 | //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; 47 | $rs = $DB->Execute("select * from ADOXYZ where id<3"); 48 | if ($DB->ErrorNo()) echo "*** errno=".$DB->ErrorNo() . " ".($DB->ErrorMsg())."\n"; 49 | 50 | 51 | //print_r(get_class_methods($DB->_stmt)); 52 | 53 | if (!$rs) die("NO RS"); 54 | 55 | echo "Meta\n"; 56 | for ($i=0; $i < $rs->NumCols(); $i++) { 57 | var_dump($rs->FetchField($i)); 58 | echo "
"; 59 | } 60 | 61 | echo "FETCH\n"; 62 | $cnt = 0; 63 | while (!$rs->EOF) { 64 | adodb_pr($rs->fields); 65 | $rs->MoveNext(); 66 | if ($cnt++ > 1000) break; 67 | } 68 | 69 | echo "
--------------------------------------------------------
\n\n\n"; 70 | 71 | $stmt = $DB->PrepareStmt("select * from ADOXYZ"); 72 | 73 | $rs = $stmt->Execute(); 74 | $cols = $stmt->NumCols(); // execute required 75 | 76 | echo "COLS = $cols"; 77 | for($i=1;$i<=$cols;$i++) { 78 | $v = $stmt->_stmt->getColumnMeta($i); 79 | var_dump($v); 80 | } 81 | 82 | echo "e=".$stmt->ErrorNo() . " ".($stmt->ErrorMsg())."\n"; 83 | while ($arr = $rs->FetchRow()) { 84 | adodb_pr($arr); 85 | } 86 | die("DONE\n"); 87 | 88 | } catch (exception $e) { 89 | echo "
";
90 | 	echo $e;
91 | 	echo "
"; 92 | } 93 | -------------------------------------------------------------------------------- /lang/adodb-bg.inc.php: -------------------------------------------------------------------------------- 1 | 5 | */ 6 | 7 | $ADODB_LANG_ARRAY = array ( 8 | 'LANG' => 'bg', 9 | DB_ERROR => 'неизвестна грешка', 10 | DB_ERROR_ALREADY_EXISTS => 'вече съществува', 11 | DB_ERROR_CANNOT_CREATE => 'не може да бъде създадена', 12 | DB_ERROR_CANNOT_DELETE => 'не може да бъде изтрита', 13 | DB_ERROR_CANNOT_DROP => 'не може да бъде унищожена', 14 | DB_ERROR_CONSTRAINT => 'нарушено условие', 15 | DB_ERROR_DIVZERO => 'деление на нула', 16 | DB_ERROR_INVALID => 'неправилно', 17 | DB_ERROR_INVALID_DATE => 'некоректна дата или час', 18 | DB_ERROR_INVALID_NUMBER => 'невалиден номер', 19 | DB_ERROR_MISMATCH => 'погрешна употреба', 20 | DB_ERROR_NODBSELECTED => 'не е избрана база данни', 21 | DB_ERROR_NOSUCHFIELD => 'несъществуващо поле', 22 | DB_ERROR_NOSUCHTABLE => 'несъществуваща таблица', 23 | DB_ERROR_NOT_CAPABLE => 'DB backend not capable', 24 | DB_ERROR_NOT_FOUND => 'не е намерена', 25 | DB_ERROR_NOT_LOCKED => 'не е заключена', 26 | DB_ERROR_SYNTAX => 'грешен синтаксис', 27 | DB_ERROR_UNSUPPORTED => 'не се поддържа', 28 | DB_ERROR_VALUE_COUNT_ON_ROW => 'некоректен брой колони в реда', 29 | DB_ERROR_INVALID_DSN => 'невалиден DSN', 30 | DB_ERROR_CONNECT_FAILED => 'връзката не може да бъде осъществена', 31 | 0 => 'няма грешки', // DB_OK 32 | DB_ERROR_NEED_MORE_DATA => 'предоставените данни са недостатъчни', 33 | DB_ERROR_EXTENSION_NOT_FOUND=> 'разширението не е намерено', 34 | DB_ERROR_NOSUCHDB => 'несъществуваща база данни', 35 | DB_ERROR_ACCESS_VIOLATION => 'нямате достатъчно права' 36 | ); 37 | -------------------------------------------------------------------------------- /tests/tmssql.php: -------------------------------------------------------------------------------- 1 | mssql"; 8 | $db = mssql_connect('JAGUAR\vsdotnet','adodb','natsoft') or die('No Connection'); 9 | mssql_select_db('northwind',$db); 10 | 11 | $rs = mssql_query('select getdate() as date',$db); 12 | $o = mssql_fetch_row($rs); 13 | print_r($o); 14 | mssql_free_result($rs); 15 | 16 | print "

Delete

"; flush(); 17 | $rs2 = mssql_query('delete from adoxyz',$db); 18 | $p = mssql_num_rows($rs2); 19 | mssql_free_result($rs2); 20 | 21 | } 22 | 23 | function tpear() 24 | { 25 | include_once('DB.php'); 26 | 27 | print "

PEAR

"; 28 | $username = 'adodb'; 29 | $password = 'natsoft'; 30 | $hostname = 'JAGUAR\vsdotnet'; 31 | $databasename = 'northwind'; 32 | 33 | $dsn = "mssql://$username:$password@$hostname/$databasename"; 34 | $conn = DB::connect($dsn); 35 | print "date=".$conn->GetOne('select getdate()')."
"; 36 | @$conn->query('create table tester (id integer)'); 37 | print "

Delete

"; flush(); 38 | $rs = $conn->query('delete from tester'); 39 | print "date=".$conn->GetOne('select getdate()')."
"; 40 | } 41 | 42 | function tadodb() 43 | { 44 | include_once('../adodb.inc.php'); 45 | 46 | print "

ADOdb

"; 47 | $conn = NewADOConnection('mssql'); 48 | $conn->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind'); 49 | // $conn->debug=1; 50 | print "date=".$conn->GetOne('select getdate()')."
"; 51 | $conn->Execute('create table tester (id integer)'); 52 | print "

Delete

"; flush(); 53 | $rs = $conn->Execute('delete from tester'); 54 | print "date=".$conn->GetOne('select getdate()')."
"; 55 | } 56 | 57 | 58 | $ACCEPTIP = '127.0.0.1'; 59 | 60 | $remote = $_SERVER["REMOTE_ADDR"]; 61 | 62 | if (!empty($ACCEPTIP)) 63 | if ($remote != '127.0.0.1' && $remote != $ACCEPTIP) 64 | die("Unauthorised client: '$remote'"); 65 | 66 | ?> 67 | mssql 68 | pear 69 | adodb 70 | dialect; 29 | switch($arr['dialect']) { 30 | case '': 31 | case '1': $s = 'Firebird Dialect 1'; break; 32 | case '2': $s = 'Firebird Dialect 2'; break; 33 | default: 34 | case '3': $s = 'Firebird Dialect 3'; break; 35 | } 36 | $arr['version'] = ADOConnection::_findvers($s); 37 | $arr['description'] = $s; 38 | return $arr; 39 | } 40 | 41 | // Note that Interbase 6.5 uses this ROWS instead - don't you love forking wars! 42 | // SELECT col1, col2 FROM table ROWS 5 -- get 5 rows 43 | // SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2 44 | function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $secs=0) 45 | { 46 | $nrows = (integer) $nrows; 47 | $offset = (integer) $offset; 48 | $str = 'SELECT '; 49 | if ($nrows >= 0) $str .= "FIRST $nrows "; 50 | $str .=($offset>=0) ? "SKIP $offset " : ''; 51 | 52 | $sql = preg_replace('/^[ \t]*select/i',$str,$sql); 53 | if ($secs) 54 | $rs = $this->CacheExecute($secs,$sql,$inputarr); 55 | else 56 | $rs = $this->Execute($sql,$inputarr); 57 | 58 | return $rs; 59 | } 60 | 61 | 62 | }; 63 | 64 | 65 | class ADORecordSet_firebird extends ADORecordSet_ibase { 66 | 67 | var $databaseType = "firebird"; 68 | 69 | function __construct($id,$mode=false) 70 | { 71 | parent::__construct($id,$mode); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /datadict/datadict-informix.inc.php: -------------------------------------------------------------------------------- 1 | debug) ADOConnection::outp("AlterColumnSQL not supported"); 57 | return array(); 58 | } 59 | 60 | 61 | function DropColumnSQL($tabname, $flds, $tableflds='', $tableoptions='') 62 | { 63 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); 64 | return array(); 65 | } 66 | 67 | // return string must begin with space 68 | function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) 69 | { 70 | if ($fautoinc) { 71 | $ftype = 'SERIAL'; 72 | return ''; 73 | } 74 | $suffix = ''; 75 | if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; 76 | if ($fnotnull) $suffix .= ' NOT NULL'; 77 | if ($fconstraint) $suffix .= ' '.$fconstraint; 78 | return $suffix; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /tests/test-pgblob.php: -------------------------------------------------------------------------------- 1 | Param(false); 22 | $x = (rand() % 10) + 1; 23 | $db->debug= ($i==1); 24 | $id = $db->GetOne($sql, 25 | array('Z%','Z%',$x)); 26 | if($id != $offset+$x) { 27 | print "

Error at $x"; 28 | break; 29 | } 30 | } 31 | } 32 | 33 | include_once('../adodb.inc.php'); 34 | $db = NewADOConnection('postgres7'); 35 | $db->PConnect('localhost','tester','test','test') || die("failed connection"); 36 | 37 | $enc = "GIF89a%01%00%01%00%80%FF%00%C0%C0%C0%00%00%00%21%F9%04%01%00%00%00%00%2C%00%00%00%00%01%00%01%00%00%01%012%00%3Bt_clear.gif%0D"; 38 | $val = rawurldecode($enc); 39 | 40 | $MAX = 1000; 41 | 42 | adodb_pr($db->ServerInfo()); 43 | 44 | echo "

Testing PREPARE/EXECUTE PLAN

"; 45 | 46 | 47 | $db->_bindInputArray = true; // requires postgresql 7.3+ and ability to modify database 48 | $t = getmicrotime(); 49 | doloop(); 50 | echo '

',$MAX,' times, with plan=',getmicrotime() - $t,'

'; 51 | 52 | 53 | $db->_bindInputArray = false; 54 | $t = getmicrotime(); 55 | doloop(); 56 | echo '

',$MAX,' times, no plan=',getmicrotime() - $t,'

'; 57 | 58 | 59 | 60 | echo "

Testing UPDATEBLOB

"; 61 | $db->debug=1; 62 | 63 | ### TEST BEGINS 64 | 65 | $db->Execute("insert into photos (id,name) values(9999,'dot.gif')"); 66 | $db->UpdateBlob('photos','photo',$val,'id=9999'); 67 | $v = $db->GetOne('select photo from photos where id=9999'); 68 | 69 | 70 | ### CLEANUP 71 | 72 | $db->Execute("delete from photos where id=9999"); 73 | 74 | ### VALIDATION 75 | 76 | if ($v !== $val) echo "*** ERROR: Inserted value does not match downloaded val"; 77 | else echo "*** OK: Passed"; 78 | 79 | echo "
";
80 | echo "INSERTED: ", $enc;
81 | echo "
"; 82 | echo"RETURNED: ", rawurlencode($v); 83 | echo "

"; 84 | echo "INSERTED: ", $val; 85 | echo "


"; 86 | echo "RETURNED: ", $v; 87 | -------------------------------------------------------------------------------- /tests/testmssql.php: -------------------------------------------------------------------------------- 1 | Connect('127.0.0.1','adodb','natsoft','northwind') or die('Fail'); 31 | 32 | $conn->debug =1; 33 | $query = 'select * from products'; 34 | $conn->SetFetchMode(ADODB_FETCH_ASSOC); 35 | $rs = $conn->Execute($query); 36 | echo "
";
37 | while( !$rs->EOF ) {
38 | 	$output[] = $rs->fields;
39 | 	var_dump($rs->fields);
40 | 	$rs->MoveNext();
41 | 	print "

"; 42 | } 43 | die(); 44 | 45 | 46 | $p = $conn->Prepare('insert into products (productname,unitprice,dcreated) values (?,?,?)'); 47 | echo "

";
48 | print_r($p);
49 | 
50 | $conn->debug=1;
51 | $conn->Execute($p,array('John'.rand(),33.3,$conn->DBDate(time())));
52 | 
53 | $p = $conn->Prepare('select * from products where productname like ?');
54 | $arr = $conn->getarray($p,array('V%'));
55 | print_r($arr);
56 | die();
57 | 
58 | //$conn = ADONewConnection("mssql");
59 | //$conn->Connect('mangrove','sa','natsoft','ai');
60 | 
61 | //$conn->Connect('mangrove','sa','natsoft','ai');
62 | $conn->debug=1;
63 | $conn->Execute('delete from blobtest');
64 | 
65 | $conn->Execute('insert into blobtest (id) values(1)');
66 | $conn->UpdateBlobFile('blobtest','b1','../cute_icons_for_site/adodb.gif','id=1');
67 | $rs = $conn->Execute('select b1 from blobtest where id=1');
68 | 
69 | $output = "c:\\temp\\test_out-".date('H-i-s').".gif";
70 | print "Saving file $output, size=".strlen($rs->fields[0])."

"; 71 | $fd = fopen($output, "wb"); 72 | fwrite($fd, $rs->fields[0]); 73 | fclose($fd); 74 | 75 | print " View Image"; 76 | //$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest'); 77 | //rs2html($rs); 78 | -------------------------------------------------------------------------------- /perf/perf-informix.inc.php: -------------------------------------------------------------------------------- 1 | array('RATIOH', 42 | "select round((1-(wt.value / (rd.value + wr.value)))*100,2) 43 | from sysmaster:sysprofile wr, sysmaster:sysprofile rd, sysmaster:sysprofile wt 44 | where rd.name = 'pagreads' and 45 | wr.name = 'pagwrites' and 46 | wt.name = 'buffwts'", 47 | '=WarnCacheRatio'), 48 | 'IO', 49 | 'data reads' => array('IO', 50 | "select value from sysmaster:sysprofile where name='pagreads'", 51 | 'Page reads'), 52 | 53 | 'data writes' => array('IO', 54 | "select value from sysmaster:sysprofile where name='pagwrites'", 55 | 'Page writes'), 56 | 57 | 'Connections', 58 | 'current connections' => array('SESS', 59 | 'select count(*) from sysmaster:syssessions', 60 | 'Number of sessions'), 61 | 62 | false 63 | 64 | ); 65 | 66 | function __construct(&$conn) 67 | { 68 | $this->conn = $conn; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /session/adodb-encrypt-mcrypt.php: -------------------------------------------------------------------------------- 1 | _cipher; 40 | } 41 | 42 | /** 43 | */ 44 | function setCipher($cipher) { 45 | $this->_cipher = $cipher; 46 | } 47 | 48 | /** 49 | */ 50 | function getMode() { 51 | return $this->_mode; 52 | } 53 | 54 | /** 55 | */ 56 | function setMode($mode) { 57 | $this->_mode = $mode; 58 | } 59 | 60 | /** 61 | */ 62 | function getSource() { 63 | return $this->_source; 64 | } 65 | 66 | /** 67 | */ 68 | function setSource($source) { 69 | $this->_source = $source; 70 | } 71 | 72 | /** 73 | */ 74 | function __construct($cipher = null, $mode = null, $source = null) { 75 | if (!$cipher) { 76 | $cipher = MCRYPT_RIJNDAEL_256; 77 | } 78 | if (!$mode) { 79 | $mode = MCRYPT_MODE_ECB; 80 | } 81 | if (!$source) { 82 | $source = MCRYPT_RAND; 83 | } 84 | 85 | $this->_cipher = $cipher; 86 | $this->_mode = $mode; 87 | $this->_source = $source; 88 | } 89 | 90 | /** 91 | */ 92 | function write($data, $key) { 93 | $iv_size = mcrypt_get_iv_size($this->_cipher, $this->_mode); 94 | $iv = mcrypt_create_iv($iv_size, $this->_source); 95 | return mcrypt_encrypt($this->_cipher, $key, $data, $this->_mode, $iv); 96 | } 97 | 98 | /** 99 | */ 100 | function read($data, $key) { 101 | $iv_size = mcrypt_get_iv_size($this->_cipher, $this->_mode); 102 | $iv = mcrypt_create_iv($iv_size, $this->_source); 103 | $rv = mcrypt_decrypt($this->_cipher, $key, $data, $this->_mode, $iv); 104 | return rtrim($rv, "\0"); 105 | } 106 | 107 | } 108 | 109 | return 1; 110 | -------------------------------------------------------------------------------- /tests/benchmark.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ADODB Benchmarks 6 | 7 | 8 | 9 | ADODB Version: $ADODB_version Host: $db->host   Database: $db->database"; 48 | 49 | // perform query once to cache results so we are only testing throughput 50 | $rs = $db->Execute($sql); 51 | if (!$rs){ 52 | print "Error in recordset

"; 53 | return; 54 | } 55 | $arr = $rs->GetArray(); 56 | //$db->debug = true; 57 | global $ADODB_COUNTRECS; 58 | $ADODB_COUNTRECS = false; 59 | $start = microtime(); 60 | for ($i=0; $i < $max; $i++) { 61 | $rs = $db->Execute($sql); 62 | $arr = $rs->GetArray(); 63 | // print $arr[0][1]; 64 | } 65 | $end = microtime(); 66 | $start = explode(' ',$start); 67 | $end = explode(' ',$end); 68 | 69 | //print_r($start); 70 | //print_r($end); 71 | 72 | // print_r($arr); 73 | $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]); 74 | printf ("

seconds = %8.2f for %d iterations each with %d records

",$total,$max, sizeof($arr)); 75 | flush(); 76 | 77 | 78 | //$db->Close(); 79 | } 80 | include("testdatabases.inc.php"); 81 | 82 | ?> 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /datadict/datadict-access.inc.php: -------------------------------------------------------------------------------- 1 | debug) ADOConnection::outp("Warning: Access does not supported DEFAULT values (field $fname)"); 66 | } 67 | if ($fnotnull) $suffix .= ' NOT NULL'; 68 | if ($fconstraint) $suffix .= ' '.$fconstraint; 69 | return $suffix; 70 | } 71 | 72 | function CreateDatabase($dbname,$options=false) 73 | { 74 | return array(); 75 | } 76 | 77 | 78 | function SetSchema($schema) 79 | { 80 | } 81 | 82 | function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') 83 | { 84 | if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); 85 | return array(); 86 | } 87 | 88 | 89 | function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') 90 | { 91 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); 92 | return array(); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /drivers/adodb-borland_ibase.inc.php: -------------------------------------------------------------------------------- 1 | transOff) return true; 28 | $this->transCnt += 1; 29 | $this->autoCommit = false; 30 | $this->_transactionID = ibase_trans($this->ibasetrans, $this->_connectionID); 31 | return $this->_transactionID; 32 | } 33 | 34 | function ServerInfo() 35 | { 36 | $arr['dialect'] = $this->dialect; 37 | switch($arr['dialect']) { 38 | case '': 39 | case '1': $s = 'Interbase 6.5, Dialect 1'; break; 40 | case '2': $s = 'Interbase 6.5, Dialect 2'; break; 41 | default: 42 | case '3': $s = 'Interbase 6.5, Dialect 3'; break; 43 | } 44 | $arr['version'] = '6.5'; 45 | $arr['description'] = $s; 46 | return $arr; 47 | } 48 | 49 | // Note that Interbase 6.5 uses ROWS instead - don't you love forking wars! 50 | // SELECT col1, col2 FROM table ROWS 5 -- get 5 rows 51 | // SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2 52 | // Firebird uses 53 | // SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE 54 | function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0) 55 | { 56 | if ($nrows > 0) { 57 | if ($offset <= 0) $str = " ROWS $nrows "; 58 | else { 59 | $a = $offset+1; 60 | $b = $offset+$nrows; 61 | $str = " ROWS $a TO $b"; 62 | } 63 | } else { 64 | // ok, skip 65 | $a = $offset + 1; 66 | $str = " ROWS $a TO 999999999"; // 999 million 67 | } 68 | $sql .= $str; 69 | 70 | return ($secs2cache) ? 71 | $this->CacheExecute($secs2cache,$sql,$inputarr) 72 | : 73 | $this->Execute($sql,$inputarr); 74 | } 75 | 76 | }; 77 | 78 | 79 | class ADORecordSet_borland_ibase extends ADORecordSet_ibase { 80 | 81 | var $databaseType = "borland_ibase"; 82 | 83 | function __construct($id,$mode=false) 84 | { 85 | parent::__construct($id,$mode); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /drivers/adodb-access.inc.php: -------------------------------------------------------------------------------- 1 | _connectionID); 61 | $rs = new ADORecordSet_odbc($qid); 62 | $ADODB_FETCH_MODE = $savem; 63 | if (!$rs) return false; 64 | 65 | $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change; 66 | 67 | $arr = $rs->GetArray(); 68 | //print_pre($arr); 69 | $arr2 = array(); 70 | for ($i=0; $i < sizeof($arr); $i++) { 71 | if ($arr[$i][2] && $arr[$i][3] != 'SYSTEM TABLE') 72 | $arr2[] = $arr[$i][2]; 73 | } 74 | return $arr2; 75 | }*/ 76 | } 77 | 78 | 79 | class ADORecordSet_access extends ADORecordSet_odbc { 80 | 81 | var $databaseType = "access"; 82 | 83 | function __construct($id,$mode=false) 84 | { 85 | return parent::__construct($id,$mode); 86 | } 87 | }// class 88 | } 89 | -------------------------------------------------------------------------------- /adodb-exceptions.inc.php: -------------------------------------------------------------------------------- 1 | sql = is_array($p1) ? $p1[0] : $p1; 35 | $this->params = $p2; 36 | $s = "$dbms error: [$errno: $errmsg] in $fn(\"$this->sql\")\n"; 37 | break; 38 | 39 | case 'PCONNECT': 40 | case 'CONNECT': 41 | $user = $thisConnection->user; 42 | $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n"; 43 | break; 44 | default: 45 | $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; 46 | break; 47 | } 48 | 49 | $this->dbms = $dbms; 50 | if ($thisConnection) { 51 | $this->host = $thisConnection->host; 52 | $this->database = $thisConnection->database; 53 | } 54 | $this->fn = $fn; 55 | $this->msg = $errmsg; 56 | 57 | if (!is_numeric($errno)) $errno = -1; 58 | parent::__construct($s,$errno); 59 | } 60 | } 61 | 62 | /** 63 | * Default Error Handler. This will be called with the following params 64 | * 65 | * @param $dbms the RDBMS you are connecting to 66 | * @param $fn the name of the calling function (in uppercase) 67 | * @param $errno the native error number from the database 68 | * @param $errmsg the native error msg from the database 69 | * @param $p1 $fn specific parameter - see below 70 | * @param $P2 $fn specific parameter - see below 71 | */ 72 | 73 | function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) 74 | { 75 | global $ADODB_EXCEPTION; 76 | 77 | if (error_reporting() == 0) return; // obey @ protocol 78 | if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; 79 | else $errfn = 'ADODB_EXCEPTION'; 80 | throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); 81 | } 82 | -------------------------------------------------------------------------------- /adodb-errorpear.inc.php: -------------------------------------------------------------------------------- 1 | !$s

"; 77 | } 78 | 79 | /** 80 | * Returns last PEAR_Error object. This error might be for an error that 81 | * occured several sql statements ago. 82 | */ 83 | function ADODB_PEAR_Error() 84 | { 85 | global $ADODB_Last_PEAR_Error; 86 | 87 | return $ADODB_Last_PEAR_Error; 88 | } 89 | -------------------------------------------------------------------------------- /tests/testpaging.php: -------------------------------------------------------------------------------- 1 | PConnect('localhost','tester','test','test'); 28 | } 29 | 30 | if ($driver == 'access') { 31 | $db = NewADOConnection('access'); 32 | $db->PConnect("nwind", "", "", ""); 33 | } 34 | 35 | if ($driver == 'ibase') { 36 | $db = NewADOConnection('ibase'); 37 | $db->PConnect("localhost:e:\\firebird\\examples\\employee.gdb", "sysdba", "masterkey", ""); 38 | $sql = 'select distinct firstname, lastname from adoxyz order by firstname'; 39 | 40 | } 41 | if ($driver == 'mssql') { 42 | $db = NewADOConnection('mssql'); 43 | $db->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind'); 44 | } 45 | if ($driver == 'oci8') { 46 | $db = NewADOConnection('oci8'); 47 | $db->Connect('','scott','natsoft'); 48 | 49 | $sql = "select * from (select ID, firstname as \"First Name\", lastname as \"Last Name\" from adoxyz 50 | order by 1)"; 51 | } 52 | 53 | if ($driver == 'access') { 54 | $db = NewADOConnection('access'); 55 | $db->Connect('nwind'); 56 | } 57 | 58 | if (empty($driver) or $driver == 'mysql') { 59 | $db = NewADOConnection('mysql'); 60 | $db->Connect('localhost','root','','test'); 61 | } 62 | 63 | //$db->pageExecuteCountRows = false; 64 | 65 | $db->debug = true; 66 | 67 | if (0) { 68 | $rs = $db->Execute($sql); 69 | include_once('../toexport.inc.php'); 70 | print "
";
71 | print rs2csv($rs); # return a string
72 | 
73 | print '
'; 74 | $rs->MoveFirst(); # note, some databases do not support MoveFirst 75 | print rs2tab($rs); # return a string 76 | 77 | print '
'; 78 | $rs->MoveFirst(); 79 | rs2tabout($rs); # send to stdout directly 80 | print "
"; 81 | } 82 | 83 | $pager = new ADODB_Pager($db,$sql); 84 | $pager->showPageLinks = true; 85 | $pager->linksPerPage = 10; 86 | $pager->cache = 60; 87 | $pager->Render($rows=7); 88 | -------------------------------------------------------------------------------- /session/adodb-compress-bzip2.php: -------------------------------------------------------------------------------- 1 | _block_size; 39 | } 40 | 41 | /** 42 | */ 43 | function setBlockSize($block_size) { 44 | assert('$block_size >= 1'); 45 | assert('$block_size <= 9'); 46 | $this->_block_size = (int) $block_size; 47 | } 48 | 49 | /** 50 | */ 51 | function getWorkLevel() { 52 | return $this->_work_level; 53 | } 54 | 55 | /** 56 | */ 57 | function setWorkLevel($work_level) { 58 | assert('$work_level >= 0'); 59 | assert('$work_level <= 250'); 60 | $this->_work_level = (int) $work_level; 61 | } 62 | 63 | /** 64 | */ 65 | function getMinLength() { 66 | return $this->_min_length; 67 | } 68 | 69 | /** 70 | */ 71 | function setMinLength($min_length) { 72 | assert('$min_length >= 0'); 73 | $this->_min_length = (int) $min_length; 74 | } 75 | 76 | /** 77 | */ 78 | function __construct($block_size = null, $work_level = null, $min_length = null) { 79 | if (!is_null($block_size)) { 80 | $this->setBlockSize($block_size); 81 | } 82 | 83 | if (!is_null($work_level)) { 84 | $this->setWorkLevel($work_level); 85 | } 86 | 87 | if (!is_null($min_length)) { 88 | $this->setMinLength($min_length); 89 | } 90 | } 91 | 92 | /** 93 | */ 94 | function write($data, $key) { 95 | if (strlen($data) < $this->_min_length) { 96 | return $data; 97 | } 98 | 99 | if (!is_null($this->_block_size)) { 100 | if (!is_null($this->_work_level)) { 101 | return bzcompress($data, $this->_block_size, $this->_work_level); 102 | } else { 103 | return bzcompress($data, $this->_block_size); 104 | } 105 | } 106 | 107 | return bzcompress($data); 108 | } 109 | 110 | /** 111 | */ 112 | function read($data, $key) { 113 | return $data ? bzdecompress($data) : $data; 114 | } 115 | 116 | } 117 | 118 | return 1; 119 | -------------------------------------------------------------------------------- /tests/testoci8.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | PConnect('','scott','natsoft'); 23 | if (!empty($testblob)) { 24 | $varHoldingBlob = 'ABC DEF GEF John TEST'; 25 | $num = time()%10240; 26 | // create table atable (id integer, ablob blob); 27 | $db->Execute('insert into ATABLE (id,ablob) values('.$num.',empty_blob())'); 28 | $db->UpdateBlob('ATABLE', 'ablob', $varHoldingBlob, 'id='.$num, 'BLOB'); 29 | 30 | $rs = $db->Execute('select * from atable'); 31 | 32 | if (!$rs) die("Empty RS"); 33 | if ($rs->EOF) die("EOF RS"); 34 | rs2html($rs); 35 | } 36 | $stmt = $db->Prepare('select * from adoxyz where id=?'); 37 | for ($i = 1; $i <= 10; $i++) { 38 | $rs = $db->Execute( 39 | $stmt, 40 | array($i)); 41 | 42 | if (!$rs) die("Empty RS"); 43 | if ($rs->EOF) die("EOF RS"); 44 | rs2html($rs); 45 | } 46 | } 47 | if (1) { 48 | $db = ADONewConnection('oci8'); 49 | $db->PConnect('','scott','natsoft'); 50 | $db->debug = true; 51 | $db->Execute("delete from emp where ename='John'"); 52 | print $db->Affected_Rows().'
'; 53 | $stmt = $db->Prepare('insert into emp (empno, ename) values (:empno, :ename)'); 54 | $rs = $db->Execute($stmt,array('empno'=>4321,'ename'=>'John')); 55 | // prepare not quite ready for prime time 56 | //$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John')); 57 | if (!$rs) die("Empty RS"); 58 | 59 | $db->setfetchmode(ADODB_FETCH_NUM); 60 | 61 | $vv = 'A%'; 62 | $stmt = $db->PrepareSP("BEGIN adodb.open_tab2(:rs,:tt); END;",true); 63 | $db->OutParameter($stmt, $cur, 'rs', -1, OCI_B_CURSOR); 64 | $db->OutParameter($stmt, $vv, 'tt'); 65 | $rs = $db->Execute($stmt); 66 | while (!$rs->EOF) { 67 | adodb_pr($rs->fields); 68 | $rs->MoveNext(); 69 | } 70 | echo " val = $vv"; 71 | 72 | } 73 | 74 | if (0) { 75 | $db = ADONewConnection('odbc_oracle'); 76 | if (!$db->PConnect('local_oracle','scott','tiger')) die('fail connect'); 77 | $db->debug = true; 78 | $rs = $db->Execute( 79 | 'select * from adoxyz where firstname=? and trim(lastname)=?', 80 | array('first'=>'Caroline','last'=>'Miranda')); 81 | if (!$rs) die("Empty RS"); 82 | if ($rs->EOF) die("EOF RS"); 83 | rs2html($rs); 84 | } 85 | -------------------------------------------------------------------------------- /drivers/adodb-oci8quercus.inc.php: -------------------------------------------------------------------------------- 1 | 17 | 18 | Should some emulation of RecordCount() be implemented? 19 | 20 | */ 21 | 22 | // security - hide paths 23 | if (!defined('ADODB_DIR')) die(); 24 | 25 | include_once(ADODB_DIR.'/drivers/adodb-oci8.inc.php'); 26 | 27 | class ADODB_oci8quercus extends ADODB_oci8 { 28 | var $databaseType = 'oci8quercus'; 29 | var $dataProvider = 'oci8'; 30 | 31 | function __construct() 32 | { 33 | } 34 | 35 | } 36 | 37 | /*-------------------------------------------------------------------------------------- 38 | Class Name: Recordset 39 | --------------------------------------------------------------------------------------*/ 40 | 41 | class ADORecordset_oci8quercus extends ADORecordset_oci8 { 42 | 43 | var $databaseType = 'oci8quercus'; 44 | 45 | function __construct($queryID,$mode=false) 46 | { 47 | parent::__construct($queryID,$mode); 48 | } 49 | 50 | function _FetchField($fieldOffset = -1) 51 | { 52 | global $QUERCUS; 53 | $fld = new ADOFieldObject; 54 | 55 | if (!empty($QUERCUS)) { 56 | $fld->name = oci_field_name($this->_queryID, $fieldOffset); 57 | $fld->type = oci_field_type($this->_queryID, $fieldOffset); 58 | $fld->max_length = oci_field_size($this->_queryID, $fieldOffset); 59 | 60 | //if ($fld->name == 'VAL6_NUM_12_4') $fld->type = 'NUMBER'; 61 | switch($fld->type) { 62 | case 'string': $fld->type = 'VARCHAR'; break; 63 | case 'real': $fld->type = 'NUMBER'; break; 64 | } 65 | } else { 66 | $fieldOffset += 1; 67 | $fld->name = oci_field_name($this->_queryID, $fieldOffset); 68 | $fld->type = oci_field_type($this->_queryID, $fieldOffset); 69 | $fld->max_length = oci_field_size($this->_queryID, $fieldOffset); 70 | } 71 | switch($fld->type) { 72 | case 'NUMBER': 73 | $p = oci_field_precision($this->_queryID, $fieldOffset); 74 | $sc = oci_field_scale($this->_queryID, $fieldOffset); 75 | if ($p != 0 && $sc == 0) $fld->type = 'INT'; 76 | $fld->scale = $p; 77 | break; 78 | 79 | case 'CLOB': 80 | case 'NCLOB': 81 | case 'BLOB': 82 | $fld->max_length = -1; 83 | break; 84 | } 85 | 86 | return $fld; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | Connect($host,$uid,$pwd,$database)) err($conn->ErrorNo(). $sep . $conn->ErrorMsg()); 84 | $sql = undomq($_REQUEST['sql']); 85 | 86 | if (isset($_REQUEST['fetch'])) 87 | $ADODB_FETCH_MODE = $_REQUEST['fetch']; 88 | 89 | if (isset($_REQUEST['nrows'])) { 90 | $nrows = $_REQUEST['nrows']; 91 | $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : -1; 92 | $rs = $conn->SelectLimit($sql,$nrows,$offset); 93 | } else 94 | $rs = $conn->Execute($sql); 95 | if ($rs){ 96 | //$rs->timeToLive = 1; 97 | echo _rs2serialize($rs,$conn,$sql); 98 | $rs->Close(); 99 | } else 100 | err($conn->ErrorNo(). $sep .$conn->ErrorMsg()); 101 | -------------------------------------------------------------------------------- /drivers/adodb-vfp.inc.php: -------------------------------------------------------------------------------- 1 | replaceQuote,$s))."'"; 50 | return "'".$s."'"; 51 | } 52 | 53 | 54 | // TOP requires ORDER BY for VFP 55 | function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0) 56 | { 57 | $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false; 58 | $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache); 59 | return $ret; 60 | } 61 | 62 | 63 | 64 | }; 65 | 66 | 67 | class ADORecordSet_vfp extends ADORecordSet_odbc { 68 | 69 | var $databaseType = "vfp"; 70 | 71 | 72 | function __construct($id,$mode=false) 73 | { 74 | return parent::__construct($id,$mode); 75 | } 76 | 77 | function MetaType($t, $len = -1, $fieldobj = false) 78 | { 79 | if (is_object($t)) { 80 | $fieldobj = $t; 81 | $t = $fieldobj->type; 82 | $len = $fieldobj->max_length; 83 | } 84 | switch (strtoupper($t)) { 85 | case 'C': 86 | if ($len <= $this->blobSize) return 'C'; 87 | case 'M': 88 | return 'X'; 89 | 90 | case 'D': return 'D'; 91 | 92 | case 'T': return 'T'; 93 | 94 | case 'L': return 'L'; 95 | 96 | case 'I': return 'I'; 97 | 98 | default: return 'N'; 99 | } 100 | } 101 | } 102 | 103 | } //define 104 | -------------------------------------------------------------------------------- /drivers/adodb-pdo_oci.inc.php: -------------------------------------------------------------------------------- 1 | _bindInputArray = true; 31 | $parentDriver->_nestedSQL = true; 32 | if ($this->_initdate) { 33 | $parentDriver->Execute("ALTER SESSION SET NLS_DATE_FORMAT='".$this->NLS_DATE_FORMAT."'"); 34 | } 35 | } 36 | 37 | function MetaTables($ttype=false,$showSchema=false,$mask=false) 38 | { 39 | if ($mask) { 40 | $save = $this->metaTablesSQL; 41 | $mask = $this->qstr(strtoupper($mask)); 42 | $this->metaTablesSQL .= " AND table_name like $mask"; 43 | } 44 | $ret = ADOConnection::MetaTables($ttype,$showSchema); 45 | 46 | if ($mask) { 47 | $this->metaTablesSQL = $save; 48 | } 49 | return $ret; 50 | } 51 | 52 | function MetaColumns($table,$normalize=true) 53 | { 54 | global $ADODB_FETCH_MODE; 55 | 56 | $false = false; 57 | $save = $ADODB_FETCH_MODE; 58 | $ADODB_FETCH_MODE = ADODB_FETCH_NUM; 59 | if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false); 60 | 61 | $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table))); 62 | 63 | if (isset($savem)) $this->SetFetchMode($savem); 64 | $ADODB_FETCH_MODE = $save; 65 | if (!$rs) { 66 | return $false; 67 | } 68 | $retarr = array(); 69 | while (!$rs->EOF) { //print_r($rs->fields); 70 | $fld = new ADOFieldObject(); 71 | $fld->name = $rs->fields[0]; 72 | $fld->type = $rs->fields[1]; 73 | $fld->max_length = $rs->fields[2]; 74 | $fld->scale = $rs->fields[3]; 75 | if ($rs->fields[1] == 'NUMBER' && $rs->fields[3] == 0) { 76 | $fld->type ='INT'; 77 | $fld->max_length = $rs->fields[4]; 78 | } 79 | $fld->not_null = (strncmp($rs->fields[5], 'NOT',3) === 0); 80 | $fld->binary = (strpos($fld->type,'BLOB') !== false); 81 | $fld->default_value = $rs->fields[6]; 82 | 83 | if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld; 84 | else $retarr[strtoupper($fld->name)] = $fld; 85 | $rs->MoveNext(); 86 | } 87 | $rs->Close(); 88 | if (empty($retarr)) 89 | return $false; 90 | else 91 | return $retarr; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /datadict/datadict-sqlite.inc.php: -------------------------------------------------------------------------------- 1 | debug) ADOConnection::outp("AlterColumnSQL not supported natively by SQLite"); 75 | return array(); 76 | } 77 | 78 | function DropColumnSQL($tabname, $flds, $tableflds='', $tableoptions='') 79 | { 80 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported natively by SQLite"); 81 | return array(); 82 | } 83 | 84 | function RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='') 85 | { 86 | if ($this->debug) ADOConnection::outp("RenameColumnSQL not supported natively by SQLite"); 87 | return array(); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /tests/testsessions.php: -------------------------------------------------------------------------------- 1 | Notify Expiring=$ref, sessionkey=$key

"; 18 | } 19 | 20 | //------------------------------------------------------------------- 21 | 22 | error_reporting(E_ALL); 23 | 24 | 25 | ob_start(); 26 | include('../session/adodb-cryptsession2.php'); 27 | 28 | 29 | $options['debug'] = 1; 30 | $db = 'postgres'; 31 | 32 | #### CONNECTION 33 | switch($db) { 34 | case 'oci8': 35 | $options['table'] = 'adodb_sessions2'; 36 | ADOdb_Session::config('oci8', 'mobydick', 'jdev', 'natsoft', 'mobydick',$options); 37 | break; 38 | 39 | case 'postgres': 40 | $options['table'] = 'sessions2'; 41 | ADOdb_Session::config('postgres', 'localhost', 'postgres', 'natsoft', 'northwind',$options); 42 | break; 43 | 44 | case 'mysql': 45 | default: 46 | $options['table'] = 'sessions2'; 47 | ADOdb_Session::config('mysql', 'localhost', 'root', '', 'xphplens_2',$options); 48 | break; 49 | 50 | 51 | } 52 | 53 | 54 | 55 | #### SETUP NOTIFICATION 56 | $USER = 'JLIM'.rand(); 57 | $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire'); 58 | 59 | adodb_session_create_table(); 60 | session_start(); 61 | 62 | adodb_session_regenerate_id(); 63 | 64 | ### SETUP SESSION VARIABLES 65 | if (empty($_SESSION['MONKEY'])) $_SESSION['MONKEY'] = array(1,'abc',44.41); 66 | else $_SESSION['MONKEY'][0] += 1; 67 | if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] += 1; 68 | 69 | 70 | ### START DISPLAY 71 | print "

PHP ".PHP_VERSION."

"; 72 | print "

\$_SESSION['AVAR']={$_SESSION['AVAR']}

"; 73 | 74 | print "
Cookies: "; 75 | print_r($_COOKIE); 76 | 77 | var_dump($_SESSION['MONKEY']); 78 | 79 | ### RANDOMLY PERFORM Garbage Collection 80 | ### In real-production environment, this is done for you 81 | ### by php's session extension, which calls adodb_sess_gc() 82 | ### automatically for you. See php.ini's 83 | ### session.cookie_lifetime and session.gc_probability 84 | 85 | if (rand() % 5 == 0) { 86 | 87 | print "

Garbage Collection

"; 88 | adodb_sess_gc(10); 89 | 90 | if (rand() % 2 == 0) { 91 | print "

Random own session destroy

"; 92 | session_destroy(); 93 | } 94 | } else { 95 | $DB = ADODB_Session::_conn(); 96 | $sessk = $DB->qstr('%AZ'.rand().time()); 97 | $olddate = $DB->DBTimeStamp(time()-30*24*3600); 98 | $rr = $DB->qstr(rand()); 99 | $DB->Execute("insert into {$options['table']} (sesskey,expiry,expireref,sessdata,created,modified) values ($sessk,$olddate, $rr,'',$olddate,$olddate)"); 100 | } 101 | -------------------------------------------------------------------------------- /adodb-errorhandler.inc.php: -------------------------------------------------------------------------------- 1 | $s

"; 79 | trigger_error($s,ADODB_ERROR_HANDLER_TYPE); 80 | } 81 | -------------------------------------------------------------------------------- /tests/test-php5.php: -------------------------------------------------------------------------------- 1 | PHP ".PHP_VERSION."\n"; 21 | try { 22 | 23 | $dbt = 'oci8po'; 24 | 25 | try { 26 | switch($dbt) { 27 | case 'oci8po': 28 | $db = NewADOConnection("oci8po"); 29 | 30 | $db->Connect('localhost','scott','natsoft','sherkhan'); 31 | break; 32 | default: 33 | case 'mysql': 34 | $db = NewADOConnection("mysql"); 35 | $db->Connect('localhost','root','','northwind'); 36 | break; 37 | 38 | case 'mysqli': 39 | $db = NewADOConnection("mysqli://root:@localhost/northwind"); 40 | //$db->Connect('localhost','root','','test'); 41 | break; 42 | } 43 | } catch (exception $e){ 44 | echo "Connect Failed"; 45 | adodb_pr($e); 46 | die(); 47 | } 48 | 49 | $db->debug=1; 50 | 51 | $cnt = $db->GetOne("select count(*) from adoxyz where ?Prepare("select * from adoxyz where ?ErrorMsg(),"\n"; 54 | $rs = $db->Execute($stmt,array(10,20)); 55 | 56 | echo "
Foreach Iterator Test (rand=".rand().")
"; 57 | $i = 0; 58 | foreach($rs as $v) { 59 | $i += 1; 60 | echo "rec $i: "; $s1 = adodb_pr($v,true); $s2 = adodb_pr($rs->fields,true); 61 | if ($s1 != $s2 && !empty($v)) {adodb_pr($s1); adodb_pr($s2);} 62 | else echo "passed
"; 63 | flush(); 64 | } 65 | 66 | $rs = new ADORecordSet_empty(); 67 | foreach($rs as $v) { 68 | echo "

empty ";var_dump($v); 69 | } 70 | 71 | 72 | if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n"); 73 | else echo "Count $i is correct
"; 74 | 75 | $rs = $db->Execute("select bad from badder"); 76 | 77 | } catch (exception $e) { 78 | adodb_pr($e); 79 | echo "

adodb_backtrace:

\n"; 80 | $e = adodb_backtrace($e->gettrace()); 81 | } 82 | 83 | $rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order by id"); 84 | echo "Result=\n",$rs,"

"; 85 | 86 | echo "

Active Record

"; 87 | 88 | include_once("../adodb-active-record.inc.php"); 89 | ADOdb_Active_Record::SetDatabaseAdapter($db); 90 | 91 | try { 92 | class City extends ADOdb_Active_Record{}; 93 | $a = new City(); 94 | 95 | } catch(exception $e){ 96 | echo $e->getMessage(); 97 | } 98 | 99 | try { 100 | 101 | $a = new City(); 102 | 103 | echo "

Successfully created City()
"; 104 | #var_dump($a->GetPrimaryKeys()); 105 | $a->city = 'Kuala Lumpur'; 106 | $a->Save(); 107 | $a->Update(); 108 | #$a->SetPrimaryKeys(array('city')); 109 | $a->country = "M'sia"; 110 | $a->save(); 111 | $a->Delete(); 112 | } catch(exception $e){ 113 | echo $e->getMessage(); 114 | } 115 | 116 | //include_once("test-active-record.php"); 117 | -------------------------------------------------------------------------------- /datadict/datadict-generic.inc.php: -------------------------------------------------------------------------------- 1 | debug) ADOConnection::outp("AlterColumnSQL not supported"); 57 | return array(); 58 | } 59 | 60 | 61 | function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') 62 | { 63 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); 64 | return array(); 65 | } 66 | 67 | } 68 | 69 | /* 70 | //db2 71 | function ActualType($meta) 72 | { 73 | switch($meta) { 74 | case 'C': return 'VARCHAR'; 75 | case 'X': return 'VARCHAR'; 76 | 77 | case 'C2': return 'VARCHAR'; // up to 32K 78 | case 'X2': return 'VARCHAR'; 79 | 80 | case 'B': return 'BLOB'; 81 | 82 | case 'D': return 'DATE'; 83 | case 'T': return 'TIMESTAMP'; 84 | 85 | case 'L': return 'SMALLINT'; 86 | case 'I': return 'INTEGER'; 87 | case 'I1': return 'SMALLINT'; 88 | case 'I2': return 'SMALLINT'; 89 | case 'I4': return 'INTEGER'; 90 | case 'I8': return 'BIGINT'; 91 | 92 | case 'F': return 'DOUBLE'; 93 | case 'N': return 'DECIMAL'; 94 | default: 95 | return $meta; 96 | } 97 | } 98 | 99 | // ifx 100 | function ActualType($meta) 101 | { 102 | switch($meta) { 103 | case 'C': return 'VARCHAR';// 255 104 | case 'X': return 'TEXT'; 105 | 106 | case 'C2': return 'NVARCHAR'; 107 | case 'X2': return 'TEXT'; 108 | 109 | case 'B': return 'BLOB'; 110 | 111 | case 'D': return 'DATE'; 112 | case 'T': return 'DATETIME'; 113 | 114 | case 'L': return 'SMALLINT'; 115 | case 'I': return 'INTEGER'; 116 | case 'I1': return 'SMALLINT'; 117 | case 'I2': return 'SMALLINT'; 118 | case 'I4': return 'INTEGER'; 119 | case 'I8': return 'DECIMAL(20)'; 120 | 121 | case 'F': return 'FLOAT'; 122 | case 'N': return 'DECIMAL'; 123 | default: 124 | return $meta; 125 | } 126 | } 127 | */ 128 | -------------------------------------------------------------------------------- /tests/test-active-relations.php: -------------------------------------------------------------------------------- 1 | debug=1; 9 | ADOdb_Active_Record::SetDatabaseAdapter($db); 10 | 11 | $db->Execute("CREATE TEMPORARY TABLE `persons` ( 12 | `id` int(10) unsigned NOT NULL auto_increment, 13 | `name_first` varchar(100) NOT NULL default '', 14 | `name_last` varchar(100) NOT NULL default '', 15 | `favorite_color` varchar(100) NOT NULL default '', 16 | PRIMARY KEY (`id`) 17 | ) ENGINE=MyISAM; 18 | "); 19 | 20 | $db->Execute("CREATE TEMPORARY TABLE `children` ( 21 | `id` int(10) unsigned NOT NULL auto_increment, 22 | `person_id` int(10) unsigned NOT NULL, 23 | `name_first` varchar(100) NOT NULL default '', 24 | `name_last` varchar(100) NOT NULL default '', 25 | `favorite_pet` varchar(100) NOT NULL default '', 26 | PRIMARY KEY (`id`) 27 | ) ENGINE=MyISAM; 28 | "); 29 | 30 | 31 | $db->Execute("insert into children (person_id,name_first,name_last) values (1,'Jill','Lim')"); 32 | $db->Execute("insert into children (person_id,name_first,name_last) values (1,'Joan','Lim')"); 33 | $db->Execute("insert into children (person_id,name_first,name_last) values (1,'JAMIE','Lim')"); 34 | 35 | ADODB_Active_Record::TableHasMany('persons', 'children','person_id'); 36 | class person extends ADOdb_Active_Record{} 37 | 38 | $person = new person(); 39 | # $person->HasMany('children','person_id'); ## this is affects all other instances of Person 40 | 41 | $person->name_first = 'John'; 42 | $person->name_last = 'Lim'; 43 | $person->favorite_color = 'lavender'; 44 | $person->save(); // this save will perform an INSERT successfully 45 | 46 | $person2 = new person(); 47 | $person2->Load('id=1'); 48 | 49 | $c = $person2->children; 50 | if (is_array($c) && sizeof($c) == 3 && $c[0]->name_first=='Jill' && $c[1]->name_first=='Joan' 51 | && $c[2]->name_first == 'JAMIE') echo "OK Loaded HasMany
"; 52 | else { 53 | var_dump($c); 54 | echo "error loading hasMany should have 3 array elements Jill Joan Jamie
"; 55 | } 56 | 57 | class child extends ADOdb_Active_Record{}; 58 | ADODB_Active_Record::TableBelongsTo('children','person','person_id','id'); 59 | $ch = new Child('children',array('id')); 60 | 61 | $ch->Load('id=1'); 62 | if ($ch->name_first !== 'Jill') echo "error in Loading Child
"; 63 | 64 | $p = $ch->person; 65 | if (!$p || $p->name_first != 'John') echo "Error loading belongsTo
"; 66 | else echo "OK loading BelongTo
"; 67 | 68 | if ($p) { 69 | #$p->HasMany('children','person_id'); ## this is affects all other instances of Person 70 | $p->LoadRelations('children', 'order by id',1,2); 71 | if (sizeof($p->children) == 2 && $p->children[1]->name_first == 'JAMIE') echo "OK LoadRelations
"; 72 | else { 73 | var_dump($p->children); 74 | echo "error LoadRelations
"; 75 | } 76 | 77 | unset($p->children); 78 | $p->LoadRelations('children', " name_first like 'J%' order by id",1,2); 79 | } 80 | if ($p) 81 | foreach($p->children as $c) { 82 | echo " Saving $c->name_first
"; 83 | $c->name_first .= ' K.'; 84 | $c->Save(); 85 | } 86 | -------------------------------------------------------------------------------- /tests/testoci8cursor.php: -------------------------------------------------------------------------------- 1 | PConnect('','scott','natsoft'); 66 | $db->debug = 99; 67 | 68 | 69 | /* 70 | */ 71 | 72 | define('MYNUM',5); 73 | 74 | 75 | $rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:RS,'A%'); END;"); 76 | 77 | if ($rs && !$rs->EOF) { 78 | print "Test 1 RowCount: ".$rs->RecordCount()."

"; 79 | } else { 80 | print "Error in using Cursor Variables 1

"; 81 | } 82 | 83 | print "

Testing Stored Procedures for oci8

"; 84 | 85 | $stid = $db->PrepareSP('BEGIN adodb.myproc('.MYNUM.', :myov); END;'); 86 | $db->OutParameter($stid, $myov, 'myov'); 87 | $db->Execute($stid); 88 | if ($myov != MYNUM) print "

Error with myproc

"; 89 | 90 | 91 | $stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;",true); 92 | $a1 = 'Malaysia'; 93 | //$a2 = ''; # a2 doesn't even need to be defined! 94 | $db->InParameter($stmt,$a1,'a1'); 95 | $db->OutParameter($stmt,$a2,'a2'); 96 | $rs = $db->Execute($stmt); 97 | if ($rs) { 98 | if ($a2 !== 'Cinta Hati Malaysia') print "Stored Procedure Error: a2 = $a2

"; 99 | else echo "OK: a2=$a2

"; 100 | } else { 101 | print "Error in using Stored Procedure IN/Out Variables

"; 102 | } 103 | 104 | 105 | $tname = 'A%'; 106 | 107 | $stmt = $db->PrepareSP('select * from tab where tname like :tablename'); 108 | $db->Parameter($stmt,$tname,'tablename'); 109 | $rs = $db->Execute($stmt); 110 | rs2html($rs); 111 | -------------------------------------------------------------------------------- /session/crypt.inc.php: -------------------------------------------------------------------------------- 1 | 3 | class MD5Crypt{ 4 | function keyED($txt,$encrypt_key) 5 | { 6 | $encrypt_key = md5($encrypt_key); 7 | $ctr=0; 8 | $tmp = ""; 9 | for ($i=0;$ikeyED($tmp,$key)); 31 | } 32 | 33 | function Decrypt($txt,$key) 34 | { 35 | $txt = $this->keyED(base64_decode($txt),$key); 36 | $tmp = ""; 37 | for ($i=0;$i= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96)) 54 | { 55 | $randnumber = rand(48,120); 56 | } 57 | 58 | $randomPassword .= chr($randnumber); 59 | } 60 | return $randomPassword; 61 | } 62 | 63 | } 64 | 65 | 66 | class SHA1Crypt{ 67 | function keyED($txt,$encrypt_key) 68 | { 69 | 70 | $encrypt_key = sha1($encrypt_key); 71 | $ctr=0; 72 | $tmp = ""; 73 | 74 | for ($i=0;$ikeyED($tmp,$key)); 106 | 107 | } 108 | 109 | 110 | 111 | function Decrypt($txt,$key) 112 | { 113 | 114 | $txt = $this->keyED(base64_decode($txt),$key); 115 | 116 | $tmp = ""; 117 | 118 | for ($i=0;$i= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96)) 144 | { 145 | $randnumber = rand(48,120); 146 | } 147 | 148 | $randomPassword .= chr($randnumber); 149 | } 150 | 151 | return $randomPassword; 152 | 153 | } 154 | 155 | 156 | 157 | } 158 | -------------------------------------------------------------------------------- /perf/perf-db2.inc.php: -------------------------------------------------------------------------------- 1 | array('RATIO', 36 | "SELECT 37 | case when sum(POOL_DATA_L_READS+POOL_INDEX_L_READS)=0 then 0 38 | else 100*(1-sum(POOL_DATA_P_READS+POOL_INDEX_P_READS)/sum(POOL_DATA_L_READS+POOL_INDEX_L_READS)) end 39 | FROM TABLE(SNAPSHOT_APPL('',-2)) as t", 40 | '=WarnCacheRatio'), 41 | 42 | 'Data Cache', 43 | 'data cache buffers' => array('DATAC', 44 | 'select sum(npages) from SYSCAT.BUFFERPOOLS', 45 | 'See tuning reference.' ), 46 | 'cache blocksize' => array('DATAC', 47 | 'select avg(pagesize) from SYSCAT.BUFFERPOOLS', 48 | '' ), 49 | 'data cache size' => array('DATAC', 50 | 'select sum(npages*pagesize) from SYSCAT.BUFFERPOOLS', 51 | '' ), 52 | 'Connections', 53 | 'current connections' => array('SESS', 54 | "SELECT count(*) FROM TABLE(SNAPSHOT_APPL_INFO('',-2)) as t", 55 | ''), 56 | 57 | false 58 | ); 59 | 60 | 61 | function __construct(&$conn) 62 | { 63 | $this->conn = $conn; 64 | } 65 | 66 | function Explain($sql,$partial=false) 67 | { 68 | $save = $this->conn->LogSQL(false); 69 | if ($partial) { 70 | $sqlq = $this->conn->qstr($sql.'%'); 71 | $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq"); 72 | if ($arr) { 73 | foreach($arr as $row) { 74 | $sql = reset($row); 75 | if (crc32($sql) == $partial) break; 76 | } 77 | } 78 | } 79 | $qno = rand(); 80 | $ok = $this->conn->Execute("EXPLAIN PLAN SET QUERYNO=$qno FOR $sql"); 81 | ob_start(); 82 | if (!$ok) echo "

Have EXPLAIN tables been created?

"; 83 | else { 84 | $rs = $this->conn->Execute("select * from explain_statement where queryno=$qno"); 85 | if ($rs) rs2html($rs); 86 | } 87 | $s = ob_get_contents(); 88 | ob_end_clean(); 89 | $this->conn->LogSQL($save); 90 | 91 | $s .= $this->Tracer($sql); 92 | return $s; 93 | } 94 | 95 | /** 96 | * Gets a list of tables 97 | * 98 | * @param int $throwaway discarded variable to match the parent method 99 | * @return string The formatted table list 100 | */ 101 | function Tables($throwaway=0) 102 | { 103 | $rs = $this->conn->Execute("select tabschema,tabname,card as rows, 104 | npages pages_used,fpages pages_allocated, tbspace tablespace 105 | from syscat.tables where tabschema not in ('SYSCAT','SYSIBM','SYSSTAT') order by 1,2"); 106 | return rs2html($rs,false,false,false,false); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /drivers/adodb-odbc_oracle.inc.php: -------------------------------------------------------------------------------- 1 | Execute($this->metaTablesSQL); 40 | if ($rs === false) return $false; 41 | $arr = $rs->GetArray(); 42 | $arr2 = array(); 43 | for ($i=0; $i < sizeof($arr); $i++) { 44 | $arr2[] = $arr[$i][0]; 45 | } 46 | $rs->Close(); 47 | return $arr2; 48 | } 49 | 50 | function MetaColumns($table, $normalize=true) 51 | { 52 | global $ADODB_FETCH_MODE; 53 | 54 | $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table))); 55 | if ($rs === false) { 56 | $false = false; 57 | return $false; 58 | } 59 | $retarr = array(); 60 | while (!$rs->EOF) { //print_r($rs->fields); 61 | $fld = new ADOFieldObject(); 62 | $fld->name = $rs->fields[0]; 63 | $fld->type = $rs->fields[1]; 64 | $fld->max_length = $rs->fields[2]; 65 | 66 | 67 | if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld; 68 | else $retarr[strtoupper($fld->name)] = $fld; 69 | 70 | $rs->MoveNext(); 71 | } 72 | $rs->Close(); 73 | return $retarr; 74 | } 75 | 76 | // returns true or false 77 | function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) 78 | { 79 | global $php_errormsg; 80 | 81 | $php_errormsg = ''; 82 | $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); 83 | $this->_errorMsg = $php_errormsg; 84 | 85 | $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); 86 | //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); 87 | return $this->_connectionID != false; 88 | } 89 | // returns true or false 90 | function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) 91 | { 92 | global $php_errormsg; 93 | $php_errormsg = ''; 94 | $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC ); 95 | $this->_errorMsg = $php_errormsg; 96 | 97 | $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); 98 | //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); 99 | return $this->_connectionID != false; 100 | } 101 | } 102 | 103 | class ADORecordSet_odbc_oracle extends ADORecordSet_odbc { 104 | 105 | var $databaseType = 'odbc_oracle'; 106 | 107 | function __construct($id,$mode=false) 108 | { 109 | return parent::__construct($id,$mode); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /drivers/adodb-mysqlpo.inc.php: -------------------------------------------------------------------------------- 1 | 14 | 15 | This driver extends the deprecated mysql driver, and was originally designed to be a 16 | portable driver in the same manner as oci8po and mssqlpo. Its functionality 17 | is exactly duplicated in the mysqlt driver, which is itself deprecated. 18 | This driver will be removed in ADOdb version 6.0.0. 19 | 20 | Requires mysql client. Works on Windows and Unix. 21 | */ 22 | 23 | // security - hide paths 24 | if (!defined('ADODB_DIR')) die(); 25 | 26 | include_once(ADODB_DIR."/drivers/adodb-mysql.inc.php"); 27 | 28 | 29 | class ADODB_mysqlt extends ADODB_mysql { 30 | var $databaseType = 'mysqlt'; 31 | var $ansiOuter = true; // for Version 3.23.17 or later 32 | var $hasTransactions = true; 33 | var $autoRollback = true; // apparently mysql does not autorollback properly 34 | 35 | function __construct() 36 | { 37 | global $ADODB_EXTENSION; if ($ADODB_EXTENSION) $this->rsPrefix .= 'ext_'; 38 | } 39 | 40 | function BeginTrans() 41 | { 42 | if ($this->transOff) return true; 43 | $this->transCnt += 1; 44 | $this->Execute('SET AUTOCOMMIT=0'); 45 | $this->Execute('BEGIN'); 46 | return true; 47 | } 48 | 49 | function CommitTrans($ok=true) 50 | { 51 | if ($this->transOff) return true; 52 | if (!$ok) return $this->RollbackTrans(); 53 | 54 | if ($this->transCnt) $this->transCnt -= 1; 55 | $this->Execute('COMMIT'); 56 | $this->Execute('SET AUTOCOMMIT=1'); 57 | return true; 58 | } 59 | 60 | function RollbackTrans() 61 | { 62 | if ($this->transOff) return true; 63 | if ($this->transCnt) $this->transCnt -= 1; 64 | $this->Execute('ROLLBACK'); 65 | $this->Execute('SET AUTOCOMMIT=1'); 66 | return true; 67 | } 68 | 69 | function RowLock($tables,$where='',$col='1 as adodbignore') 70 | { 71 | if ($this->transCnt==0) $this->BeginTrans(); 72 | if ($where) $where = ' where '.$where; 73 | $rs = $this->Execute("select $col from $tables $where for update"); 74 | return !empty($rs); 75 | } 76 | 77 | } 78 | 79 | class ADORecordSet_mysqlt extends ADORecordSet_mysql{ 80 | var $databaseType = "mysqlt"; 81 | 82 | function __construct($queryID,$mode=false) 83 | { 84 | if ($mode === false) { 85 | global $ADODB_FETCH_MODE; 86 | $mode = $ADODB_FETCH_MODE; 87 | } 88 | 89 | switch ($mode) 90 | { 91 | case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break; 92 | case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break; 93 | 94 | case ADODB_FETCH_DEFAULT: 95 | case ADODB_FETCH_BOTH: 96 | default: $this->fetchMode = MYSQL_BOTH; break; 97 | } 98 | 99 | $this->adodbFetchMode = $mode; 100 | parent::__construct($queryID); 101 | } 102 | 103 | function MoveNext() 104 | { 105 | if (@$this->fields = mysql_fetch_array($this->_queryID,$this->fetchMode)) { 106 | $this->_currentRow += 1; 107 | return true; 108 | } 109 | if (!$this->EOF) { 110 | $this->_currentRow += 1; 111 | $this->EOF = true; 112 | } 113 | return false; 114 | } 115 | } 116 | 117 | class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt { 118 | 119 | function __construct($queryID,$mode=false) 120 | { 121 | parent::__construct($queryID,$mode); 122 | } 123 | 124 | function MoveNext() 125 | { 126 | return adodb_movenext($this); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /scripts/uploadrelease.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python -u 2 | ''' 3 | ADOdb release upload script 4 | ''' 5 | 6 | import getopt 7 | import glob 8 | import os 9 | from os import path 10 | import subprocess 11 | import sys 12 | 13 | 14 | # Directories and files to exclude from release tarballs 15 | sf_files = "frs.sourceforge.net:/home/frs/project/adodb" \ 16 | "/adodb-php5-only/adodb-{ver}-for-php5/" 17 | sf_doc = "web.sourceforge.net:/home/project-web/adodb/htdocs/" 18 | rsync_cmd = "rsync -vP --rsh ssh {opt} {src} {usr}@{dst}" 19 | 20 | # Command-line options 21 | options = "hfd" 22 | long_options = ["help", "files", "doc"] 23 | 24 | 25 | def usage(): 26 | print '''Usage: %s [options] username [release_path] 27 | 28 | This script will upload the files in the given directory (or the 29 | current one if unspecified) to Sourceforge. 30 | 31 | Parameters: 32 | username Sourceforge user account 33 | release_path Location of the release files to upload 34 | (see buildrelease.py) 35 | 36 | Options: 37 | -h | --help Show this usage message 38 | -f | --files Upload release files only 39 | -d | --doc Upload documentation only 40 | ''' % ( 41 | path.basename(__file__) 42 | ) 43 | #end usage() 44 | 45 | 46 | def main(): 47 | # Get command-line options 48 | try: 49 | opts, args = getopt.gnu_getopt(sys.argv[1:], options, long_options) 50 | except getopt.GetoptError, err: 51 | print str(err) 52 | usage() 53 | sys.exit(2) 54 | 55 | if len(args) < 1: 56 | usage() 57 | print "ERROR: please specify the Sourceforge user and release_path" 58 | sys.exit(1) 59 | 60 | upload_files = True 61 | upload_doc = True 62 | 63 | for opt, val in opts: 64 | if opt in ("-h", "--help"): 65 | usage() 66 | sys.exit(0) 67 | 68 | elif opt in ("-f", "--files"): 69 | upload_doc = False 70 | 71 | elif opt in ("-d", "--doc"): 72 | upload_files = False 73 | 74 | # Mandatory parameters 75 | username = args[0] 76 | 77 | try: 78 | release_path = args[1] 79 | os.chdir(release_path) 80 | except IndexError: 81 | release_path = os.getcwd() 82 | 83 | # Upload release files 84 | if upload_files: 85 | # Get the version number from the zip file to upload 86 | try: 87 | zipfile = glob.glob('*.zip')[0] 88 | except IndexError: 89 | print "ERROR: release zip file not found in '%s'" % release_path 90 | sys.exit(1) 91 | version = zipfile[5:8] 92 | 93 | # Start upload process 94 | print "ADOdb release upload script" 95 | 96 | target = sf_files.format(ver=version) 97 | print 98 | print "Uploading release files..." 99 | print " Target: " + target 100 | print 101 | subprocess.call( 102 | rsync_cmd.format( 103 | usr=username, 104 | opt="--exclude=docs", 105 | src=path.join(release_path, "*"), 106 | dst=target 107 | ), 108 | shell=True 109 | ) 110 | 111 | # Upload documentation 112 | if upload_doc: 113 | print 114 | print "Uploading documentation..." 115 | print 116 | subprocess.call( 117 | rsync_cmd.format( 118 | usr=username, 119 | opt="", 120 | src=path.join(release_path, "docs", "*"), 121 | dst=sf_doc 122 | ), 123 | shell=True 124 | ) 125 | 126 | #end main() 127 | 128 | if __name__ == "__main__": 129 | main() 130 | -------------------------------------------------------------------------------- /drivers/adodb-sybase_ase.inc.php: -------------------------------------------------------------------------------- 1 | metaTablesSQL) { 34 | // complicated state saving by the need for backward compat 35 | 36 | if ($ttype == 'VIEWS'){ 37 | $sql = str_replace('U', 'V', $this->metaTablesSQL); 38 | }elseif (false === $ttype){ 39 | $sql = str_replace('U',"U' OR type='V", $this->metaTablesSQL); 40 | }else{ // TABLES OR ANY OTHER 41 | $sql = $this->metaTablesSQL; 42 | } 43 | $rs = $this->Execute($sql); 44 | 45 | if ($rs === false || !method_exists($rs, 'GetArray')){ 46 | return $false; 47 | } 48 | $arr = $rs->GetArray(); 49 | 50 | $arr2 = array(); 51 | foreach($arr as $key=>$value){ 52 | $arr2[] = trim($value['name']); 53 | } 54 | return $arr2; 55 | } 56 | return $false; 57 | } 58 | 59 | function MetaDatabases() 60 | { 61 | $arr = array(); 62 | if ($this->metaDatabasesSQL!='') { 63 | $rs = $this->Execute($this->metaDatabasesSQL); 64 | if ($rs && !$rs->EOF){ 65 | while (!$rs->EOF){ 66 | $arr[] = $rs->Fields('name'); 67 | $rs->MoveNext(); 68 | } 69 | return $arr; 70 | } 71 | } 72 | return false; 73 | } 74 | 75 | // fix a bug which prevent the metaColumns query to be executed for Sybase ASE 76 | function MetaColumns($table,$upper=false) 77 | { 78 | $false = false; 79 | if (!empty($this->metaColumnsSQL)) { 80 | 81 | $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table)); 82 | if ($rs === false) return $false; 83 | 84 | $retarr = array(); 85 | while (!$rs->EOF) { 86 | $fld = new ADOFieldObject(); 87 | $fld->name = $rs->Fields('field_name'); 88 | $fld->type = $rs->Fields('type'); 89 | $fld->max_length = $rs->Fields('width'); 90 | $retarr[strtoupper($fld->name)] = $fld; 91 | $rs->MoveNext(); 92 | } 93 | $rs->Close(); 94 | return $retarr; 95 | } 96 | return $false; 97 | } 98 | 99 | function getProcedureList($schema) 100 | { 101 | return false; 102 | } 103 | 104 | function ErrorMsg() 105 | { 106 | if (!function_exists('sybase_connect')){ 107 | return 'Your PHP doesn\'t contain the Sybase connection module!'; 108 | } 109 | return parent::ErrorMsg(); 110 | } 111 | } 112 | 113 | class adorecordset_sybase_ase extends ADORecordset_sybase { 114 | var $databaseType = "sybase_ase"; 115 | function __construct($id,$mode=false) 116 | { 117 | parent::__construct($id,$mode); 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /datadict/datadict-sapdb.inc.php: -------------------------------------------------------------------------------- 1 | type; 60 | $len = $fieldobj->max_length; 61 | } 62 | static $maxdb_type2adodb = array( 63 | 'VARCHAR' => 'C', 64 | 'CHARACTER' => 'C', 65 | 'LONG' => 'X', // no way to differ between 'X' and 'B' :-( 66 | 'DATE' => 'D', 67 | 'TIMESTAMP' => 'T', 68 | 'BOOLEAN' => 'L', 69 | 'INTEGER' => 'I4', 70 | 'SMALLINT' => 'I2', 71 | 'FLOAT' => 'F', 72 | 'FIXED' => 'N', 73 | ); 74 | $type = isset($maxdb_type2adodb[$t]) ? $maxdb_type2adodb[$t] : 'C'; 75 | 76 | // convert integer-types simulated with fixed back to integer 77 | if ($t == 'FIXED' && !$fieldobj->scale && ($len == 20 || $len == 3)) { 78 | $type = $len == 20 ? 'I8' : 'I1'; 79 | } 80 | if ($fieldobj->auto_increment) $type = 'R'; 81 | 82 | return $type; 83 | } 84 | 85 | // return string must begin with space 86 | function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) 87 | { 88 | $suffix = ''; 89 | if ($funsigned) $suffix .= ' UNSIGNED'; 90 | if ($fnotnull) $suffix .= ' NOT NULL'; 91 | if ($fautoinc) $suffix .= ' DEFAULT SERIAL'; 92 | elseif (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; 93 | if ($fconstraint) $suffix .= ' '.$fconstraint; 94 | return $suffix; 95 | } 96 | 97 | function AddColumnSQL($tabname, $flds) 98 | { 99 | $tabname = $this->TableName ($tabname); 100 | $sql = array(); 101 | list($lines,$pkey) = $this->_GenFields($flds); 102 | return array( 'ALTER TABLE ' . $tabname . ' ADD (' . implode(', ',$lines) . ')' ); 103 | } 104 | 105 | function AlterColumnSQL($tabname, $flds, $tableflds='', $tableoptions='') 106 | { 107 | $tabname = $this->TableName ($tabname); 108 | $sql = array(); 109 | list($lines,$pkey) = $this->_GenFields($flds); 110 | return array( 'ALTER TABLE ' . $tabname . ' MODIFY (' . implode(', ',$lines) . ')' ); 111 | } 112 | 113 | function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') 114 | { 115 | $tabname = $this->TableName ($tabname); 116 | if (!is_array($flds)) $flds = explode(',',$flds); 117 | foreach($flds as $k => $v) { 118 | $flds[$k] = $this->NameQuote($v); 119 | } 120 | return array( 'ALTER TABLE ' . $tabname . ' DROP (' . implode(', ',$flds) . ')' ); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /toexport.inc.php: -------------------------------------------------------------------------------- 1 | FieldTypesArray(); 77 | reset($fieldTypes); 78 | $i = 0; 79 | $elements = array(); 80 | while(list(,$o) = each($fieldTypes)) { 81 | 82 | $v = ($o) ? $o->name : 'Field'.($i++); 83 | if ($escquote) $v = str_replace($quote,$escquotequote,$v); 84 | $v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v)))); 85 | $elements[] = $v; 86 | 87 | } 88 | $s .= implode($sep, $elements).$NEWLINE; 89 | } 90 | $hasNumIndex = isset($rs->fields[0]); 91 | 92 | $line = 0; 93 | $max = $rs->FieldCount(); 94 | 95 | while (!$rs->EOF) { 96 | $elements = array(); 97 | $i = 0; 98 | 99 | if ($hasNumIndex) { 100 | for ($j=0; $j < $max; $j++) { 101 | $v = $rs->fields[$j]; 102 | if (!is_object($v)) $v = trim($v); 103 | else $v = 'Object'; 104 | if ($escquote) $v = str_replace($quote,$escquotequote,$v); 105 | $v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v)))); 106 | 107 | if (strpos($v,$sep) !== false || strpos($v,$quote) !== false) $elements[] = "$quote$v$quote"; 108 | else $elements[] = $v; 109 | } 110 | } else { // ASSOCIATIVE ARRAY 111 | foreach($rs->fields as $v) { 112 | if ($escquote) $v = str_replace($quote,$escquotequote,trim($v)); 113 | $v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v)))); 114 | 115 | if (strpos($v,$sep) !== false || strpos($v,$quote) !== false) $elements[] = "$quote$v$quote"; 116 | else $elements[] = $v; 117 | } 118 | } 119 | $s .= implode($sep, $elements).$NEWLINE; 120 | $rs->MoveNext(); 121 | $line += 1; 122 | if ($fp && ($line % $BUFLINES) == 0) { 123 | if ($fp === true) echo $s; 124 | else fwrite($fp,$s); 125 | $s = ''; 126 | } 127 | } 128 | 129 | if ($fp) { 130 | if ($fp === true) echo $s; 131 | else fwrite($fp,$s); 132 | $s = ''; 133 | } 134 | 135 | return $s; 136 | } 137 | -------------------------------------------------------------------------------- /drivers/adodb-mysqlt.inc.php: -------------------------------------------------------------------------------- 1 | rsPrefix .= 'ext_'; 35 | } 36 | 37 | /* set transaction mode 38 | 39 | SET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL 40 | { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } 41 | 42 | */ 43 | function SetTransactionMode( $transaction_mode ) 44 | { 45 | $this->_transmode = $transaction_mode; 46 | if (empty($transaction_mode)) { 47 | $this->Execute('SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ'); 48 | return; 49 | } 50 | if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode; 51 | $this->Execute("SET SESSION TRANSACTION ".$transaction_mode); 52 | } 53 | 54 | function BeginTrans() 55 | { 56 | if ($this->transOff) return true; 57 | $this->transCnt += 1; 58 | $this->Execute('SET AUTOCOMMIT=0'); 59 | $this->Execute('BEGIN'); 60 | return true; 61 | } 62 | 63 | function CommitTrans($ok=true) 64 | { 65 | if ($this->transOff) return true; 66 | if (!$ok) return $this->RollbackTrans(); 67 | 68 | if ($this->transCnt) $this->transCnt -= 1; 69 | $ok = $this->Execute('COMMIT'); 70 | $this->Execute('SET AUTOCOMMIT=1'); 71 | return $ok ? true : false; 72 | } 73 | 74 | function RollbackTrans() 75 | { 76 | if ($this->transOff) return true; 77 | if ($this->transCnt) $this->transCnt -= 1; 78 | $ok = $this->Execute('ROLLBACK'); 79 | $this->Execute('SET AUTOCOMMIT=1'); 80 | return $ok ? true : false; 81 | } 82 | 83 | function RowLock($tables,$where='',$col='1 as adodbignore') 84 | { 85 | if ($this->transCnt==0) $this->BeginTrans(); 86 | if ($where) $where = ' where '.$where; 87 | $rs = $this->Execute("select $col from $tables $where for update"); 88 | return !empty($rs); 89 | } 90 | 91 | } 92 | 93 | class ADORecordSet_mysqlt extends ADORecordSet_mysql{ 94 | var $databaseType = "mysqlt"; 95 | 96 | function __construct($queryID,$mode=false) 97 | { 98 | if ($mode === false) { 99 | global $ADODB_FETCH_MODE; 100 | $mode = $ADODB_FETCH_MODE; 101 | } 102 | 103 | switch ($mode) 104 | { 105 | case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break; 106 | case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break; 107 | 108 | case ADODB_FETCH_DEFAULT: 109 | case ADODB_FETCH_BOTH: 110 | default: $this->fetchMode = MYSQL_BOTH; break; 111 | } 112 | 113 | $this->adodbFetchMode = $mode; 114 | parent::__construct($queryID); 115 | } 116 | 117 | function MoveNext() 118 | { 119 | if (@$this->fields = mysql_fetch_array($this->_queryID,$this->fetchMode)) { 120 | $this->_currentRow += 1; 121 | return true; 122 | } 123 | if (!$this->EOF) { 124 | $this->_currentRow += 1; 125 | $this->EOF = true; 126 | } 127 | return false; 128 | } 129 | } 130 | 131 | class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt { 132 | 133 | function __construct($queryID,$mode=false) 134 | { 135 | parent::__construct($queryID,$mode); 136 | } 137 | 138 | function MoveNext() 139 | { 140 | return adodb_movenext($this); 141 | } 142 | } 143 | --------------------------------------------------------------------------------