├── .gitignore
├── src
├── Manipulation
│ ├── Clauses
│ │ ├── Params.php
│ │ └── Abstract.php
│ ├── Instance.php
│ ├── Delete.php
│ ├── Insert.php
│ ├── Update.php
│ └── Abstract.php
├── Format
│ └── Date.php
├── Clauses
│ ├── Handler.php
│ ├── GroupBy.php
│ ├── OrderBy.php
│ ├── Where.php
│ ├── Limit.php
│ └── Join.php
├── required
│ └── adodb5
│ │ ├── adodb-lib.inc.php
│ │ ├── docs
│ │ ├── docs-adodb.htm
│ │ └── readme.htm
│ │ ├── lang
│ │ ├── adodb-ar.inc.php
│ │ ├── adodb-bg.inc.php
│ │ ├── adodb-ca.inc.php
│ │ ├── adodb-cn.inc.php
│ │ ├── adodb-cz.inc.php
│ │ ├── adodb-hu.inc.php
│ │ ├── adodb-pl.inc.php
│ │ ├── adodb-sv.inc.php
│ │ ├── adodb_th.inc.php
│ │ ├── adodb-pt-br.inc.php
│ │ ├── adodb-ru1251.inc.php
│ │ ├── adodb-uk1251.inc.php
│ │ ├── adodb-fr.inc.php
│ │ ├── adodb-en.inc.php
│ │ ├── adodb-fa.inc.php
│ │ ├── adodb-nl.inc.php
│ │ ├── adodb-ro.inc.php
│ │ ├── adodb-es.inc.php
│ │ ├── adodb-esperanto.inc.php
│ │ ├── adodb-da.inc.php
│ │ ├── adodb-it.inc.php
│ │ ├── adodb-bgutf8.inc.php
│ │ └── adodb-de.inc.php
│ │ ├── drivers
│ │ ├── adodb-oci8.inc.php
│ │ ├── adodb-postgres8.inc.php
│ │ ├── adodb-postgres.inc.php
│ │ ├── adodb-proxy.inc.php
│ │ ├── adodb-informix.inc.php
│ │ ├── adodb-odbtp_unicode.inc.php
│ │ ├── adodb-ado_access.inc.php
│ │ ├── adodb-pdo_mssql.inc.php
│ │ ├── adodb-mssqlpo.inc.php
│ │ ├── adodb-oci805.inc.php
│ │ ├── adodb-db2ora.inc.php
│ │ ├── adodb-sqlitepo.inc.php
│ │ ├── adodb-firebird.inc.php
│ │ ├── adodb-access.inc.php
│ │ ├── adodb-borland_ibase.inc.php
│ │ ├── adodb-vfp.inc.php
│ │ ├── adodb-pdo_oci.inc.php
│ │ ├── adodb-odbc_oracle.inc.php
│ │ ├── adodb-sybase_ase.inc.php
│ │ └── adodb-mysqlpo.inc.php
│ │ ├── cute_icons_for_site
│ │ ├── adodb.gif
│ │ └── adodb2.gif
│ │ ├── session
│ │ ├── adodb-sessions.oracle.clob.sql
│ │ ├── adodb-sessions.oracle.sql
│ │ ├── adodb-sessions.mysql.sql
│ │ ├── adodb-encrypt-sha1.php
│ │ ├── adodb-session-clob.php
│ │ ├── adodb-session-clob2.php
│ │ ├── session_schema.xml
│ │ ├── 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-sess.txt
│ │ ├── adodb-php4.inc.php
│ │ ├── tests
│ │ ├── time.php
│ │ ├── test2.php
│ │ ├── testgenid.php
│ │ ├── test_rs_array.php
│ │ ├── testcache.php
│ │ ├── xmlschema-mssql.xml
│ │ ├── testpear.php
│ │ ├── test3.php
│ │ ├── xmlschema.xml
│ │ ├── test-perf.php
│ │ ├── test-xmlschema.php
│ │ ├── test5.php
│ │ ├── test-active-recs2.php
│ │ ├── pdo.php
│ │ ├── tmssql.php
│ │ ├── testmssql.php
│ │ ├── test-pgblob.php
│ │ ├── benchmark.php
│ │ ├── testpaging.php
│ │ ├── testoci8.php
│ │ ├── testsessions.php
│ │ ├── test-php5.php
│ │ ├── test-active-relations.php
│ │ └── testoci8cursor.php
│ │ ├── pear
│ │ └── readme.Auth.txt
│ │ ├── adodb-iterator.inc.php
│ │ ├── xmlschema.dtd
│ │ ├── 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
│ │ ├── xsl
│ │ ├── remove-0.2.xsl
│ │ └── remove-0.3.xsl
│ │ ├── rsfilter.inc.php
│ │ ├── xmlschema03.dtd
│ │ ├── readme.txt
│ │ ├── 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
├── Mapper
│ └── Abstract.php
├── Connection.php
└── Dao
│ └── Abstract.php
├── example
├── index.php
├── connection.xml
├── CustomerDao.php
└── CustomerVo.php
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .*
2 | !.gitignore
--------------------------------------------------------------------------------
/src/Manipulation/Clauses/Params.php:
--------------------------------------------------------------------------------
1 | FetchSearch();
9 |
10 |
11 | /**
12 | * Creating new customer
13 | */
14 | $customerVo = new CustomerVO();
15 | $customerVo->name = 'John';
16 | $customerDao = new CustomerDao();
17 | $customerDao->save($customerVo); // customer saved
18 |
19 |
--------------------------------------------------------------------------------
/src/required/adodb5/adodb-php4.inc.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/required/adodb5/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 |
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-postgres8.inc.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Clauses/GroupBy.php:
--------------------------------------------------------------------------------
1 | fiels = $string;
15 |
16 | return $this;
17 | }
18 |
19 | function __toString()
20 | {
21 | $string = " GROUP BY " . $this->fiels;
22 |
23 | return $string;
24 | }
25 | }
--------------------------------------------------------------------------------
/src/Clauses/OrderBy.php:
--------------------------------------------------------------------------------
1 | fiels = $string;
15 |
16 | return $this;
17 | }
18 |
19 | public function __toString()
20 | {
21 | $string = " ORDER BY " . $this->fiels;
22 |
23 | return $string;
24 | }
25 | }
--------------------------------------------------------------------------------
/src/required/adodb5/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 |
--------------------------------------------------------------------------------
/example/connection.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
26 |
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 | ?>
--------------------------------------------------------------------------------
/example/CustomerDao.php:
--------------------------------------------------------------------------------
1 | Limit(10);
9 | return $i->Execute();
10 | }
11 |
12 | public function FetchAllPairs()
13 | {
14 | $i = parent::__FetchPairs('cus_id', 'cus_name')
15 | ->OrderBy('cus_name')
16 | ->Execute();
17 | return $i;
18 | }
19 |
20 | public function Delete(Customer $vo)
21 | {
22 | $vo->setCus_active(0);
23 | return parent::Update($vo);
24 | }
25 |
26 | public function Save(Customer $vo)
27 | {
28 | return parent::Save($vo);
29 | }
30 |
31 | public function Update(Customer $vo)
32 | {
33 | return parent::Update($vo);
34 | }
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/src/required/adodb5/session/adodb-cryptsession.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/required/adodb5/session/adodb-cryptsession2.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Clauses/Where.php:
--------------------------------------------------------------------------------
1 | strings[] = $string;
17 | return true;
18 | }
19 |
20 | public function AddParams($params = array())
21 | {
22 | if (!is_array($params)) throw new Exception("The params parameter of the Where() must be an array");
23 |
24 | foreach ($params as $param)
25 | {
26 | $this->params[] = $param;
27 | }
28 |
29 | return true;
30 | }
31 |
32 | public function GetParams()
33 | {
34 | return $this->params;
35 | }
36 |
37 | public function __toString()
38 | {
39 | return implode('', $this->strings);
40 | }
41 | }
--------------------------------------------------------------------------------
/src/required/adodb5/adodb-iterator.inc.php:
--------------------------------------------------------------------------------
1 | Execute("select * from adoxyz");
15 | foreach($rs as $k => $v) {
16 | echo $k; print_r($v); echo "
";
17 | }
18 |
19 |
20 | Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2
21 |
22 |
23 | Moved to adodb.inc.php to improve performance.
24 | */
25 |
26 |
27 |
28 |
29 |
30 | ?>
--------------------------------------------------------------------------------
/example/CustomerVo.php:
--------------------------------------------------------------------------------
1 | cus_id = $int;
18 | return true;
19 | }
20 |
21 | public function getCus_id()
22 | {
23 | return $this->cus_id;
24 | }
25 |
26 | public function setCus_name($string = null)
27 | {
28 | $this->cus_name = $string;
29 | return true;
30 | }
31 |
32 | public function getCus_name()
33 | {
34 | return $this->cus_name;
35 | }
36 |
37 | public function setCus_active($int = null)
38 | {
39 | $this->cus_active = $int;
40 | return true;
41 | }
42 |
43 | public function getCus_active()
44 | {
45 | return $this->cus_active;
46 | }
47 | }
48 |
49 |
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/session/session_schema2.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
38 |
";
20 | $rs->MoveNext();
21 | }
22 |
23 | echo "
'; 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 |
50 | ?>
51 |
--------------------------------------------------------------------------------
/src/Manipulation/Delete.php:
--------------------------------------------------------------------------------
1 | _objectMapped->_table() . " ";
13 |
14 | if(isset($this->_where))
15 | {
16 | $query .= $this->_where;
17 | }
18 | else
19 | {
20 | $query .= " WHERE " . $this->_objectMapped->_pk(0) . " = ? ";
21 | }
22 |
23 | $this->_stmt = $this->_connection->Prepare($query);
24 | }
25 |
26 | protected function SetParams()
27 | {
28 | if(isset($this->_where))
29 | {
30 | $this->_params = array_merge($this->_params, $this->_where->GetParams());
31 | }
32 | else
33 | {
34 | eval('$this->_params[] = $this->_objectMapped->' . self::fieldToGetter($this->_objectMapped->_pk(0)).';');
35 | }
36 | }
37 |
38 | protected function Run()
39 | {
40 | $result = $this->_connection->Execute($this->_stmt, $this->_params);
41 |
42 | if (!$result)
43 | {
44 | echo $this->_connection->ErrorMsg();
45 | return false;
46 | }
47 |
48 | return true;
49 | }
50 | }
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-informix.inc.php:
--------------------------------------------------------------------------------
1 | ADORecordset_informix72($id,$mode);
38 | }
39 | }
40 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/session/adodb-encrypt-secret.php:
--------------------------------------------------------------------------------
1 |
49 |
--------------------------------------------------------------------------------
/src/Connection.php:
--------------------------------------------------------------------------------
1 | MysqlDev();
17 | #definindo conex�o
18 |
19 | $this->connection = NewADOConnection($this->type);
20 | #servidor, usuario, senha e banco
21 | $this->connection->Connect($this->host,$this->user,$this->password,$this->db);
22 | #modo debug
23 | $this->connection->debug = false;
24 | }
25 |
26 | function MysqlDev()
27 | {
28 | $xml = load_xml();
29 |
30 | $this->type = $xml->mysql->server;
31 | $this->host = $xml->mysql->{APPLICATION_ENV}->host;
32 | $this->db = $xml->mysql->{APPLICATION_ENV}->database;
33 | $this->user = $xml->mysql->{APPLICATION_ENV}->user;
34 | $this->password = $xml->mysql->{APPLICATION_ENV}->password;
35 | }
36 |
37 | function load_xml() {
38 |
39 | $filename = 'connection.xml';
40 |
41 | $file = CONFIG_PATH . DIRECTORY_SEPARATOR . $filename;
42 |
43 | if (!file_exists($file)) return false;
44 |
45 | $xml = simplexml_load_file(CONFIG_PATH . DIRECTORY_SEPARATOR . $filename);
46 |
47 | return $xml;
48 | }
49 | }
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/Manipulation/Insert.php:
--------------------------------------------------------------------------------
1 | AbstractFields();
8 |
9 | return parent::Execute();
10 | /*
11 | $this->Prepare();
12 |
13 | $this->SetParams();
14 |
15 | return $this->Run();*/
16 | }
17 |
18 | protected function Prepare()
19 | {
20 | $query = " INSERT INTO " . $this->_objectMapped->_table() . " (";
21 |
22 | $query .= implode(', ',$this->_abstractedFields);
23 |
24 | $query .= ") VALUES (";
25 |
26 | $params = array_pad(array(), count($this->_abstractedFields), '?');
27 |
28 | $query .= implode(', ',$params);
29 |
30 | $query .= ")";
31 |
32 | $this->_stmt = $this->_connection->Prepare($query);
33 | }
34 |
35 | protected function SetParams()
36 | {
37 | foreach ($this->_abstractedFields as $field)
38 | {
39 | eval('$this->_params[] = $this->_objectMapped->' . self::fieldToGetter($field) . ';');
40 | }
41 | }
42 |
43 | protected function Run()
44 | {
45 | $result = $this->_connection->Execute($this->_stmt, $this->_params);
46 |
47 | if (!$result)
48 | {
49 | echo $this->_connection->ErrorMsg();
50 | return false;
51 | }
52 |
53 | $id = $this->_connection->Insert_ID();
54 |
55 | return $id;
56 | }
57 | }
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-odbtp_unicode.inc.php:
--------------------------------------------------------------------------------
1 |
12 |
13 | // security - hide paths
14 | if (!defined('ADODB_DIR')) die();
15 |
16 | /*
17 | Because the ODBTP server sends and reads UNICODE text data using UTF-8
18 | encoding, the following HTML meta tag must be included within the HTML
19 | head section of every HTML form and script page:
20 |
21 |
22 |
23 | Also, all SQL query strings must be submitted as UTF-8 encoded text.
24 | */
25 |
26 | if (!defined('_ADODB_ODBTP_LAYER')) {
27 | include(ADODB_DIR . "/drivers/adodb-odbtp.inc.php");
28 | }
29 |
30 | class ADODB_odbtp_unicode extends ADODB_odbtp {
31 | var $databaseType = 'odbtp';
32 | var $_useUnicodeSQL = true;
33 |
34 | function ADODB_odbtp_unicode()
35 | {
36 | $this->ADODB_odbtp();
37 | }
38 | }
39 | ?>
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Vophper
2 |
3 | Vophper is a ORM framework PHP 4.x created in 2010 only as a case study about database abstraction and object-oriented programming. The goal was to make easier interations with database, through mapped database objects using Value Object pattern, so avoiding repetitive writing scrips SQL and SQL injections.
4 |
5 | **Vophper** is a acronym of **V**alue **O**bject **PHP** P**er**sistence Library.
6 |
7 | The Vophper core is the ADOdb5, a database abstraction library.
8 | http://adodb.sourceforge.net/
9 |
10 | Operations availables
11 | * SELECT
12 | * INSERT
13 | * UPDATE
14 | * DELETE
15 |
16 | Clausures availables
17 | * JOIN
18 | * WHERE
19 | * GROUP BY
20 | * ORDER BY
21 | * LIMIT
22 |
23 | Design patterns adopteds
24 | * [Factory](https://en.wikipedia.org/wiki/Factory_(object-oriented_programming))
25 | * [VO (Value Object)](https://en.wikipedia.org/wiki/Value_object)
26 |
27 | ### Author
28 |
29 | Created by [Dyorg Almeida](http://linkedin.com/in/dyorgalmeida), a full-stack web developer and PHP expert ([Zend Certified Engineer](http://www.zend.com/en/yellow-pages/ZEND020495)).
30 | Today Dyorg is founder and CTO at [Rabbiit](http://rabbiit.com), a brazilian startup that develops a simple time tracking software.
31 |
32 | http://rabbiit.com - Sign up for free (available only in portuguese for now)
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/tests/test5.php:
--------------------------------------------------------------------------------
1 | debug=1;
23 | $conn->PConnect("localhost","root","","xphplens");
24 | print $conn->databaseType.':'.$conn->GenID().'
';
25 | }
26 |
27 | if (0) {
28 | $conn = ADONewConnection("oci8"); // create a connection
29 | $conn->debug=1;
30 | $conn->PConnect("falcon", "scott", "tiger", "juris8.ecosystem.natsoft.com.my"); // connect to MySQL, testdb
31 | print $conn->databaseType.':'.$conn->GenID();
32 | }
33 |
34 | if (0) {
35 | $conn = ADONewConnection("ibase"); // create a connection
36 | $conn->debug=1;
37 | $conn->Connect("localhost:c:\\Interbase\\Examples\\Database\\employee.gdb", "sysdba", "masterkey", ""); // connect to MySQL, testdb
38 | print $conn->databaseType.':'.$conn->GenID().'
';
39 | }
40 |
41 | if (0) {
42 | $conn = ADONewConnection('postgres');
43 | $conn->debug=1;
44 | @$conn->PConnect("susetikus","tester","test","test");
45 | print $conn->databaseType.':'.$conn->GenID().'
';
46 | }
47 | ?>
48 |
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ] >
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-ado_access.inc.php:
--------------------------------------------------------------------------------
1 | = 5) include(ADODB_DIR . "/drivers/adodb-ado5.inc.php");
19 | else include(ADODB_DIR . "/drivers/adodb-ado.inc.php");
20 | }
21 |
22 | class ADODB_ado_access extends ADODB_ado {
23 | var $databaseType = 'ado_access';
24 | var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE
25 | var $fmtDate = "#Y-m-d#";
26 | var $fmtTimeStamp = "#Y-m-d h:i:sA#";// note no comma
27 | var $sysDate = "FORMAT(NOW,'yyyy-mm-dd')";
28 | var $sysTimeStamp = 'NOW';
29 | var $upperCase = 'ucase';
30 |
31 | function ADODB_ado_access()
32 | {
33 | $this->ADODB_ado();
34 | }
35 |
36 | /*function BeginTrans() { return false;}
37 |
38 | function CommitTrans() { return false;}
39 |
40 | function RollbackTrans() { return false;}*/
41 |
42 | }
43 |
44 |
45 | class ADORecordSet_ado_access extends ADORecordSet_ado {
46 |
47 | var $databaseType = "ado_access";
48 |
49 | function ADORecordSet_ado_access($id,$mode=false)
50 | {
51 | return $this->ADORecordSet_ado($id,$mode);
52 | }
53 | }
54 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/datadict/datadict-ibase.inc.php:
--------------------------------------------------------------------------------
1 | debug) ADOConnection::outp("AlterColumnSQL not supported");
55 | return array();
56 | }
57 |
58 |
59 | function DropColumnSQL($tabname, $flds)
60 | {
61 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
62 | return array();
63 | }
64 |
65 | }
66 |
67 |
68 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 |
--------------------------------------------------------------------------------
/src/required/adodb5/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 |
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-pdo_mssql.inc.php:
--------------------------------------------------------------------------------
1 | hasTransactions = false; ## <<< BUG IN PDO mssql driver
24 | $parentDriver->_bindInputArray = false;
25 | $parentDriver->hasInsertID = true;
26 | }
27 |
28 | function ServerInfo()
29 | {
30 | return ADOConnection::ServerInfo();
31 | }
32 |
33 | function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
34 | {
35 | $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
36 | return $ret;
37 | }
38 |
39 | function SetTransactionMode( $transaction_mode )
40 | {
41 | $this->_transmode = $transaction_mode;
42 | if (empty($transaction_mode)) {
43 | $this->Execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED');
44 | return;
45 | }
46 | if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
47 | $this->Execute("SET TRANSACTION ".$transaction_mode);
48 | }
49 |
50 | function MetaTables($ttype=false,$showSchema=false,$mask=false)
51 | {
52 | return false;
53 | }
54 |
55 | function MetaColumns($table,$normalize=true)
56 | {
57 | return false;
58 | }
59 |
60 | }
61 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/rsfilter.inc.php:
--------------------------------------------------------------------------------
1 | $v) {
31 | $arr[$k] = ucwords($v);
32 | }
33 | }
34 | $rs = RSFilter($rs,'do_ucwords');
35 | */
36 | function RSFilter($rs,$fn)
37 | {
38 | if ($rs->databaseType != 'array') {
39 | if (!$rs->connection) return false;
40 |
41 | $rs = $rs->connection->_rs2rs($rs);
42 | }
43 | $rows = $rs->RecordCount();
44 | for ($i=0; $i < $rows; $i++) {
45 | if (is_array ($fn)) {
46 | $obj = $fn[0];
47 | $method = $fn[1];
48 | $obj->$method ($rs->_array[$i],$rs);
49 | } else {
50 | $fn($rs->_array[$i],$rs);
51 | }
52 |
53 | }
54 | if (!$rs->EOF) {
55 | $rs->_currentRow = 0;
56 | $rs->fields = $rs->_array[0];
57 | }
58 |
59 | return $rs;
60 | }
61 | ?>
--------------------------------------------------------------------------------
/src/Clauses/Join.php:
--------------------------------------------------------------------------------
1 | sintax = $sintax;
23 | return $this;
24 | }
25 |
26 | public function setTableReference($tableRef)
27 | {
28 | $this->tableReference = $tableRef;
29 | return $this;
30 | }
31 |
32 | public function addParams($params)
33 | {
34 | foreach ($params as $param)
35 | {
36 | $this->params[] = $param;
37 | }
38 | return $this;
39 | }
40 |
41 | public function addConditional($conditional)
42 | {
43 | $this->conditionals[] = $conditional;
44 | return $this;
45 | }
46 |
47 | function __toString()
48 | {
49 | $string = !isset($this->sintax) ? " JOIN" : " " . $this->sintax;
50 |
51 | $string .= " " . $this->tableReference;
52 |
53 | if (!empty($this->conditionals))
54 | {
55 | $string .= " ON";
56 |
57 | foreach ($this->conditionals as $conditional)
58 | {
59 | $string .= " " . $conditional;
60 | }
61 | }
62 |
63 | return $string;
64 | }
65 |
66 | function GetString()
67 | {
68 | $string = !isset($this->sintax) ? " JOIN" : " " . $this->sintax;
69 |
70 | $string .= " " . $this->tableReference;
71 |
72 | if (!empty($this->conditionals))
73 | {
74 | $string .= " ON";
75 |
76 | foreach ($this->conditionals as $conditional)
77 | {
78 | $string .= " " . $conditional;
79 | }
80 | }
81 |
82 | return $string;
83 | }
84 |
85 | function GetParams()
86 | {
87 | return $this->params;
88 | }
89 | }
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-mssqlpo.inc.php:
--------------------------------------------------------------------------------
1 | _has_mssql_init) {
39 | ADOConnection::outp( "PrepareSP: mssql_init only available since PHP 4.1.0");
40 | return $sql;
41 | }
42 | if (is_string($sql)) $sql = str_replace('||','+',$sql);
43 | $stmt = mssql_init($sql,$this->_connectionID);
44 | if (!$stmt) return $sql;
45 | return array($sql,$stmt);
46 | }
47 |
48 | function _query($sql,$inputarr=false)
49 | {
50 | if (is_string($sql)) $sql = str_replace('||','+',$sql);
51 | return ADODB_mssql::_query($sql,$inputarr);
52 | }
53 | }
54 |
55 | class ADORecordset_mssqlpo extends ADORecordset_mssql {
56 | var $databaseType = "mssqlpo";
57 | function ADORecordset_mssqlpo($id,$mode=false)
58 | {
59 | $this->ADORecordset_mssql($id,$mode);
60 | }
61 | }
62 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-oci805.inc.php:
--------------------------------------------------------------------------------
1 | ADODB_oci8();
27 | }
28 |
29 | function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
30 | {
31 | // seems that oracle only supports 1 hint comment in 8i
32 | if (strpos($sql,'/*+') !== false)
33 | $sql = str_replace('/*+ ','/*+FIRST_ROWS ',$sql);
34 | else
35 | $sql = preg_replace('/^[ \t\n]*select/i','SELECT /*+FIRST_ROWS*/',$sql);
36 |
37 | /*
38 | The following is only available from 8.1.5 because order by in inline views not
39 | available before then...
40 | http://www.jlcomp.demon.co.uk/faq/top_sql.html
41 | if ($nrows > 0) {
42 | if ($offset > 0) $nrows += $offset;
43 | $sql = "select * from ($sql) where rownum <= $nrows";
44 | $nrows = -1;
45 | }
46 | */
47 |
48 | return ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
49 | }
50 | }
51 |
52 | class ADORecordset_oci805 extends ADORecordset_oci8 {
53 | var $databaseType = "oci805";
54 | function ADORecordset_oci805($id,$mode=false)
55 | {
56 | $this->ADORecordset_oci8($id,$mode);
57 | }
58 | }
59 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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étion 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éessé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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ]>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | );
33 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/readme.txt:
--------------------------------------------------------------------------------
1 | >> ADODB Library for PHP5
2 |
3 | (c) 2000-2011 John Lim (jlim@natsoft.com)
4 |
5 | Released under both BSD and GNU Lesser GPL library license.
6 | This means you can use it in proprietary products.
7 |
8 |
9 | >> Introduction
10 |
11 | PHP's database access functions are not standardised. This creates a
12 | need for a database class library to hide the differences between the
13 | different databases (encapsulate the differences) so we can easily
14 | switch databases.
15 |
16 | We currently support MySQL, Interbase, Sybase, PostgreSQL, Oracle,
17 | Microsoft SQL server, Foxpro ODBC, Access ODBC, Informix, DB2,
18 | Sybase SQL Anywhere, generic ODBC and Microsoft's ADO.
19 |
20 | We hope more people will contribute drivers to support other databases.
21 |
22 |
23 | >> Documentation and Examples
24 |
25 | Refer to the adodb/docs directory for full documentation and examples.
26 | There is also a tutorial tute.htm that contrasts ADODB code with
27 | mysql code.
28 |
29 |
30 | >>> Files
31 | Adodb.inc.php is the main file. You need to include only this file.
32 |
33 | Adodb-*.inc.php are the database specific driver code.
34 |
35 | Test.php contains a list of test commands to exercise the class library.
36 |
37 | Adodb-session.php is the PHP4 session handling code.
38 |
39 | Testdatabases.inc.php contains the list of databases to apply the tests on.
40 |
41 | Benchmark.php is a simple benchmark to test the throughput of a simple SELECT
42 | statement for databases described in testdatabases.inc.php. The benchmark
43 | tables are created in test.php.
44 |
45 | readme.htm is the main documentation.
46 |
47 | tute.htm is the tutorial.
48 |
49 |
50 | >> More Info
51 |
52 | For more information, including installation see readme.htm
53 | or visit
54 | http://adodb.sourceforge.net/
55 |
56 |
57 | >> Feature Requests and Bug Reports
58 |
59 | Email to jlim@natsoft.com.my
60 |
61 |
62 |
--------------------------------------------------------------------------------
/src/required/adodb5/session/adodb-compress-gzip.php:
--------------------------------------------------------------------------------
1 | _level;
34 | }
35 |
36 | /**
37 | */
38 | function setLevel($level) {
39 | assert('$level >= 0');
40 | assert('$level <= 9');
41 | $this->_level = (int) $level;
42 | }
43 |
44 | /**
45 | */
46 | function getMinLength() {
47 | return $this->_min_length;
48 | }
49 |
50 | /**
51 | */
52 | function setMinLength($min_length) {
53 | assert('$min_length >= 0');
54 | $this->_min_length = (int) $min_length;
55 | }
56 |
57 | /**
58 | */
59 | function ADODB_Compress_Gzip($level = null, $min_length = null) {
60 | if (!is_null($level)) {
61 | $this->setLevel($level);
62 | }
63 |
64 | if (!is_null($min_length)) {
65 | $this->setMinLength($min_length);
66 | }
67 | }
68 |
69 | /**
70 | */
71 | function write($data, $key) {
72 | if (strlen($data) < $this->_min_length) {
73 | return $data;
74 | }
75 |
76 | if (!is_null($this->_level)) {
77 | return gzcompress($data, $this->_level);
78 | } else {
79 | return gzcompress($data);
80 | }
81 | }
82 |
83 | /**
84 | */
85 | function read($data, $key) {
86 | return $data ? gzuncompress($data) : $data;
87 | }
88 |
89 | }
90 |
91 | return 1;
92 |
93 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-db2ora.inc.php:
--------------------------------------------------------------------------------
1 | $_COLONSZ) return $p;
28 | $_COLONARR[] = $v;
29 | return '?';
30 | }
31 |
32 | function _colonscope($sql,$arr)
33 | {
34 | global $_COLONARR,$_COLONSZ;
35 |
36 | $_COLONARR = array();
37 | $_COLONSZ = sizeof($arr);
38 |
39 | $sql2 = preg_replace("/(:[0-9]+)/e","_colontrack('\\1')",$sql);
40 |
41 | if (empty($_COLONARR)) return array($sql,$arr);
42 |
43 | foreach($_COLONARR as $k => $v) {
44 | $arr2[] = $arr[$v];
45 | }
46 |
47 | return array($sql2,$arr2);
48 | }
49 |
50 | class ADODB_db2oci extends ADODB_db2 {
51 | var $databaseType = "db2oci";
52 | var $sysTimeStamp = 'sysdate';
53 | var $sysDate = 'trunc(sysdate)';
54 |
55 | function ADODB_db2oci()
56 | {
57 | $this->ADODB_db2();
58 | }
59 |
60 |
61 | function _Execute($sql, $inputarr)
62 | {
63 | if ($inputarr) list($sql,$inputarr) = _colonscope($sql, $inputarr);
64 | return parent::_Execute($sql, $inputarr);
65 | }
66 | };
67 |
68 |
69 | class ADORecordSet_db2oci extends ADORecordSet_odbc {
70 |
71 | var $databaseType = "db2oci";
72 |
73 | function ADORecordSet_db2oci($id,$mode=false)
74 | {
75 | return $this->ADORecordSet_db2($id,$mode);
76 | }
77 | }
78 |
79 | } //define
80 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/lang/adodb-esperanto.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 kondicxoj 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 => 'cxio bone', // DB_OK
30 | DB_ERROR_NEED_MORE_DATA => 'ne suficxe da datumo',
31 | DB_ERROR_EXTENSION_NOT_FOUND=> 'etendo ne trovita',
32 | DB_ERROR_NOSUCHDB => 'datumbazo ne ekzistas',
33 | DB_ERROR_ACCESS_VIOLATION => 'ne suficxe da rajto por atingo'
34 | );
35 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/datadict/datadict-informix.inc.php:
--------------------------------------------------------------------------------
1 | debug) ADOConnection::outp("AlterColumnSQL not supported");
55 | return array();
56 | }
57 |
58 |
59 | function DropColumnSQL($tabname, $flds)
60 | {
61 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
62 | return array();
63 | }
64 |
65 | // return string must begin with space
66 | function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
67 | {
68 | if ($fautoinc) {
69 | $ftype = 'SERIAL';
70 | return '';
71 | }
72 | $suffix = '';
73 | if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
74 | if ($fnotnull) $suffix .= ' NOT NULL';
75 | if ($fconstraint) $suffix .= ' '.$fconstraint;
76 | return $suffix;
77 | }
78 |
79 | }
80 |
81 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-sqlitepo.inc.php:
--------------------------------------------------------------------------------
1 | ADODB_sqlite();
30 | }
31 | }
32 |
33 | /*--------------------------------------------------------------------------------------
34 | Class Name: Recordset
35 | --------------------------------------------------------------------------------------*/
36 |
37 | class ADORecordset_sqlitepo extends ADORecordset_sqlite {
38 |
39 | var $databaseType = 'sqlitepo';
40 |
41 | function ADORecordset_sqlitepo($queryID,$mode=false)
42 | {
43 | $this->ADORecordset_sqlite($queryID,$mode);
44 | }
45 |
46 | // Modified to strip table names from returned fields
47 | function _fetch($ignore_fields=false)
48 | {
49 | $this->fields = array();
50 | $fields = @sqlite_fetch_array($this->_queryID,$this->fetchMode);
51 | if(is_array($fields))
52 | foreach($fields as $n => $v)
53 | {
54 | if(($p = strpos($n, ".")) !== false)
55 | $n = substr($n, $p+1);
56 | $this->fields[$n] = $v;
57 | }
58 |
59 | return !empty($this->fields);
60 | }
61 | }
62 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/lang/adodb-bgutf8.inc.php:
--------------------------------------------------------------------------------
1 |
5 | */
6 |
7 | $ADODB_LANG_ARRAY = array (
8 | 'LANG' => 'bgutf8',
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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 |
94 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/Dao/Abstract.php:
--------------------------------------------------------------------------------
1 | _objectMapped = $objectMapped;
10 | }
11 |
12 | protected function __Delete(Vophper_Mapper_Abstract $objectMapped)
13 | {
14 | return Vophper_Manipulation_Instance::Delete($objectMapped);
15 | }
16 |
17 | public function Delete(Vophper_Mapper_Abstract $objectMapped)
18 | {
19 | return $this->__Delete($objectMapped)->Execute();
20 | }
21 |
22 | protected function __FetchAll()
23 | {
24 | return self::InstanceSelect();
25 | }
26 |
27 | public function FetchAll()
28 | {
29 | return $this->__FetchAll()->Execute();
30 | }
31 |
32 | protected function __FetchPairs($column1, $column2)
33 | {
34 | return self::InstanceSelect()->SelectPairs($column1, $column2);
35 | }
36 |
37 | public function FetchPairs($column1, $column2)
38 | {
39 | return $this->__FetchPairs($column1, $column2)->Execute();
40 | }
41 |
42 | protected function __Find($id)
43 | {
44 | return self::InstanceSelect($id);
45 | }
46 |
47 | public function Find($id)
48 | {
49 | return $this->__Find($id)->Execute();
50 | }
51 |
52 | protected function __Save(Vophper_Mapper_Abstract $objectMapped)
53 | {
54 | return Vophper_Manipulation_Instance::Insert($objectMapped);
55 | }
56 |
57 | public function Save(Vophper_Mapper_Abstract $objectMapped)
58 | {
59 | return $this->__Save($objectMapped)->Execute();
60 | }
61 |
62 | protected function __Update(Vophper_Mapper_Abstract $objectMapped)
63 | {
64 | return Vophper_Manipulation_Instance::Update($objectMapped);
65 | }
66 |
67 | public function Update(Vophper_Mapper_Abstract $objectMapped)
68 | {
69 | return $this->__Update($objectMapped)->Execute();
70 | }
71 |
72 | private function InstanceSelect($id = null)
73 | {
74 | if (is_null($this->_objectMapped)) eval('$this->_objectMapped = new '.str_replace("Dao", "", get_class($this)).';');
75 |
76 | $instance = Vophper_Manipulation_Instance::Select($this->_objectMapped);
77 |
78 | if (!is_null($id)) $instance->FindById($id);
79 |
80 | return $instance;
81 | }
82 | }
--------------------------------------------------------------------------------
/src/required/adodb5/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 |
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-firebird.inc.php:
--------------------------------------------------------------------------------
1 | ADODB_ibase();
27 | }
28 |
29 | function ServerInfo()
30 | {
31 | $arr['dialect'] = $this->dialect;
32 | switch($arr['dialect']) {
33 | case '':
34 | case '1': $s = 'Firebird Dialect 1'; break;
35 | case '2': $s = 'Firebird Dialect 2'; break;
36 | default:
37 | case '3': $s = 'Firebird Dialect 3'; break;
38 | }
39 | $arr['version'] = ADOConnection::_findvers($s);
40 | $arr['description'] = $s;
41 | return $arr;
42 | }
43 |
44 | // Note that Interbase 6.5 uses this ROWS instead - don't you love forking wars!
45 | // SELECT col1, col2 FROM table ROWS 5 -- get 5 rows
46 | // SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
47 | function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $secs=0)
48 | {
49 | $nrows = (integer) $nrows;
50 | $offset = (integer) $offset;
51 | $str = 'SELECT ';
52 | if ($nrows >= 0) $str .= "FIRST $nrows ";
53 | $str .=($offset>=0) ? "SKIP $offset " : '';
54 |
55 | $sql = preg_replace('/^[ \t]*select/i',$str,$sql);
56 | if ($secs)
57 | $rs = $this->CacheExecute($secs,$sql,$inputarr);
58 | else
59 | $rs = $this->Execute($sql,$inputarr);
60 |
61 | return $rs;
62 | }
63 |
64 |
65 | };
66 |
67 |
68 | class ADORecordSet_firebird extends ADORecordSet_ibase {
69 |
70 | var $databaseType = "firebird";
71 |
72 | function ADORecordSet_firebird($id,$mode=false)
73 | {
74 | $this->ADORecordSet_ibase($id,$mode);
75 | }
76 | }
77 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/tests/testmssql.php:
--------------------------------------------------------------------------------
1 | Connect('127.0.0.1','adodb','natsoft','northwind') or die('Fail');
29 |
30 | $conn->debug =1;
31 | $query = 'select * from products';
32 | $conn->SetFetchMode(ADODB_FETCH_ASSOC);
33 | $rs = $conn->Execute($query);
34 | echo "";
35 | while( !$rs->EOF ) {
36 | $output[] = $rs->fields;
37 | var_dump($rs->fields);
38 | $rs->MoveNext();
39 | print "";
40 | }
41 | die();
42 |
43 |
44 | $p = $conn->Prepare('insert into products (productname,unitprice,dcreated) values (?,?,?)');
45 | echo "
";
46 | print_r($p);
47 |
48 | $conn->debug=1;
49 | $conn->Execute($p,array('John'.rand(),33.3,$conn->DBDate(time())));
50 |
51 | $p = $conn->Prepare('select * from products where productname like ?');
52 | $arr = $conn->getarray($p,array('V%'));
53 | print_r($arr);
54 | die();
55 |
56 | //$conn = ADONewConnection("mssql");
57 | //$conn->Connect('mangrove','sa','natsoft','ai');
58 |
59 | //$conn->Connect('mangrove','sa','natsoft','ai');
60 | $conn->debug=1;
61 | $conn->Execute('delete from blobtest');
62 |
63 | $conn->Execute('insert into blobtest (id) values(1)');
64 | $conn->UpdateBlobFile('blobtest','b1','../cute_icons_for_site/adodb.gif','id=1');
65 | $rs = $conn->Execute('select b1 from blobtest where id=1');
66 |
67 | $output = "c:\\temp\\test_out-".date('H-i-s').".gif";
68 | print "Saving file $output, size=".strlen($rs->fields[0])."";
69 | $fd = fopen($output, "wb");
70 | fwrite($fd, $rs->fields[0]);
71 | fclose($fd);
72 |
73 | print " View Image";
74 | //$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest');
75 | //rs2html($rs);
76 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/perf/perf-informix.inc.php:
--------------------------------------------------------------------------------
1 | array('RATIOH',
40 | "select round((1-(wt.value / (rd.value + wr.value)))*100,2)
41 | from sysmaster:sysprofile wr, sysmaster:sysprofile rd, sysmaster:sysprofile wt
42 | where rd.name = 'pagreads' and
43 | wr.name = 'pagwrites' and
44 | wt.name = 'buffwts'",
45 | '=WarnCacheRatio'),
46 | 'IO',
47 | 'data reads' => array('IO',
48 | "select value from sysmaster:sysprofile where name='pagreads'",
49 | 'Page reads'),
50 |
51 | 'data writes' => array('IO',
52 | "select value from sysmaster:sysprofile where name='pagwrites'",
53 | 'Page writes'),
54 |
55 | 'Connections',
56 | 'current connections' => array('SESS',
57 | 'select count(*) from sysmaster:syssessions',
58 | 'Number of sessions'),
59 |
60 | false
61 |
62 | );
63 |
64 | function perf_informix(&$conn)
65 | {
66 | $this->conn = $conn;
67 | }
68 |
69 | }
70 | ?>
71 |
--------------------------------------------------------------------------------
/src/required/adodb5/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 |
88 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/session/adodb-encrypt-mcrypt.php:
--------------------------------------------------------------------------------
1 | _cipher;
38 | }
39 |
40 | /**
41 | */
42 | function setCipher($cipher) {
43 | $this->_cipher = $cipher;
44 | }
45 |
46 | /**
47 | */
48 | function getMode() {
49 | return $this->_mode;
50 | }
51 |
52 | /**
53 | */
54 | function setMode($mode) {
55 | $this->_mode = $mode;
56 | }
57 |
58 | /**
59 | */
60 | function getSource() {
61 | return $this->_source;
62 | }
63 |
64 | /**
65 | */
66 | function setSource($source) {
67 | $this->_source = $source;
68 | }
69 |
70 | /**
71 | */
72 | function ADODB_Encrypt_MCrypt($cipher = null, $mode = null, $source = null) {
73 | if (!$cipher) {
74 | $cipher = MCRYPT_RIJNDAEL_256;
75 | }
76 | if (!$mode) {
77 | $mode = MCRYPT_MODE_ECB;
78 | }
79 | if (!$source) {
80 | $source = MCRYPT_RAND;
81 | }
82 |
83 | $this->_cipher = $cipher;
84 | $this->_mode = $mode;
85 | $this->_source = $source;
86 | }
87 |
88 | /**
89 | */
90 | function write($data, $key) {
91 | $iv_size = mcrypt_get_iv_size($this->_cipher, $this->_mode);
92 | $iv = mcrypt_create_iv($iv_size, $this->_source);
93 | return mcrypt_encrypt($this->_cipher, $key, $data, $this->_mode, $iv);
94 | }
95 |
96 | /**
97 | */
98 | function read($data, $key) {
99 | $iv_size = mcrypt_get_iv_size($this->_cipher, $this->_mode);
100 | $iv = mcrypt_create_iv($iv_size, $this->_source);
101 | $rv = mcrypt_decrypt($this->_cipher, $key, $data, $this->_mode, $iv);
102 | return rtrim($rv, "\0");
103 | }
104 |
105 | }
106 |
107 | return 1;
108 |
109 | ?>
110 |
--------------------------------------------------------------------------------
/src/required/adodb5/tests/benchmark.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ADODB Benchmarks
6 |
7 |
8 |
9 | ADODB Version: $ADODB_version Host: $db->host Database: $db->database";
46 |
47 | // perform query once to cache results so we are only testing throughput
48 | $rs = $db->Execute($sql);
49 | if (!$rs){
50 | print "Error in recordset";
51 | return;
52 | }
53 | $arr = $rs->GetArray();
54 | //$db->debug = true;
55 | global $ADODB_COUNTRECS;
56 | $ADODB_COUNTRECS = false;
57 | $start = microtime();
58 | for ($i=0; $i < $max; $i++) {
59 | $rs = $db->Execute($sql);
60 | $arr = $rs->GetArray();
61 | // print $arr[0][1];
62 | }
63 | $end = microtime();
64 | $start = explode(' ',$start);
65 | $end = explode(' ',$end);
66 |
67 | //print_r($start);
68 | //print_r($end);
69 |
70 | // print_r($arr);
71 | $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]);
72 | printf ("
seconds = %8.2f for %d iterations each with %d records
",$total,$max, sizeof($arr));
73 | flush();
74 |
75 |
76 | //$db->Close();
77 | }
78 | include("testdatabases.inc.php");
79 |
80 | ?>
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/src/required/adodb5/datadict/datadict-access.inc.php:
--------------------------------------------------------------------------------
1 | debug) ADOConnection::outp("Warning: Access does not supported DEFAULT values (field $fname)");
64 | }
65 | if ($fnotnull) $suffix .= ' NOT NULL';
66 | if ($fconstraint) $suffix .= ' '.$fconstraint;
67 | return $suffix;
68 | }
69 |
70 | function CreateDatabase($dbname,$options=false)
71 | {
72 | return array();
73 | }
74 |
75 |
76 | function SetSchema($schema)
77 | {
78 | }
79 |
80 | function AlterColumnSQL($tabname, $flds)
81 | {
82 | if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported");
83 | return array();
84 | }
85 |
86 |
87 | function DropColumnSQL($tabname, $flds)
88 | {
89 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
90 | return array();
91 | }
92 |
93 | }
94 |
95 |
96 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/adodb-exceptions.inc.php:
--------------------------------------------------------------------------------
1 | sql = $p1;
33 | $this->params = $p2;
34 | $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n";
35 | break;
36 |
37 | case 'PCONNECT':
38 | case 'CONNECT':
39 | $user = $thisConnection->user;
40 | $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n";
41 | break;
42 | default:
43 | $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
44 | break;
45 | }
46 |
47 | $this->dbms = $dbms;
48 | if ($thisConnection) {
49 | $this->host = $thisConnection->host;
50 | $this->database = $thisConnection->database;
51 | }
52 | $this->fn = $fn;
53 | $this->msg = $errmsg;
54 |
55 | if (!is_numeric($errno)) $errno = -1;
56 | parent::__construct($s,$errno);
57 | }
58 | }
59 |
60 | /**
61 | * Default Error Handler. This will be called with the following params
62 | *
63 | * @param $dbms the RDBMS you are connecting to
64 | * @param $fn the name of the calling function (in uppercase)
65 | * @param $errno the native error number from the database
66 | * @param $errmsg the native error msg from the database
67 | * @param $p1 $fn specific parameter - see below
68 | * @param $P2 $fn specific parameter - see below
69 | */
70 |
71 | function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
72 | {
73 | global $ADODB_EXCEPTION;
74 |
75 | if (error_reporting() == 0) return; // obey @ protocol
76 | if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION;
77 | else $errfn = 'ADODB_EXCEPTION';
78 | throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection);
79 | }
80 |
81 |
82 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-access.inc.php:
--------------------------------------------------------------------------------
1 | ADODB_odbc();
38 | }
39 |
40 | function Time()
41 | {
42 | return time();
43 | }
44 |
45 | function BeginTrans() { return false;}
46 |
47 | function IfNull( $field, $ifNull )
48 | {
49 | return " IIF(IsNull($field), $ifNull, $field) "; // if Access
50 | }
51 | /*
52 | function MetaTables()
53 | {
54 | global $ADODB_FETCH_MODE;
55 |
56 | $savem = $ADODB_FETCH_MODE;
57 | $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
58 | $qid = odbc_tables($this->_connectionID);
59 | $rs = new ADORecordSet_odbc($qid);
60 | $ADODB_FETCH_MODE = $savem;
61 | if (!$rs) return false;
62 |
63 | $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change;
64 |
65 | $arr = $rs->GetArray();
66 | //print_pre($arr);
67 | $arr2 = array();
68 | for ($i=0; $i < sizeof($arr); $i++) {
69 | if ($arr[$i][2] && $arr[$i][3] != 'SYSTEM TABLE')
70 | $arr2[] = $arr[$i][2];
71 | }
72 | return $arr2;
73 | }*/
74 | }
75 |
76 |
77 | class ADORecordSet_access extends ADORecordSet_odbc {
78 |
79 | var $databaseType = "access";
80 |
81 | function ADORecordSet_access($id,$mode=false)
82 | {
83 | return $this->ADORecordSet_odbc($id,$mode);
84 | }
85 | }// class
86 | }
87 | ?>
--------------------------------------------------------------------------------
/src/Manipulation/Update.php:
--------------------------------------------------------------------------------
1 | AbstractFields();
8 |
9 | return parent::Execute();
10 | }
11 |
12 | protected function Prepare()
13 | {
14 | $query = " UPDATE " . $this->_objectMapped->_table() . " SET ";
15 |
16 | $arr = $this->_abstractedFields;
17 |
18 | array_walk($arr, array($this, 'addCharacter'));
19 |
20 | $query .= implode(', ', $arr);
21 |
22 | if(isset($this->_where))
23 | {
24 | $query .= $this->_where;
25 | }
26 | else
27 | {
28 | $query .= " WHERE " . $this->_objectMapped->_pk(0) . " = ? ";
29 | }
30 |
31 | $this->_stmt = $this->_connection->Prepare($query);
32 | }
33 |
34 | private function addCharacter(&$item, $key)
35 | {
36 | $item = $item . ' = ? ';
37 | }
38 |
39 | protected function SetParams()
40 | {
41 | /*if (!is_array($this->_dateFields)) {
42 | foreach ($this->_abstractedFields as $field) {
43 | //eval('$this->_params[] = $this->_objectMapped->' . self::fieldToGetter($field) . ';');
44 | $this->_params[] = $this->_objectMapped->$field;
45 | $slice = explode('/', $this->_objectMapped->$field);
46 | //var_dump($day, $month, $year);
47 |
48 | var_dump($this->_connection->DBDate("$slice[2]-$slice[1]-$slice[0]"));
49 | }
50 | } else {
51 | foreach ($this->_abstractedFields as $field) {
52 | if (in_array($field, $this->_DateFields)){
53 | $this->_params[] = $this->_objectMapped->$field;
54 | }
55 | else {
56 | $this->_params[] = $this->_objectMapped->$field;
57 | }
58 | //eval('$this->_params[] = $this->_objectMapped->' . self::fieldToGetter($field) . ';');
59 | }
60 | }*/
61 |
62 | foreach ($this->_abstractedFields as $field) {
63 | //eval('$this->_params[] = $this->_objectMapped->' . self::fieldToGetter($field) . ';');
64 | $this->_params[] = $this->_objectMapped->$field;
65 | }
66 |
67 | if(isset($this->_where))
68 | {
69 | $this->_params = array_merge($this->_params, $this->_where->GetParams());
70 | }
71 | else
72 | {
73 | //eval('$this->_params[] = $this->_objectMapped->' . self::fieldToGetter($this->_objectMapped->_pk(0)) . ';');
74 | $this->_params[] = $this->_objectMapped->{$this->_objectMapped->_pk(0)};
75 | }
76 | }
77 |
78 | protected function Run()
79 | {
80 | $result = $this->_connection->Execute($this->_stmt, $this->_params);
81 |
82 | if (!$result)
83 | {
84 | echo $this->_connection->ErrorMsg();
85 | return false;
86 | }
87 |
88 | return true;
89 | }
90 |
91 | }
--------------------------------------------------------------------------------
/src/required/adodb5/adodb-errorpear.inc.php:
--------------------------------------------------------------------------------
1 | !$s";
75 | }
76 |
77 | /**
78 | * Returns last PEAR_Error object. This error might be for an error that
79 | * occured several sql statements ago.
80 | */
81 | function ADODB_PEAR_Error()
82 | {
83 | global $ADODB_Last_PEAR_Error;
84 |
85 | return $ADODB_Last_PEAR_Error;
86 | }
87 |
88 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-borland_ibase.inc.php:
--------------------------------------------------------------------------------
1 | ADODB_ibase();
27 | }
28 |
29 | function BeginTrans()
30 | {
31 | if ($this->transOff) return true;
32 | $this->transCnt += 1;
33 | $this->autoCommit = false;
34 | $this->_transactionID = ibase_trans($this->ibasetrans, $this->_connectionID);
35 | return $this->_transactionID;
36 | }
37 |
38 | function ServerInfo()
39 | {
40 | $arr['dialect'] = $this->dialect;
41 | switch($arr['dialect']) {
42 | case '':
43 | case '1': $s = 'Interbase 6.5, Dialect 1'; break;
44 | case '2': $s = 'Interbase 6.5, Dialect 2'; break;
45 | default:
46 | case '3': $s = 'Interbase 6.5, Dialect 3'; break;
47 | }
48 | $arr['version'] = '6.5';
49 | $arr['description'] = $s;
50 | return $arr;
51 | }
52 |
53 | // Note that Interbase 6.5 uses ROWS instead - don't you love forking wars!
54 | // SELECT col1, col2 FROM table ROWS 5 -- get 5 rows
55 | // SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2
56 | // Firebird uses
57 | // SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE
58 | function SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
59 | {
60 | if ($nrows > 0) {
61 | if ($offset <= 0) $str = " ROWS $nrows ";
62 | else {
63 | $a = $offset+1;
64 | $b = $offset+$nrows;
65 | $str = " ROWS $a TO $b";
66 | }
67 | } else {
68 | // ok, skip
69 | $a = $offset + 1;
70 | $str = " ROWS $a TO 999999999"; // 999 million
71 | }
72 | $sql .= $str;
73 |
74 | return ($secs2cache) ?
75 | $this->CacheExecute($secs2cache,$sql,$inputarr)
76 | :
77 | $this->Execute($sql,$inputarr);
78 | }
79 |
80 | };
81 |
82 |
83 | class ADORecordSet_borland_ibase extends ADORecordSet_ibase {
84 |
85 | var $databaseType = "borland_ibase";
86 |
87 | function ADORecordSet_borland_ibase($id,$mode=false)
88 | {
89 | $this->ADORecordSet_ibase($id,$mode);
90 | }
91 | }
92 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/tests/testpaging.php:
--------------------------------------------------------------------------------
1 | PConnect('localhost','tester','test','test');
26 | }
27 |
28 | if ($driver == 'access') {
29 | $db = NewADOConnection('access');
30 | $db->PConnect("nwind", "", "", "");
31 | }
32 |
33 | if ($driver == 'ibase') {
34 | $db = NewADOConnection('ibase');
35 | $db->PConnect("localhost:e:\\firebird\\examples\\employee.gdb", "sysdba", "masterkey", "");
36 | $sql = 'select distinct firstname, lastname from adoxyz order by firstname';
37 |
38 | }
39 | if ($driver == 'mssql') {
40 | $db = NewADOConnection('mssql');
41 | $db->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind');
42 | }
43 | if ($driver == 'oci8') {
44 | $db = NewADOConnection('oci8');
45 | $db->Connect('','scott','natsoft');
46 |
47 | $sql = "select * from (select ID, firstname as \"First Name\", lastname as \"Last Name\" from adoxyz
48 | order by 1)";
49 | }
50 |
51 | if ($driver == 'access') {
52 | $db = NewADOConnection('access');
53 | $db->Connect('nwind');
54 | }
55 |
56 | if (empty($driver) or $driver == 'mysql') {
57 | $db = NewADOConnection('mysql');
58 | $db->Connect('localhost','root','','test');
59 | }
60 |
61 | //$db->pageExecuteCountRows = false;
62 |
63 | $db->debug = true;
64 |
65 | if (0) {
66 | $rs = $db->Execute($sql);
67 | include_once('../toexport.inc.php');
68 | print "";
69 | print rs2csv($rs); # return a string
70 |
71 | print '
';
72 | $rs->MoveFirst(); # note, some databases do not support MoveFirst
73 | print rs2tab($rs); # return a string
74 |
75 | print '
';
76 | $rs->MoveFirst();
77 | rs2tabout($rs); # send to stdout directly
78 | print "
";
79 | }
80 |
81 | $pager = new ADODB_Pager($db,$sql);
82 | $pager->showPageLinks = true;
83 | $pager->linksPerPage = 10;
84 | $pager->cache = 60;
85 | $pager->Render($rows=7);
86 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/session/adodb-compress-bzip2.php:
--------------------------------------------------------------------------------
1 | _block_size;
37 | }
38 |
39 | /**
40 | */
41 | function setBlockSize($block_size) {
42 | assert('$block_size >= 1');
43 | assert('$block_size <= 9');
44 | $this->_block_size = (int) $block_size;
45 | }
46 |
47 | /**
48 | */
49 | function getWorkLevel() {
50 | return $this->_work_level;
51 | }
52 |
53 | /**
54 | */
55 | function setWorkLevel($work_level) {
56 | assert('$work_level >= 0');
57 | assert('$work_level <= 250');
58 | $this->_work_level = (int) $work_level;
59 | }
60 |
61 | /**
62 | */
63 | function getMinLength() {
64 | return $this->_min_length;
65 | }
66 |
67 | /**
68 | */
69 | function setMinLength($min_length) {
70 | assert('$min_length >= 0');
71 | $this->_min_length = (int) $min_length;
72 | }
73 |
74 | /**
75 | */
76 | function ADODB_Compress_Bzip2($block_size = null, $work_level = null, $min_length = null) {
77 | if (!is_null($block_size)) {
78 | $this->setBlockSize($block_size);
79 | }
80 |
81 | if (!is_null($work_level)) {
82 | $this->setWorkLevel($work_level);
83 | }
84 |
85 | if (!is_null($min_length)) {
86 | $this->setMinLength($min_length);
87 | }
88 | }
89 |
90 | /**
91 | */
92 | function write($data, $key) {
93 | if (strlen($data) < $this->_min_length) {
94 | return $data;
95 | }
96 |
97 | if (!is_null($this->_block_size)) {
98 | if (!is_null($this->_work_level)) {
99 | return bzcompress($data, $this->_block_size, $this->_work_level);
100 | } else {
101 | return bzcompress($data, $this->_block_size);
102 | }
103 | }
104 |
105 | return bzcompress($data);
106 | }
107 |
108 | /**
109 | */
110 | function read($data, $key) {
111 | return $data ? bzdecompress($data) : $data;
112 | }
113 |
114 | }
115 |
116 | return 1;
117 |
118 | ?>
119 |
--------------------------------------------------------------------------------
/src/required/adodb5/tests/testoci8.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | PConnect('','scott','natsoft');
21 | if (!empty($testblob)) {
22 | $varHoldingBlob = 'ABC DEF GEF John TEST';
23 | $num = time()%10240;
24 | // create table atable (id integer, ablob blob);
25 | $db->Execute('insert into ATABLE (id,ablob) values('.$num.',empty_blob())');
26 | $db->UpdateBlob('ATABLE', 'ablob', $varHoldingBlob, 'id='.$num, 'BLOB');
27 |
28 | $rs = $db->Execute('select * from atable');
29 |
30 | if (!$rs) die("Empty RS");
31 | if ($rs->EOF) die("EOF RS");
32 | rs2html($rs);
33 | }
34 | $stmt = $db->Prepare('select * from adoxyz where id=?');
35 | for ($i = 1; $i <= 10; $i++) {
36 | $rs = $db->Execute(
37 | $stmt,
38 | array($i));
39 |
40 | if (!$rs) die("Empty RS");
41 | if ($rs->EOF) die("EOF RS");
42 | rs2html($rs);
43 | }
44 | }
45 | if (1) {
46 | $db = ADONewConnection('oci8');
47 | $db->PConnect('','scott','natsoft');
48 | $db->debug = true;
49 | $db->Execute("delete from emp where ename='John'");
50 | print $db->Affected_Rows().'
';
51 | $stmt = $db->Prepare('insert into emp (empno, ename) values (:empno, :ename)');
52 | $rs = $db->Execute($stmt,array('empno'=>4321,'ename'=>'John'));
53 | // prepare not quite ready for prime time
54 | //$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John'));
55 | if (!$rs) die("Empty RS");
56 |
57 | $db->setfetchmode(ADODB_FETCH_NUM);
58 |
59 | $vv = 'A%';
60 | $stmt = $db->PrepareSP("BEGIN adodb.open_tab2(:rs,:tt); END;",true);
61 | $db->OutParameter($stmt, $cur, 'rs', -1, OCI_B_CURSOR);
62 | $db->OutParameter($stmt, $vv, 'tt');
63 | $rs = $db->Execute($stmt);
64 | while (!$rs->EOF) {
65 | adodb_pr($rs->fields);
66 | $rs->MoveNext();
67 | }
68 | echo " val = $vv";
69 |
70 | }
71 |
72 | if (0) {
73 | $db = ADONewConnection('odbc_oracle');
74 | if (!$db->PConnect('local_oracle','scott','tiger')) die('fail connect');
75 | $db->debug = true;
76 | $rs = $db->Execute(
77 | 'select * from adoxyz where firstname=? and trim(lastname)=?',
78 | array('first'=>'Caroline','last'=>'Miranda'));
79 | if (!$rs) die("Empty RS");
80 | if ($rs->EOF) die("EOF RS");
81 | rs2html($rs);
82 | }
83 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/server.php:
--------------------------------------------------------------------------------
1 | Connect($host,$uid,$pwd,$database)) err($conn->ErrorNo(). $sep . $conn->ErrorMsg());
82 | $sql = undomq($_REQUEST['sql']);
83 |
84 | if (isset($_REQUEST['fetch']))
85 | $ADODB_FETCH_MODE = $_REQUEST['fetch'];
86 |
87 | if (isset($_REQUEST['nrows'])) {
88 | $nrows = $_REQUEST['nrows'];
89 | $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : -1;
90 | $rs = $conn->SelectLimit($sql,$nrows,$offset);
91 | } else
92 | $rs = $conn->Execute($sql);
93 | if ($rs){
94 | //$rs->timeToLive = 1;
95 | echo _rs2serialize($rs,$conn,$sql);
96 | $rs->Close();
97 | } else
98 | err($conn->ErrorNo(). $sep .$conn->ErrorMsg());
99 |
100 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/tests/testsessions.php:
--------------------------------------------------------------------------------
1 | Notify Expiring=$ref, sessionkey=$key";
16 | }
17 |
18 | //-------------------------------------------------------------------
19 |
20 | error_reporting(E_ALL);
21 |
22 |
23 | ob_start();
24 | include('../session/adodb-cryptsession2.php');
25 |
26 |
27 | $options['debug'] = 1;
28 | $db = 'postgres';
29 |
30 | #### CONNECTION
31 | switch($db) {
32 | case 'oci8':
33 | $options['table'] = 'adodb_sessions2';
34 | ADOdb_Session::config('oci8', 'mobydick', 'jdev', 'natsoft', 'mobydick',$options);
35 | break;
36 |
37 | case 'postgres':
38 | $options['table'] = 'sessions2';
39 | ADOdb_Session::config('postgres', 'localhost', 'postgres', 'natsoft', 'northwind',$options);
40 | break;
41 |
42 | case 'mysql':
43 | default:
44 | $options['table'] = 'sessions2';
45 | ADOdb_Session::config('mysql', 'localhost', 'root', '', 'xphplens_2',$options);
46 | break;
47 |
48 |
49 | }
50 |
51 |
52 |
53 | #### SETUP NOTIFICATION
54 | $USER = 'JLIM'.rand();
55 | $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');
56 |
57 | adodb_session_create_table();
58 | session_start();
59 |
60 | adodb_session_regenerate_id();
61 |
62 | ### SETUP SESSION VARIABLES
63 | if (empty($_SESSION['MONKEY'])) $_SESSION['MONKEY'] = array(1,'abc',44.41);
64 | else $_SESSION['MONKEY'][0] += 1;
65 | if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] += 1;
66 |
67 |
68 | ### START DISPLAY
69 | print "PHP ".PHP_VERSION."
";
70 | print "\$_SESSION['AVAR']={$_SESSION['AVAR']}
";
71 |
72 | print "
Cookies: ";
73 | print_r($_COOKIE);
74 |
75 | var_dump($_SESSION['MONKEY']);
76 |
77 | ### RANDOMLY PERFORM Garbage Collection
78 | ### In real-production environment, this is done for you
79 | ### by php's session extension, which calls adodb_sess_gc()
80 | ### automatically for you. See php.ini's
81 | ### session.cookie_lifetime and session.gc_probability
82 |
83 | if (rand() % 5 == 0) {
84 |
85 | print "
Garbage Collection
";
86 | adodb_sess_gc(10);
87 |
88 | if (rand() % 2 == 0) {
89 | print "Random own session destroy
";
90 | session_destroy();
91 | }
92 | } else {
93 | $DB = ADODB_Session::_conn();
94 | $sessk = $DB->qstr('%AZ'.rand().time());
95 | $olddate = $DB->DBTimeStamp(time()-30*24*3600);
96 | $rr = $DB->qstr(rand());
97 | $DB->Execute("insert into {$options['table']} (sesskey,expiry,expireref,sessdata,created,modified) values ($sessk,$olddate, $rr,'',$olddate,$olddate)");
98 | }
99 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/datadict/datadict-sqlite.inc.php:
--------------------------------------------------------------------------------
1 | debug) ADOConnection::outp("AlterColumnSQL not supported natively by SQLite");
73 | return array();
74 | }
75 |
76 | function DropColumnSQL($tabname, $flds)
77 | {
78 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported natively by SQLite");
79 | return array();
80 | }
81 |
82 | function RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='')
83 | {
84 | if ($this->debug) ADOConnection::outp("RenameColumnSQL not supported natively by SQLite");
85 | return array();
86 | }
87 |
88 | }
89 | ?>
90 |
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-vfp.inc.php:
--------------------------------------------------------------------------------
1 | ADODB_odbc();
40 | }
41 |
42 | function Time()
43 | {
44 | return time();
45 | }
46 |
47 | function BeginTrans() { return false;}
48 |
49 | // quote string to be sent back to database
50 | function qstr($s,$nofixquotes=false)
51 | {
52 | if (!$nofixquotes) return "'".str_replace("\r\n","'+chr(13)+'",str_replace("'",$this->replaceQuote,$s))."'";
53 | return "'".$s."'";
54 | }
55 |
56 |
57 | // TOP requires ORDER BY for VFP
58 | function SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$secs2cache=0)
59 | {
60 | $this->hasTop = preg_match('/ORDER[ \t\r\n]+BY/is',$sql) ? 'top' : false;
61 | $ret = ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$secs2cache);
62 | return $ret;
63 | }
64 |
65 |
66 |
67 | };
68 |
69 |
70 | class ADORecordSet_vfp extends ADORecordSet_odbc {
71 |
72 | var $databaseType = "vfp";
73 |
74 |
75 | function ADORecordSet_vfp($id,$mode=false)
76 | {
77 | return $this->ADORecordSet_odbc($id,$mode);
78 | }
79 |
80 | function MetaType($t,$len=-1)
81 | {
82 | if (is_object($t)) {
83 | $fieldobj = $t;
84 | $t = $fieldobj->type;
85 | $len = $fieldobj->max_length;
86 | }
87 | switch (strtoupper($t)) {
88 | case 'C':
89 | if ($len <= $this->blobSize) return 'C';
90 | case 'M':
91 | return 'X';
92 |
93 | case 'D': return 'D';
94 |
95 | case 'T': return 'T';
96 |
97 | case 'L': return 'L';
98 |
99 | case 'I': return 'I';
100 |
101 | default: return 'N';
102 | }
103 | }
104 | }
105 |
106 | } //define
107 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-pdo_oci.inc.php:
--------------------------------------------------------------------------------
1 | _bindInputArray = true;
29 | $parentDriver->_nestedSQL = true;
30 | if ($this->_initdate) {
31 | $parentDriver->Execute("ALTER SESSION SET NLS_DATE_FORMAT='".$this->NLS_DATE_FORMAT."'");
32 | }
33 | }
34 |
35 | function MetaTables($ttype=false,$showSchema=false,$mask=false)
36 | {
37 | if ($mask) {
38 | $save = $this->metaTablesSQL;
39 | $mask = $this->qstr(strtoupper($mask));
40 | $this->metaTablesSQL .= " AND table_name like $mask";
41 | }
42 | $ret = ADOConnection::MetaTables($ttype,$showSchema);
43 |
44 | if ($mask) {
45 | $this->metaTablesSQL = $save;
46 | }
47 | return $ret;
48 | }
49 |
50 | function MetaColumns($table,$normalize=true)
51 | {
52 | global $ADODB_FETCH_MODE;
53 |
54 | $false = false;
55 | $save = $ADODB_FETCH_MODE;
56 | $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
57 | if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
58 |
59 | $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
60 |
61 | if (isset($savem)) $this->SetFetchMode($savem);
62 | $ADODB_FETCH_MODE = $save;
63 | if (!$rs) {
64 | return $false;
65 | }
66 | $retarr = array();
67 | while (!$rs->EOF) { //print_r($rs->fields);
68 | $fld = new ADOFieldObject();
69 | $fld->name = $rs->fields[0];
70 | $fld->type = $rs->fields[1];
71 | $fld->max_length = $rs->fields[2];
72 | $fld->scale = $rs->fields[3];
73 | if ($rs->fields[1] == 'NUMBER' && $rs->fields[3] == 0) {
74 | $fld->type ='INT';
75 | $fld->max_length = $rs->fields[4];
76 | }
77 | $fld->not_null = (strncmp($rs->fields[5], 'NOT',3) === 0);
78 | $fld->binary = (strpos($fld->type,'BLOB') !== false);
79 | $fld->default_value = $rs->fields[6];
80 |
81 | if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
82 | else $retarr[strtoupper($fld->name)] = $fld;
83 | $rs->MoveNext();
84 | }
85 | $rs->Close();
86 | if (empty($retarr))
87 | return $false;
88 | else
89 | return $retarr;
90 | }
91 | }
92 |
93 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/adodb-errorhandler.inc.php:
--------------------------------------------------------------------------------
1 | $s";
77 | trigger_error($s,ADODB_ERROR_HANDLER_TYPE);
78 | }
79 | ?>
80 |
--------------------------------------------------------------------------------
/src/required/adodb5/tests/test-php5.php:
--------------------------------------------------------------------------------
1 | PHP ".PHP_VERSION."\n";
19 | try {
20 |
21 | $dbt = 'oci8po';
22 |
23 | try {
24 | switch($dbt) {
25 | case 'oci8po':
26 | $db = NewADOConnection("oci8po");
27 |
28 | $db->Connect('localhost','scott','natsoft','sherkhan');
29 | break;
30 | default:
31 | case 'mysql':
32 | $db = NewADOConnection("mysql");
33 | $db->Connect('localhost','root','','northwind');
34 | break;
35 |
36 | case 'mysqli':
37 | $db = NewADOConnection("mysqli://root:@localhost/northwind");
38 | //$db->Connect('localhost','root','','test');
39 | break;
40 | }
41 | } catch (exception $e){
42 | echo "Connect Failed";
43 | adodb_pr($e);
44 | die();
45 | }
46 |
47 | $db->debug=1;
48 |
49 | $cnt = $db->GetOne("select count(*) from adoxyz where ?Prepare("select * from adoxyz where ?ErrorMsg(),"\n";
52 | $rs = $db->Execute($stmt,array(10,20));
53 |
54 | echo "
Foreach Iterator Test (rand=".rand().")
";
55 | $i = 0;
56 | foreach($rs as $v) {
57 | $i += 1;
58 | echo "rec $i: "; $s1 = adodb_pr($v,true); $s2 = adodb_pr($rs->fields,true);
59 | if ($s1 != $s2 && !empty($v)) {adodb_pr($s1); adodb_pr($s2);}
60 | else echo "passed
";
61 | flush();
62 | }
63 |
64 | $rs = new ADORecordSet_empty();
65 | foreach($rs as $v) {
66 | echo "empty ";var_dump($v);
67 | }
68 |
69 |
70 | if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n");
71 | else echo "Count $i is correct
";
72 |
73 | $rs = $db->Execute("select bad from badder");
74 |
75 | } catch (exception $e) {
76 | adodb_pr($e);
77 | echo "
adodb_backtrace:
\n";
78 | $e = adodb_backtrace($e->gettrace());
79 | }
80 |
81 | $rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order by id");
82 | echo "Result=\n",$rs,"";
83 |
84 | echo "Active Record
";
85 |
86 | include_once("../adodb-active-record.inc.php");
87 | ADOdb_Active_Record::SetDatabaseAdapter($db);
88 |
89 | try {
90 | class City extends ADOdb_Active_Record{};
91 | $a = new City();
92 |
93 | } catch(exception $e){
94 | echo $e->getMessage();
95 | }
96 |
97 | try {
98 |
99 | $a = new City();
100 |
101 | echo "Successfully created City()
";
102 | #var_dump($a->GetPrimaryKeys());
103 | $a->city = 'Kuala Lumpur';
104 | $a->Save();
105 | $a->Update();
106 | #$a->SetPrimaryKeys(array('city'));
107 | $a->country = "M'sia";
108 | $a->save();
109 | $a->Delete();
110 | } catch(exception $e){
111 | echo $e->getMessage();
112 | }
113 |
114 | //include_once("test-active-record.php");
115 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/datadict/datadict-generic.inc.php:
--------------------------------------------------------------------------------
1 | debug) ADOConnection::outp("AlterColumnSQL not supported");
55 | return array();
56 | }
57 |
58 |
59 | function DropColumnSQL($tabname, $flds)
60 | {
61 | if ($this->debug) ADOConnection::outp("DropColumnSQL not supported");
62 | return array();
63 | }
64 |
65 | }
66 |
67 | /*
68 | //db2
69 | function ActualType($meta)
70 | {
71 | switch($meta) {
72 | case 'C': return 'VARCHAR';
73 | case 'X': return 'VARCHAR';
74 |
75 | case 'C2': return 'VARCHAR'; // up to 32K
76 | case 'X2': return 'VARCHAR';
77 |
78 | case 'B': return 'BLOB';
79 |
80 | case 'D': return 'DATE';
81 | case 'T': return 'TIMESTAMP';
82 |
83 | case 'L': return 'SMALLINT';
84 | case 'I': return 'INTEGER';
85 | case 'I1': return 'SMALLINT';
86 | case 'I2': return 'SMALLINT';
87 | case 'I4': return 'INTEGER';
88 | case 'I8': return 'BIGINT';
89 |
90 | case 'F': return 'DOUBLE';
91 | case 'N': return 'DECIMAL';
92 | default:
93 | return $meta;
94 | }
95 | }
96 |
97 | // ifx
98 | function ActualType($meta)
99 | {
100 | switch($meta) {
101 | case 'C': return 'VARCHAR';// 255
102 | case 'X': return 'TEXT';
103 |
104 | case 'C2': return 'NVARCHAR';
105 | case 'X2': return 'TEXT';
106 |
107 | case 'B': return 'BLOB';
108 |
109 | case 'D': return 'DATE';
110 | case 'T': return 'DATETIME';
111 |
112 | case 'L': return 'SMALLINT';
113 | case 'I': return 'INTEGER';
114 | case 'I1': return 'SMALLINT';
115 | case 'I2': return 'SMALLINT';
116 | case 'I4': return 'INTEGER';
117 | case 'I8': return 'DECIMAL(20)';
118 |
119 | case 'F': return 'FLOAT';
120 | case 'N': return 'DECIMAL';
121 | default:
122 | return $meta;
123 | }
124 | }
125 | */
126 | ?>
--------------------------------------------------------------------------------
/src/Manipulation/Abstract.php:
--------------------------------------------------------------------------------
1 | _objectMapped = clone $objectMapped;
37 |
38 | $this->initConnection();
39 | }
40 |
41 | protected function Execute()
42 | {
43 | $this->updateLocal();
44 |
45 | if (is_null($this->_query))
46 | {
47 | $this->Prepare();
48 |
49 | $this->SetParams();
50 | }
51 | else
52 | {
53 | $this->PrepareQuery();
54 | }
55 |
56 | return $this->Run();
57 | }
58 |
59 | private function initConnection()
60 | {
61 | $connection = new Vophper_Connection();
62 |
63 | $this->_connection = $connection->connection;
64 |
65 | $this->_connection->SetFetchMode(ADODB_FETCH_ASSOC);
66 | }
67 |
68 | protected function findDinamicObjects()
69 | {
70 | $vars = get_object_vars($this->_objectMapped);
71 |
72 | if ($vars)
73 | {
74 | foreach ($vars as $key => $var)
75 | {
76 | if (strstr($key, "relationship") !== false )
77 | {
78 | $this->_relationships[] = $key;
79 | }
80 | }
81 | }
82 | }
83 |
84 | public function IgnoreFields($string)
85 | {
86 | $this->_ignoredFields = explode(',', $string);
87 | return $this;
88 | }
89 |
90 | protected function AbstractFields()
91 | {
92 | if (empty($this->_fields))
93 | {
94 | $methods = get_class_methods($this->_objectMapped);
95 |
96 | $ignoredFields = array_merge($this->_objectMapped->_pk(), $this->_ignoredFields);
97 |
98 | foreach ($methods as $method)
99 | {
100 | if (substr($method, 0, 3) == 'get')
101 | {
102 | $abstratedField = strtolower(str_replace("get", "", $method));
103 |
104 | if (!in_array($abstratedField, $ignoredFields))
105 | {
106 | $this->_abstractedFields[] = $abstratedField;
107 | }
108 | }
109 | }
110 | }
111 | else
112 | {
113 | $fields = str_replace(" ", "", $this->_fields);
114 |
115 | $this->_abstractedFields[] = explode(",", $fields);
116 | }
117 | }
118 |
119 | public function Fields($fields)
120 | {
121 | $this->_fields = $this->_fields . $fields;
122 | return $this;
123 | }
124 |
125 | public function Query($string)
126 | {
127 | $this->_query = $string;
128 | return $this;
129 | }
130 |
131 | protected function PrepareQuery()
132 | {
133 | $this->_stmt = $this->_connection->Prepare($this->_query);
134 | }
135 |
136 | static protected function fieldToGetter($field)
137 | {
138 | return 'get' . ucwords(strtolower($field)) . '()';
139 | }
140 |
141 | public function AdodbHand()
142 | {
143 | return $this->_connection;
144 | }
145 | }
--------------------------------------------------------------------------------
/src/required/adodb5/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 |
87 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/docs/readme.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 | ADODB Manual
4 |
5 |
10 |
11 |
12 |
13 | ADOdb Library for PHP
14 | ADOdb is a suite of database libraries that allow you to connect to multiple
15 | databases in a portable manner. Download from http://adodb.sourceforge.net/.
16 |
- The ADOdb documentation has moved to docs-adodb.htm
17 | This allows you to query, update and insert records using a portable API.
18 |
- The ADOdb data dictionary docs are at docs-datadict.htm.
19 | This allows you to create database tables and indexes in a portable manner.
20 |
- The ADOdb database performance monitoring docs are at docs-perf.htm.
21 | This allows you to perform health checks, tune and monitor your database.
22 |
- The ADOdb database-backed session docs are at docs-session.htm.
23 |
24 |
25 |
Installation
26 | Make sure you are running PHP5 or later. For PHP 4 or earlier, you need to use adodb 4.9. Unpack all the files into a directory accessible by your webserver.
27 |
28 | To test, try modifying some of the tutorial examples. Make sure you customize the connection settings correctly. You can debug using:
29 |
30 | <?php
31 | include('adodb/adodb.inc.php');
32 |
33 | $db = ADONewConnection($driver); # eg. 'mysql' or 'oci8'
34 | $db->debug = true;
35 | $db->Connect($server, $user, $password, $database);
36 | $rs = $db->Execute('select * from some_small_table');
37 | print "<pre>";
38 | print_r($rs->GetRows());
39 | print "</pre>";
40 | ?>
41 |
42 | How are people using ADOdb
43 | Here are some examples of how people are using ADOdb:
44 |
45 | - PhpLens is a commercial data grid component that allows
46 | both cool Web designers and serious unshaved programmers to develop and
47 | maintain databases on the Web easily. Developed by the author of ADOdb.
48 |
49 | - PHAkt: PHP Extension for DreamWeaver Ultradev allows
50 | you to script PHP in the popular Web page editor. Database handling provided
51 | by ADOdb.
52 | - Analysis Console for Intrusion Databases (ACID): PHP-based
53 | analysis engine to search and process a database of security incidents
54 | generated by security-related software such as IDSes and firewalls (e.g.
55 | Snort, ipchains). By Roman Danyliw.
56 | - PostNuke is a very popular free content management system
57 | and weblog system. It offers full CSS support, HTML 4.01 transitional
58 | compliance throughout, an advanced blocks system, and is fully multi-lingual
59 | enabled.
60 | - EasyPublish CMS is another free content management system
61 | for managing information and integrated modules on your internet, intranet-
62 | and extranet-sites. From Norway.
63 | - NOLA is a full featured accounting, inventory, and job
64 | tracking application. It is licensed under the GPL, and developed by Noguska.
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/src/required/adodb5/perf/perf-db2.inc.php:
--------------------------------------------------------------------------------
1 | array('RATIO',
34 | "SELECT
35 | case when sum(POOL_DATA_L_READS+POOL_INDEX_L_READS)=0 then 0
36 | else 100*(1-sum(POOL_DATA_P_READS+POOL_INDEX_P_READS)/sum(POOL_DATA_L_READS+POOL_INDEX_L_READS)) end
37 | FROM TABLE(SNAPSHOT_APPL('',-2)) as t",
38 | '=WarnCacheRatio'),
39 |
40 | 'Data Cache',
41 | 'data cache buffers' => array('DATAC',
42 | 'select sum(npages) from SYSCAT.BUFFERPOOLS',
43 | 'See tuning reference.' ),
44 | 'cache blocksize' => array('DATAC',
45 | 'select avg(pagesize) from SYSCAT.BUFFERPOOLS',
46 | '' ),
47 | 'data cache size' => array('DATAC',
48 | 'select sum(npages*pagesize) from SYSCAT.BUFFERPOOLS',
49 | '' ),
50 | 'Connections',
51 | 'current connections' => array('SESS',
52 | "SELECT count(*) FROM TABLE(SNAPSHOT_APPL_INFO('',-2)) as t",
53 | ''),
54 |
55 | false
56 | );
57 |
58 |
59 | function perf_db2(&$conn)
60 | {
61 | $this->conn = $conn;
62 | }
63 |
64 | function Explain($sql,$partial=false)
65 | {
66 | $save = $this->conn->LogSQL(false);
67 | if ($partial) {
68 | $sqlq = $this->conn->qstr($sql.'%');
69 | $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq");
70 | if ($arr) {
71 | foreach($arr as $row) {
72 | $sql = reset($row);
73 | if (crc32($sql) == $partial) break;
74 | }
75 | }
76 | }
77 | $qno = rand();
78 | $ok = $this->conn->Execute("EXPLAIN PLAN SET QUERYNO=$qno FOR $sql");
79 | ob_start();
80 | if (!$ok) echo "Have EXPLAIN tables been created?
";
81 | else {
82 | $rs = $this->conn->Execute("select * from explain_statement where queryno=$qno");
83 | if ($rs) rs2html($rs);
84 | }
85 | $s = ob_get_contents();
86 | ob_end_clean();
87 | $this->conn->LogSQL($save);
88 |
89 | $s .= $this->Tracer($sql);
90 | return $s;
91 | }
92 |
93 |
94 | function Tables()
95 | {
96 | $rs = $this->conn->Execute("select tabschema,tabname,card as rows,
97 | npages pages_used,fpages pages_allocated, tbspace tablespace
98 | from syscat.tables where tabschema not in ('SYSCAT','SYSIBM','SYSSTAT') order by 1,2");
99 | return rs2html($rs,false,false,false,false);
100 | }
101 | }
102 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/tests/testoci8cursor.php:
--------------------------------------------------------------------------------
1 | PConnect('','scott','natsoft');
64 | $db->debug = 99;
65 |
66 |
67 | /*
68 | */
69 |
70 | define('MYNUM',5);
71 |
72 |
73 | $rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:RS,'A%'); END;");
74 |
75 | if ($rs && !$rs->EOF) {
76 | print "Test 1 RowCount: ".$rs->RecordCount()."";
77 | } else {
78 | print "Error in using Cursor Variables 1
";
79 | }
80 |
81 | print "
Testing Stored Procedures for oci8
";
82 |
83 | $stid = $db->PrepareSP('BEGIN adodb.myproc('.MYNUM.', :myov); END;');
84 | $db->OutParameter($stid, $myov, 'myov');
85 | $db->Execute($stid);
86 | if ($myov != MYNUM) print "Error with myproc
";
87 |
88 |
89 | $stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;",true);
90 | $a1 = 'Malaysia';
91 | //$a2 = ''; # a2 doesn't even need to be defined!
92 | $db->InParameter($stmt,$a1,'a1');
93 | $db->OutParameter($stmt,$a2,'a2');
94 | $rs = $db->Execute($stmt);
95 | if ($rs) {
96 | if ($a2 !== 'Cinta Hati Malaysia') print "Stored Procedure Error: a2 = $a2";
97 | else echo "OK: a2=$a2
";
98 | } else {
99 | print "Error in using Stored Procedure IN/Out Variables
";
100 | }
101 |
102 |
103 | $tname = 'A%';
104 |
105 | $stmt = $db->PrepareSP('select * from tab where tname like :tablename');
106 | $db->Parameter($stmt,$tname,'tablename');
107 | $rs = $db->Execute($stmt);
108 | rs2html($rs);
109 |
110 |
111 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/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 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-odbc_oracle.inc.php:
--------------------------------------------------------------------------------
1 | ADODB_odbc();
37 | }
38 |
39 | function MetaTables()
40 | {
41 | $false = false;
42 | $rs = $this->Execute($this->metaTablesSQL);
43 | if ($rs === false) return $false;
44 | $arr = $rs->GetArray();
45 | $arr2 = array();
46 | for ($i=0; $i < sizeof($arr); $i++) {
47 | $arr2[] = $arr[$i][0];
48 | }
49 | $rs->Close();
50 | return $arr2;
51 | }
52 |
53 | function MetaColumns($table, $normalize=true)
54 | {
55 | global $ADODB_FETCH_MODE;
56 |
57 | $rs = $this->Execute(sprintf($this->metaColumnsSQL,strtoupper($table)));
58 | if ($rs === false) {
59 | $false = false;
60 | return $false;
61 | }
62 | $retarr = array();
63 | while (!$rs->EOF) { //print_r($rs->fields);
64 | $fld = new ADOFieldObject();
65 | $fld->name = $rs->fields[0];
66 | $fld->type = $rs->fields[1];
67 | $fld->max_length = $rs->fields[2];
68 |
69 |
70 | if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) $retarr[] = $fld;
71 | else $retarr[strtoupper($fld->name)] = $fld;
72 |
73 | $rs->MoveNext();
74 | }
75 | $rs->Close();
76 | return $retarr;
77 | }
78 |
79 | // returns true or false
80 | function _connect($argDSN, $argUsername, $argPassword, $argDatabasename)
81 | {
82 | global $php_errormsg;
83 |
84 | $php_errormsg = '';
85 | $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
86 | $this->_errorMsg = $php_errormsg;
87 |
88 | $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
89 | //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
90 | return $this->_connectionID != false;
91 | }
92 | // returns true or false
93 | function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename)
94 | {
95 | global $php_errormsg;
96 | $php_errormsg = '';
97 | $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,SQL_CUR_USE_ODBC );
98 | $this->_errorMsg = $php_errormsg;
99 |
100 | $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
101 | //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true);
102 | return $this->_connectionID != false;
103 | }
104 | }
105 |
106 | class ADORecordSet_odbc_oracle extends ADORecordSet_odbc {
107 |
108 | var $databaseType = 'odbc_oracle';
109 |
110 | function ADORecordSet_odbc_oracle($id,$mode=false)
111 | {
112 | return $this->ADORecordSet_odbc($id,$mode);
113 | }
114 | }
115 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/datadict/datadict-sapdb.inc.php:
--------------------------------------------------------------------------------
1 | type;
58 | $len = $fieldobj->max_length;
59 | }
60 | static $maxdb_type2adodb = array(
61 | 'VARCHAR' => 'C',
62 | 'CHARACTER' => 'C',
63 | 'LONG' => 'X', // no way to differ between 'X' and 'B' :-(
64 | 'DATE' => 'D',
65 | 'TIMESTAMP' => 'T',
66 | 'BOOLEAN' => 'L',
67 | 'INTEGER' => 'I4',
68 | 'SMALLINT' => 'I2',
69 | 'FLOAT' => 'F',
70 | 'FIXED' => 'N',
71 | );
72 | $type = isset($maxdb_type2adodb[$t]) ? $maxdb_type2adodb[$t] : 'C';
73 |
74 | // convert integer-types simulated with fixed back to integer
75 | if ($t == 'FIXED' && !$fieldobj->scale && ($len == 20 || $len == 3)) {
76 | $type = $len == 20 ? 'I8' : 'I1';
77 | }
78 | if ($fieldobj->auto_increment) $type = 'R';
79 |
80 | return $type;
81 | }
82 |
83 | // return string must begin with space
84 | function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
85 | {
86 | $suffix = '';
87 | if ($funsigned) $suffix .= ' UNSIGNED';
88 | if ($fnotnull) $suffix .= ' NOT NULL';
89 | if ($fautoinc) $suffix .= ' DEFAULT SERIAL';
90 | elseif (strlen($fdefault)) $suffix .= " DEFAULT $fdefault";
91 | if ($fconstraint) $suffix .= ' '.$fconstraint;
92 | return $suffix;
93 | }
94 |
95 | function AddColumnSQL($tabname, $flds)
96 | {
97 | $tabname = $this->TableName ($tabname);
98 | $sql = array();
99 | list($lines,$pkey) = $this->_GenFields($flds);
100 | return array( 'ALTER TABLE ' . $tabname . ' ADD (' . implode(', ',$lines) . ')' );
101 | }
102 |
103 | function AlterColumnSQL($tabname, $flds)
104 | {
105 | $tabname = $this->TableName ($tabname);
106 | $sql = array();
107 | list($lines,$pkey) = $this->_GenFields($flds);
108 | return array( 'ALTER TABLE ' . $tabname . ' MODIFY (' . implode(', ',$lines) . ')' );
109 | }
110 |
111 | function DropColumnSQL($tabname, $flds)
112 | {
113 | $tabname = $this->TableName ($tabname);
114 | if (!is_array($flds)) $flds = explode(',',$flds);
115 | foreach($flds as $k => $v) {
116 | $flds[$k] = $this->NameQuote($v);
117 | }
118 | return array( 'ALTER TABLE ' . $tabname . ' DROP (' . implode(', ',$flds) . ')' );
119 | }
120 | }
121 |
122 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-sybase_ase.inc.php:
--------------------------------------------------------------------------------
1 | metaTablesSQL) {
32 | // complicated state saving by the need for backward compat
33 |
34 | if ($ttype == 'VIEWS'){
35 | $sql = str_replace('U', 'V', $this->metaTablesSQL);
36 | }elseif (false === $ttype){
37 | $sql = str_replace('U',"U' OR type='V", $this->metaTablesSQL);
38 | }else{ // TABLES OR ANY OTHER
39 | $sql = $this->metaTablesSQL;
40 | }
41 | $rs = $this->Execute($sql);
42 |
43 | if ($rs === false || !method_exists($rs, 'GetArray')){
44 | return $false;
45 | }
46 | $arr = $rs->GetArray();
47 |
48 | $arr2 = array();
49 | foreach($arr as $key=>$value){
50 | $arr2[] = trim($value['name']);
51 | }
52 | return $arr2;
53 | }
54 | return $false;
55 | }
56 |
57 | function MetaDatabases()
58 | {
59 | $arr = array();
60 | if ($this->metaDatabasesSQL!='') {
61 | $rs = $this->Execute($this->metaDatabasesSQL);
62 | if ($rs && !$rs->EOF){
63 | while (!$rs->EOF){
64 | $arr[] = $rs->Fields('name');
65 | $rs->MoveNext();
66 | }
67 | return $arr;
68 | }
69 | }
70 | return false;
71 | }
72 |
73 | // fix a bug which prevent the metaColumns query to be executed for Sybase ASE
74 | function MetaColumns($table,$upper=false)
75 | {
76 | $false = false;
77 | if (!empty($this->metaColumnsSQL)) {
78 |
79 | $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table));
80 | if ($rs === false) return $false;
81 |
82 | $retarr = array();
83 | while (!$rs->EOF) {
84 | $fld = new ADOFieldObject();
85 | $fld->name = $rs->Fields('field_name');
86 | $fld->type = $rs->Fields('type');
87 | $fld->max_length = $rs->Fields('width');
88 | $retarr[strtoupper($fld->name)] = $fld;
89 | $rs->MoveNext();
90 | }
91 | $rs->Close();
92 | return $retarr;
93 | }
94 | return $false;
95 | }
96 |
97 | function getProcedureList($schema)
98 | {
99 | return false;
100 | }
101 |
102 | function ErrorMsg()
103 | {
104 | if (!function_exists('sybase_connect')){
105 | return 'Your PHP doesn\'t contain the Sybase connection module!';
106 | }
107 | return parent::ErrorMsg();
108 | }
109 | }
110 |
111 | class adorecordset_sybase_ase extends ADORecordset_sybase {
112 | var $databaseType = "sybase_ase";
113 | function ADORecordset_sybase_ase($id,$mode=false)
114 | {
115 | $this->ADORecordSet_sybase($id,$mode);
116 | }
117 |
118 | }
119 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/drivers/adodb-mysqlpo.inc.php:
--------------------------------------------------------------------------------
1 |
12 |
13 | Requires mysql client. Works on Windows and Unix.
14 | */
15 |
16 | // security - hide paths
17 | if (!defined('ADODB_DIR')) die();
18 |
19 | include_once(ADODB_DIR . "/drivers/adodb-mysql.inc.php");
20 |
21 |
22 | class ADODB_mysqlt extends ADODB_mysql {
23 | var $databaseType = 'mysqlt';
24 | var $ansiOuter = true; // for Version 3.23.17 or later
25 | var $hasTransactions = true;
26 | var $autoRollback = true; // apparently mysql does not autorollback properly
27 |
28 | function ADODB_mysqlt()
29 | {
30 | global $ADODB_EXTENSION; if ($ADODB_EXTENSION) $this->rsPrefix .= 'ext_';
31 | }
32 |
33 | function BeginTrans()
34 | {
35 | if ($this->transOff) return true;
36 | $this->transCnt += 1;
37 | $this->Execute('SET AUTOCOMMIT=0');
38 | $this->Execute('BEGIN');
39 | return true;
40 | }
41 |
42 | function CommitTrans($ok=true)
43 | {
44 | if ($this->transOff) return true;
45 | if (!$ok) return $this->RollbackTrans();
46 |
47 | if ($this->transCnt) $this->transCnt -= 1;
48 | $this->Execute('COMMIT');
49 | $this->Execute('SET AUTOCOMMIT=1');
50 | return true;
51 | }
52 |
53 | function RollbackTrans()
54 | {
55 | if ($this->transOff) return true;
56 | if ($this->transCnt) $this->transCnt -= 1;
57 | $this->Execute('ROLLBACK');
58 | $this->Execute('SET AUTOCOMMIT=1');
59 | return true;
60 | }
61 |
62 | function RowLock($tables,$where='',$col='1 as adodbignore')
63 | {
64 | if ($this->transCnt==0) $this->BeginTrans();
65 | if ($where) $where = ' where '.$where;
66 | $rs = $this->Execute("select $col from $tables $where for update");
67 | return !empty($rs);
68 | }
69 |
70 | }
71 |
72 | class ADORecordSet_mysqlt extends ADORecordSet_mysql{
73 | var $databaseType = "mysqlt";
74 |
75 | function ADORecordSet_mysqlt($queryID,$mode=false)
76 | {
77 | if ($mode === false) {
78 | global $ADODB_FETCH_MODE;
79 | $mode = $ADODB_FETCH_MODE;
80 | }
81 |
82 | switch ($mode)
83 | {
84 | case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
85 | case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
86 |
87 | case ADODB_FETCH_DEFAULT:
88 | case ADODB_FETCH_BOTH:
89 | default: $this->fetchMode = MYSQL_BOTH; break;
90 | }
91 |
92 | $this->adodbFetchMode = $mode;
93 | $this->ADORecordSet($queryID);
94 | }
95 |
96 | function MoveNext()
97 | {
98 | if (@$this->fields = mysql_fetch_array($this->_queryID,$this->fetchMode)) {
99 | $this->_currentRow += 1;
100 | return true;
101 | }
102 | if (!$this->EOF) {
103 | $this->_currentRow += 1;
104 | $this->EOF = true;
105 | }
106 | return false;
107 | }
108 | }
109 |
110 | class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt {
111 |
112 | function ADORecordSet_ext_mysqlt($queryID,$mode=false)
113 | {
114 | if ($mode === false) {
115 | global $ADODB_FETCH_MODE;
116 | $mode = $ADODB_FETCH_MODE;
117 | }
118 | switch ($mode)
119 | {
120 | case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
121 | case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
122 |
123 | case ADODB_FETCH_DEFAULT:
124 | case ADODB_FETCH_BOTH:
125 | default:
126 | $this->fetchMode = MYSQL_BOTH; break;
127 | }
128 | $this->adodbFetchMode = $mode;
129 | $this->ADORecordSet($queryID);
130 | }
131 |
132 | function MoveNext()
133 | {
134 | return adodb_movenext($this);
135 | }
136 | }
137 |
138 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/toexport.inc.php:
--------------------------------------------------------------------------------
1 | FieldTypesArray();
75 | reset($fieldTypes);
76 | $i = 0;
77 | while(list(,$o) = each($fieldTypes)) {
78 |
79 | $v = ($o) ? $o->name : 'Field'.($i++);
80 | if ($escquote) $v = str_replace($quote,$escquotequote,$v);
81 | $v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
82 | $elements[] = $v;
83 |
84 | }
85 | $s .= implode($sep, $elements).$NEWLINE;
86 | }
87 | $hasNumIndex = isset($rs->fields[0]);
88 |
89 | $line = 0;
90 | $max = $rs->FieldCount();
91 |
92 | while (!$rs->EOF) {
93 | $elements = array();
94 | $i = 0;
95 |
96 | if ($hasNumIndex) {
97 | for ($j=0; $j < $max; $j++) {
98 | $v = $rs->fields[$j];
99 | if (!is_object($v)) $v = trim($v);
100 | else $v = 'Object';
101 | if ($escquote) $v = str_replace($quote,$escquotequote,$v);
102 | $v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
103 |
104 | if (strpos($v,$sep) !== false || strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
105 | else $elements[] = $v;
106 | }
107 | } else { // ASSOCIATIVE ARRAY
108 | foreach($rs->fields as $v) {
109 | if ($escquote) $v = str_replace($quote,$escquotequote,trim($v));
110 | $v = strip_tags(str_replace("\n", $replaceNewLine, str_replace("\r\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))));
111 |
112 | if (strpos($v,$sep) !== false || strpos($v,$quote) !== false) $elements[] = "$quote$v$quote";
113 | else $elements[] = $v;
114 | }
115 | }
116 | $s .= implode($sep, $elements).$NEWLINE;
117 | $rs->MoveNext();
118 | $line += 1;
119 | if ($fp && ($line % $BUFLINES) == 0) {
120 | if ($fp === true) echo $s;
121 | else fwrite($fp,$s);
122 | $s = '';
123 | }
124 | }
125 |
126 | if ($fp) {
127 | if ($fp === true) echo $s;
128 | else fwrite($fp,$s);
129 | $s = '';
130 | }
131 |
132 | return $s;
133 | }
134 | ?>
--------------------------------------------------------------------------------
/src/required/adodb5/session/adodb-sess.txt:
--------------------------------------------------------------------------------
1 | John,
2 |
3 | I have been an extremely satisfied ADODB user for several years now.
4 |
5 | To give you something back for all your hard work, I've spent the last 3
6 | days rewriting the adodb-session.php code.
7 |
8 | ----------
9 | What's New
10 | ----------
11 |
12 | Here's a list of the new code's benefits:
13 |
14 | * Combines the functionality of the three files:
15 |
16 | adodb-session.php
17 | adodb-session-clob.php
18 | adodb-cryptsession.php
19 |
20 | each with very similar functionality, into a single file adodb-session.php.
21 | This will ease maintenance and support issues.
22 |
23 | * Supports multiple encryption and compression schemes.
24 | Currently, we support:
25 |
26 | MD5Crypt (crypt.inc.php)
27 | MCrypt
28 | Secure (Horde's emulation of MCrypt, if MCrypt module is not available.)
29 | GZip
30 | BZip2
31 |
32 | These can be stacked, so if you want to compress and then encrypt your
33 | session data, it's easy.
34 | Also, the built-in MCrypt functions will be *much* faster, and more secure,
35 | than the MD5Crypt code.
36 |
37 | * adodb-session.php contains a single class ADODB_Session that encapsulates
38 | all functionality.
39 | This eliminates the use of global vars and defines (though they are
40 | supported for backwards compatibility).
41 |
42 | * All user defined parameters are now static functions in the ADODB_Session
43 | class.
44 |
45 | New parameters include:
46 |
47 | * encryptionKey(): Define the encryption key used to encrypt the session.
48 | Originally, it was a hard coded string.
49 |
50 | * persist(): Define if the database will be opened in persistent mode.
51 | Originally, the user had to call adodb_sess_open().
52 |
53 | * dataFieldName(): Define the field name used to store the session data, as
54 | 'DATA' appears to be a reserved word in the following cases:
55 | ANSI SQL
56 | IBM DB2
57 | MS SQL Server
58 | Postgres
59 | SAP
60 |
61 | * filter(): Used to support multiple, simulataneous encryption/compression
62 | schemes.
63 |
64 | * Debug support is improved thru _rsdump() function, which is called after
65 | every database call.
66 |
67 | ------------
68 | What's Fixed
69 | ------------
70 |
71 | The new code includes several bug fixes and enhancements:
72 |
73 | * sesskey is compared in BINARY mode for MySQL, to avoid problems with
74 | session keys that differ only by case.
75 | Of course, the user should define the sesskey field as BINARY, to
76 | correctly fix this problem, otherwise performance will suffer.
77 |
78 | * In ADODB_Session::gc(), if $expire_notify is true, the multiple DELETES in
79 | the original code have been optimized to a single DELETE.
80 |
81 | * In ADODB_Session::destroy(), since "SELECT expireref, sesskey FROM $table
82 | WHERE sesskey = $qkey" will only return a single value, we don't loop on the
83 | result, we simply process the row, if any.
84 |
85 | * We close $rs after every use.
86 |
87 | ---------------
88 | What's the Same
89 | ---------------
90 |
91 | I know backwards compatibility is *very* important to you. Therefore, the
92 | new code is 100% backwards compatible.
93 |
94 | If you like my code, but don't "trust" it's backwards compatible, maybe we
95 | offer it as beta code, in a new directory for a release or two?
96 |
97 | ------------
98 | What's To Do
99 | ------------
100 |
101 | I've vascillated over whether to use a single function to get/set
102 | parameters:
103 |
104 | $user = ADODB_Session::user(); // get
105 | ADODB_Session::user($user); // set
106 |
107 | or to use separate functions (which is the PEAR/Java way):
108 |
109 | $user = ADODB_Session::getUser();
110 | ADODB_Session::setUser($user);
111 |
112 | I've chosen the former as it's makes for a simpler API, and reduces the
113 | amount of code, but I'd be happy to change it to the latter.
114 |
115 | Also, do you think the class should be a singleton class, versus a static
116 | class?
117 |
118 | Let me know if you find this code useful, and will be including it in the
119 | next release of ADODB.
120 |
121 | If so, I will modify the current documentation to detail the new
122 | functionality. To that end, what file(s) contain the documentation? Please
123 | send them to me if they are not publically available.
124 |
125 | Also, if there is *anything* in the code that you like to see changed, let
126 | me know.
127 |
128 | Thanks,
129 |
130 | Ross
131 |
132 |
--------------------------------------------------------------------------------
/src/Manipulation/Clauses/Abstract.php:
--------------------------------------------------------------------------------
1 | _clauses = new Vophper_Clauses_Handler();
24 | }
25 |
26 | protected function updateLocal()
27 | {
28 | $this->_joins = $this->_clauses->getJoins();
29 |
30 | $this->_where = $this->_clauses->getWhere();
31 |
32 | $this->_limit = $this->_clauses->getLimit();
33 |
34 | $this->_groupby = $this->_clauses->getGroupBy();
35 |
36 | $this->_orderby = $this->_clauses->getOrderBy();
37 | }
38 |
39 | public function GroupBy($fields)
40 | {
41 | $this->_clauses->setGroupBy($fields);
42 | return $this;
43 | }
44 |
45 | public function OrderBy($fields)
46 | {
47 | $this->_clauses->setOrderBy($fields);
48 | return $this;
49 | }
50 |
51 | public function Limit($rows, $start = '')
52 | {
53 | $this->_clauses->setLimit($rows, $start);
54 | return $this;
55 | }
56 |
57 | public function InnerJoin($tableRef, $conditional)
58 | {
59 | $this->_clauses->setInnerJoin($tableRef, $conditional);
60 |
61 | if (func_num_args() > 2)
62 | {
63 | $parameters = array_slice(func_get_args(), 2);
64 | $this->JoinParams($parameters);
65 | }
66 |
67 | return $this;
68 | }
69 |
70 | public function LeftJoin($tableRef, $conditional)
71 | {
72 | $this->_clauses->setLeftJoin($tableRef, $conditional);
73 |
74 | if (func_num_args() > 2)
75 | {
76 | $parameters = array_slice(func_get_args(), 2);
77 | $this->JoinParams($parameters);
78 | }
79 |
80 | return $this;
81 | }
82 |
83 | public function AndJoin($conditional)
84 | {
85 | $this->_clauses->setAndJoin($conditional);
86 |
87 | if (func_num_args() > 2)
88 | {
89 | $parameters = array_slice(func_get_args(), 2);
90 | $this->JoinParams($parameters);
91 | }
92 |
93 | return $this;
94 | }
95 |
96 | public function OrJoin($conditional)
97 | {
98 | $this->_clauses->setOrJoin($conditional);
99 |
100 | if (func_num_args() > 2)
101 | {
102 | $parameters = array_slice(func_get_args(), 2);
103 | $this->JoinParams($parameters);
104 | }
105 |
106 | return $this;
107 | }
108 |
109 | public function JoinParams($params)
110 | {
111 | $this->_clauses->setParamsJoin($params);
112 | return $this;
113 | }
114 |
115 | public function Where($string)
116 | {
117 | $this->_clauses->setWhere($string);
118 |
119 | if (func_num_args() > 1)
120 | {
121 | $parameters = array_slice(func_get_args(), 1);
122 | $this->WhereParams($parameters);
123 | }
124 |
125 | return $this;
126 | }
127 |
128 | public function WhereLong($string)
129 | {
130 | $this->_clauses->setWhere($string, true);
131 |
132 | if (func_num_args() > 1)
133 | {
134 | $parameters = array_slice(func_get_args(), 1);
135 | $this->WhereParams($parameters);
136 | }
137 |
138 | return $this;
139 | }
140 |
141 | public function AndWhere($string)
142 | {
143 | $this->_clauses->setAndWhere($string);
144 |
145 | if (func_num_args() > 1)
146 | {
147 | $parameters = array_slice(func_get_args(), 1);
148 | $this->WhereParams($parameters);
149 | }
150 |
151 | return $this;
152 | }
153 |
154 | public function OrWhere($string)
155 | {
156 | $this->_clauses->setOrWhere($string);
157 |
158 | if (func_num_args() > 1)
159 | {
160 | $parameters = array_slice(func_get_args(), 1);
161 | $this->WhereParams($parameters);
162 | }
163 |
164 | return $this;
165 | }
166 |
167 | public function WhereParams($params)
168 | {
169 | if (self::$param_replace)
170 | {
171 | foreach ($params as &$param) {
172 | if (in_array($param, self::$param_search)) $param = self::$param_replace;
173 | }
174 | }
175 |
176 | $this->_clauses->setWhereParams($params);
177 | return $this;
178 | }
179 |
180 | static public function ParamsReplace(array $search, $replace)
181 | {
182 | self::$param_search = $search;
183 | self::$param_replace = $replace;
184 | }
185 |
186 | static public function ParamsReplaceClean()
187 | {
188 | unset($this->param_search);
189 | unset($this->param_replace);
190 | }
191 | }
--------------------------------------------------------------------------------