diff --git a/enrol/database/lib.php b/enrol/database/lib.php index 62b44f9d9d1..40f127e60c0 100644 --- a/enrol/database/lib.php +++ b/enrol/database/lib.php @@ -784,9 +784,12 @@ class enrol_database_plugin extends enrol_plugin { ob_start(); //start output buffer to allow later use of the page headers } - $result = $extdb->Connect($this->get_config('dbhost'), $this->get_config('dbuser'), $this->get_config('dbpass'), $this->get_config('dbname'), true); - if (!$result) { - return null; + // the dbtype my contain the new connection URL, so make sure we are not connected yet + if (!$extdb->IsConnected()) { + $result = $extdb->Connect($this->get_config('dbhost'), $this->get_config('dbuser'), $this->get_config('dbpass'), $this->get_config('dbname'), true); + if (!$result) { + return null; + } } $extdb->SetFetchMode(ADODB_FETCH_ASSOC); diff --git a/enrol/database/tests/adodb_test.php b/enrol/database/tests/adodb_test.php new file mode 100644 index 00000000000..6fbbcda439e --- /dev/null +++ b/enrol/database/tests/adodb_test.php @@ -0,0 +1,116 @@ +. + +/** + * basic adodb connection test + * + * @package enrol_database + * @category phpunit + * @copyright 2011 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +global $CFG; +require_once($CFG->dirroot.'/enrol/database/lib.php'); + +class core_adodb_testcase extends advanced_testcase { + public function test_read_table() { + global $DB, $CFG; + + $this->resetAfterTest(); + + set_config('dbencoding', 'utf-8', 'enrol_database'); + + set_config('dbhost', $CFG->dbhost, 'enrol_database'); + set_config('dbuser', $CFG->dbuser, 'enrol_database'); + set_config('dbpass', $CFG->dbpass, 'enrol_database'); + set_config('dbname', $CFG->dbname, 'enrol_database'); + + if (!empty($CFG->dboptions['dbport'])) { + set_config('dbhost', $CFG->dbhost.':'.$CFG->dboptions['dbport'], 'enrol_database'); + } + + switch (get_class($DB)) { + case 'mssql_native_moodle_database': + set_config('dbtype', 'mssql_n', 'enrol_database'); + set_config('dbsybasequoting', '1', 'enrol_database'); + break; + + case 'mysqli_native_moodle_database': + set_config('dbtype', 'mysqli', 'enrol_database'); + set_config('dbsetupsql', 'SET NAMES \'UTF-8\'', 'enrol_database'); + set_config('dbsybasequoting', '0', 'enrol_database'); + if (!empty($CFG->dboptions['dbsocket'])) { + set_config('dbtype', 'mysqli://'.rawurlencode($CFG->dbuser).':'.rawurlencode($CFG->dbpass).'@'.rawurlencode($CFG->dbhost).'/'.rawurlencode($CFG->dbname).'?socket='.rawurlencode($CFG->dboptions['dbsocket']), 'enrol_database'); + } + break; + + case 'oci_native_moodle_database': + set_config('dbtype', 'oci8po', 'enrol_database'); + set_config('dbsybasequoting', '1', 'enrol_database'); + break; + + case 'pgsql_native_moodle_database': + set_config('dbtype', 'postgres7', 'enrol_database'); + set_config('dbsetupsql', 'SET NAMES \'UTF-8\'', 'enrol_database'); + set_config('dbsybasequoting', '0', 'enrol_database'); + if (!empty($CFG->dboptions['dbsocket']) and ($CFG->dbhost === 'localhost' or $CFG->dbhost === '127.0.0.1')) { + set_config('dbhost', $CFG->dboptions['dbsocket'], 'enrol_database'); + } + break; + + case 'sqlsrv_native_moodle_database': + set_config('dbtype', 'sqlsrv', 'enrol_database'); + set_config('dbsybasequoting', '1', 'enrol_database'); + break; + + default: + $this->markTestSkipped('Unknown database driver.'); + return; + } + + $plugin = new enrol_database_tester(); + + // can we connect? + $extdb = $plugin->test_get_db_init(); + $this->assertNotEmpty($extdb); + + // let's fetch one row + $sql = $plugin->test_db_get_sql($CFG->prefix.'user', array('id'=>2), array('id', 'username')); + $rs = $extdb->Execute($sql); + $this->assertEmpty($rs->EOF); + $row = $rs->FetchRow(); + $this->assertEquals('2', $row['id']); + $this->assertEquals('admin', $row['username']); + $this->assertEmpty($rs->FetchRow()); + $rs->Close(); + + $extdb->Close(); + } +} + + +class enrol_database_tester extends enrol_database_plugin { + public function test_get_db_init() { + return self::db_init(); + } + + public function test_db_get_sql($table, array $conditions, array $fields, $distinct = false, $sort = "") { + return self::db_get_sql($table, $conditions, $fields, $distinct, $sort); + } +} diff --git a/lib/adodb/adodb-active-record.inc.php b/lib/adodb/adodb-active-record.inc.php index b7553d597e2..bf20639d3f4 100644 --- a/lib/adodb/adodb-active-record.inc.php +++ b/lib/adodb/adodb-active-record.inc.php @@ -1,7 +1,7 @@ 1 && + if (strlen($val)>0 && (strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")) { return $db->qstr($val); break; @@ -677,7 +679,7 @@ class ADODB_Active_Record { //------------------------------------------------------------ Public functions below - function Load($where=null,$bindarr=false) + function Load($where=null,$bindarr=false, $lock = false) { global $ADODB_FETCH_MODE; @@ -689,10 +691,12 @@ class ADODB_Active_Record { if ($db->fetchMode !== false) $savem = $db->SetFetchMode(false); $qry = "select * from ".$this->_table; - + if($where) { $qry .= ' WHERE '.$where; } + if ($lock) $qry .= $this->lockMode; + $row = $db->GetRow($qry,$bindarr); if (isset($savem)) $db->SetFetchMode($savem); @@ -701,6 +705,11 @@ class ADODB_Active_Record { return $this->Set($row); } + function LoadLocked($where=null, $bindarr=false) + { + $this->Load($where,$bindarr,true); + } + # useful for multiple record inserts # see http://phplens.com/lens/lensforum/msgs.php?id=17795 function Reset() @@ -900,9 +909,10 @@ class ADODB_Active_Record { } } - if (isset($this->_original[$i]) && strcmp($val,$this->_original[$i]) == 0) { - continue; - } + if (isset($this->_original[$i]) && strcmp($val,$this->_original[$i]) == 0) continue; + + if (is_null($this->_original[$i]) && is_null($val)) continue; + $valarr[] = $val; $pairs[] = $this->_QName($name,$db).'='.$db->Param($cnt); $cnt += 1; diff --git a/lib/adodb/adodb-active-recordx.inc.php b/lib/adodb/adodb-active-recordx.inc.php index 994b86b8553..fd8074980d2 100644 --- a/lib/adodb/adodb-active-recordx.inc.php +++ b/lib/adodb/adodb-active-recordx.inc.php @@ -1,7 +1,7 @@ 1 && + if (strlen($val)>0 && (strncmp($val,"'",1) != 0 || substr($val,strlen($val)-1,1) != "'")) { return $db->qstr($val); break; diff --git a/lib/adodb/adodb-csvlib.inc.php b/lib/adodb/adodb-csvlib.inc.php index 2d2449deb6d..8cfb91fb3d8 100644 --- a/lib/adodb/adodb-csvlib.inc.php +++ b/lib/adodb/adodb-csvlib.inc.php @@ -8,7 +8,7 @@ $ADODB_INCLUDED_CSV = 1; /* - V5.14 8 Sept 2011 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights reserved. + V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. diff --git a/lib/adodb/adodb-datadict.inc.php b/lib/adodb/adodb-datadict.inc.php index 31acb2ddafd..e0a7940bd8c 100644 --- a/lib/adodb/adodb-datadict.inc.php +++ b/lib/adodb/adodb-datadict.inc.php @@ -1,7 +1,7 @@ 2038, will return as float - 7 Feb 2011 0.35 Changed adodb_date to be symmetric with adodb_mktime. See $jan1_71. fix for bc. @@ -607,6 +612,12 @@ function adodb_date_test() else print "
Failed :-(
"; } +function adodb_time() +{ + $d = new DateTime(); + return $d->format('U'); +} + /** Returns day of week, 0 = Sunday,... 6=Saturday. Algorithm from PEAR::Date_Calc @@ -1447,4 +1458,4 @@ global $ADODB_DATE_LOCALE; } -?> +?> diff --git a/lib/adodb/adodb.inc.php b/lib/adodb/adodb.inc.php index e3c48768a08..8207f5e7c96 100644 --- a/lib/adodb/adodb.inc.php +++ b/lib/adodb/adodb.inc.php @@ -14,7 +14,7 @@ /** \mainpage - @version V5.14 8 Sept 2011 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights reserved. + @version V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. Released under both BSD license and Lesser GPL library license. You can choose which license you prefer. @@ -177,7 +177,7 @@ /** * ADODB version as a string. */ - $ADODB_vers = 'V5.14 8 Sept 2011 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights reserved. Released BSD & LGPL.'; + $ADODB_vers = 'V5.16 26 Mar 2012 (c) 2000-2012 John Lim (jlim#natsoft.com). All rights reserved. Released BSD & LGPL.'; /** * Determines whether recordset->RecordCount() is used. @@ -216,6 +216,36 @@ */ } + + function _adodb_safedate($s) + { + return str_replace(array("'", '\\'), '', $s); + } + + // parse date string to prevent injection attack + // date string will have one quote at beginning e.g. '3434343' + function _adodb_safedateq($s) + { + $len = strlen($s); + if ($s[0] !== "'") $s2 = "'".$s[0]; + else $s2 = "'"; + for($i=1; $i<$len; $i++) { + $ch = $s[$i]; + if ($ch === '\\') { + $s2 .= "'"; + break; + } elseif ($ch === "'") { + $s2 .= $ch; + break; + } + + $s2 .= $ch; + } + + return strlen($s2) == 0 ? 'null' : $s2; + } + + // for transaction handling function ADODB_TransMonitor($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection) @@ -1596,7 +1626,8 @@ } /** - * Return one row of sql statement. Recordset is disposed for you. + * Return one row of sql statement. Recordset is disposed for you. + * Note that SelectLimit should not be called. * * @param sql SQL statement * @param [inputarr] input bind array @@ -2249,6 +2280,29 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 return false; } + /** + * List procedures or functions in an array. + * @param procedureNamePattern a procedure name pattern; must match the procedure name as it is stored in the database + * @param catalog a catalog name; must match the catalog name as it is stored in the database; + * @param schemaPattern a schema name pattern; + * + * @return array of procedures on current database. + + Array ( + [name_of_procedure] => Array + ( + [type] => PROCEDURE or FUNCTION + [catalog] => Catalog_name + [schema] => Schema_name + [remarks] => explanatory comment on the procedure + ) + ) + */ + function MetaProcedures($procedureNamePattern = null, $catalog = null, $schemaPattern = null) + { + return false; + } + /** * @param ttype can either be 'VIEW' or 'TABLE' or false. @@ -2448,7 +2502,11 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 if (is_string($d) && !is_numeric($d)) { - if ($d === 'null' || strncmp($d,"'",1) === 0) return $d; + if ($d === 'null') return $d; + if (strncmp($d,"'",1) === 0) { + $d = _adodb_safedateq($d); + return $d; + } if ($this->isoDates) return "'$d'"; $d = ADOConnection::UnixDate($d); } @@ -2491,8 +2549,10 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 return adodb_date($this->fmtTimeStamp,$ts); if ($ts === 'null') return $ts; - if ($this->isoDates && strlen($ts) !== 14) return "'$ts'"; - + if ($this->isoDates && strlen($ts) !== 14) { + $ts = _adodb_safedate($ts); + return "'$ts'"; + } $ts = ADOConnection::UnixTimeStamp($ts); return adodb_date($this->fmtTimeStamp,$ts); } diff --git a/lib/adodb/drivers/adodb-access.inc.php b/lib/adodb/drivers/adodb-access.inc.php index eea7ccf8902..f5685f347e5 100644 --- a/lib/adodb/drivers/adodb-access.inc.php +++ b/lib/adodb/drivers/adodb-access.inc.php @@ -1,6 +1,6 @@ fetchMode !== FALSE) { + $savem = $this->SetFetchMode(FALSE); + + } + $procedures = array (); + + // get index details + + $likepattern = ''; + if ($NamePattern) { + $likepattern = " WHERE procname LIKE '".$NamePattern."'"; + } + + $rs = $this->Execute('SELECT procname, isproc FROM sysprocedures'.$likepattern); + + if (is_object($rs)) { + // parse index data into array + + while ($row = $rs->FetchRow()) { + $procedures[$row[0]] = array( + 'type' => ($row[1] == 'f' ? 'FUNCTION' : 'PROCEDURE'), + 'catalog' => '', + 'schema' => '', + 'remarks' => '' + ); + } + } + + // restore fetchmode + if (isset($savem)) { + $this->SetFetchMode($savem); + } + $ADODB_FETCH_MODE = $save; + + return $procedures; + } function MetaColumns($table, $normalize=true) { diff --git a/lib/adodb/drivers/adodb-ldap.inc.php b/lib/adodb/drivers/adodb-ldap.inc.php index 16f38ad755f..2a1e478f385 100644 --- a/lib/adodb/drivers/adodb-ldap.inc.php +++ b/lib/adodb/drivers/adodb-ldap.inc.php @@ -1,6 +1,6 @@ _connectionID = @ldap_connect($host); } else { $conn_info = array( $host,$this->port); diff --git a/lib/adodb/drivers/adodb-mssql.inc.php b/lib/adodb/drivers/adodb-mssql.inc.php index a63b481958a..80742cd8b84 100644 --- a/lib/adodb/drivers/adodb-mssql.inc.php +++ b/lib/adodb/drivers/adodb-mssql.inc.php @@ -1,6 +1,6 @@ 'master'"; var $metaTablesSQL="select name,case when type='U' then 'T' else 'V' end from sysobjects where (type='U' or type='V') and (name not in ('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE','dtproperties'))"; var $metaColumnsSQL = # xtype==61 is datetime -"select c.name,t.name,c.length, - (case when c.xusertype=61 then 0 else c.xprec end), - (case when c.xusertype=61 then 0 else c.xscale end) + "select c.name,t.name,c.length,c.isnullable, c.status, + (case when c.xusertype=61 then 0 else c.xprec end), + (case when c.xusertype=61 then 0 else c.xscale end) from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='%s'"; var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE var $hasGenID = true; @@ -374,6 +374,64 @@ class ADODB_mssql extends ADOConnection { } + function MetaColumns($table, $normalize=true) + { +// $arr = ADOConnection::MetaColumns($table); +// return $arr; + + $this->_findschema($table,$schema); + if ($schema) { + $dbName = $this->database; + $this->SelectDB($schema); + } + global $ADODB_FETCH_MODE; + $save = $ADODB_FETCH_MODE; + $ADODB_FETCH_MODE = ADODB_FETCH_NUM; + + if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false); + $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table)); + + if ($schema) { + $this->SelectDB($dbName); + } + + if (isset($savem)) $this->SetFetchMode($savem); + $ADODB_FETCH_MODE = $save; + if (!is_object($rs)) { + $false = false; + return $false; + } + + $retarr = array(); + while (!$rs->EOF){ + $fld = new ADOFieldObject(); + $fld->name = $rs->fields[0]; + $fld->type = $rs->fields[1]; + + $fld->not_null = (!$rs->fields[3]); + $fld->auto_increment = ($rs->fields[4] == 128); // sys.syscolumns status field. 0x80 = 128 ref: http://msdn.microsoft.com/en-us/library/ms186816.aspx + + if (isset($rs->fields[5]) && $rs->fields[5]) { + if ($rs->fields[5]>0) $fld->max_length = $rs->fields[5]; + $fld->scale = $rs->fields[6]; + if ($fld->scale>0) $fld->max_length += 1; + } else + $fld->max_length = $rs->fields[2]; + + if ($save == ADODB_FETCH_NUM) { + $retarr[] = $fld; + } else { + $retarr[strtoupper($fld->name)] = $fld; + } + $rs->MoveNext(); + } + + $rs->Close(); + return $retarr; + + } + + function MetaIndexes($table,$primary=false, $owner=false) { $table = $this->qstr($table); diff --git a/lib/adodb/drivers/adodb-mssql_n.inc.php b/lib/adodb/drivers/adodb-mssql_n.inc.php index 740645e600a..dd66255d451 100644 --- a/lib/adodb/drivers/adodb-mssql_n.inc.php +++ b/lib/adodb/drivers/adodb-mssql_n.inc.php @@ -9,7 +9,7 @@ // ADOdb - Database Abstraction Library for PHP // // http://adodb.sourceforge.net/ // // // -// Copyright (c) 2000-2011 John Lim (jlim\@natsoft.com.my) // +// Copyright (c) 2000-2012 John Lim (jlim\@natsoft.com.my) // // All rights reserved. // // Released under both BSD license and LGPL library license. // // Whenever there is any discrepancy between the two licenses, // diff --git a/lib/adodb/drivers/adodb-mssqlnative.inc.php b/lib/adodb/drivers/adodb-mssqlnative.inc.php index 157ea02467f..24e33d2c90f 100644 --- a/lib/adodb/drivers/adodb-mssqlnative.inc.php +++ b/lib/adodb/drivers/adodb-mssqlnative.inc.php @@ -1,6 +1,6 @@ // tested with MSSQL 2000 - function &MetaPrimaryKeys($table) + function MetaPrimaryKeys($table, $owner=false) { global $ADODB_FETCH_MODE; @@ -699,7 +699,7 @@ class ADORecordset_mssqlnative extends ADORecordSet { { if ($this->connection->debug) error_log("".print_r($this->fields,true)."backtrace: ".adodb_backtrace(false)); if ($fieldOffset != -1) $this->fieldOffset = $fieldOffset; - $arrKeys = array_keys($this->fields); + /*$arrKeys = array_keys($this->fields); if(array_key_exists($this->fieldOffset,$arrKeys) && !array_key_exists($arrKeys[$this->fieldOffset],$this->fields)) { $f = false; } else { @@ -710,7 +710,13 @@ class ADORecordset_mssqlnative extends ADORecordSet { if (empty($f)) { $f = false;//PHP Notice: Only variable references should be returned by reference - } + }*/ + $fieldMeta = @sqlsrv_field_metadata($this->_queryID); + $f = new ADOFieldObject(); + $f->name = $fieldMeta[$this->fieldOffset]['Name']; + $f->type = $fieldMeta[$this->fieldOffset]['Type']; + $f->max_length = $fieldMeta[$this->fieldOffset]['Size']; + return $f; } @@ -751,13 +757,15 @@ class ADORecordset_mssqlnative extends ADORecordSet { $this->fields = @sqlsrv_fetch_array($this->_queryID,SQLSRV_FETCH_ASSOC); } - if (ADODB_ASSOC_CASE == 0) { - foreach($this->fields as $k=>$v) { - $this->fields[strtolower($k)] = $v; - } - } else if (ADODB_ASSOC_CASE == 1) { - foreach($this->fields as $k=>$v) { - $this->fields[strtoupper($k)] = $v; + if (is_array($this->fields)) { + if (ADODB_ASSOC_CASE == 0) { + foreach($this->fields as $k=>$v) { + $this->fields[strtolower($k)] = $v; + } + } else if (ADODB_ASSOC_CASE == 1) { + foreach($this->fields as $k=>$v) { + $this->fields[strtoupper($k)] = $v; + } } } } else { @@ -845,7 +853,7 @@ class ADORecordSet_array_mssqlnative extends ADORecordSet_array { $themth = $ADODB_mssql_mths[$themth]; if ($themth <= 0) return false; // h-m-s-MM-DD-YY - return mktime(0,0,0,$themth,$theday,$rr[3]); + return adodb_mktime(0,0,0,$themth,$theday,$rr[3]); } static function UnixTimeStamp($v) @@ -886,7 +894,7 @@ class ADORecordSet_array_mssqlnative extends ADORecordSet_array { break; } // h-m-s-MM-DD-YY - return mktime($rr[4],$rr[5],0,$themth,$theday,$rr[3]); + return adodb_mktime($rr[4],$rr[5],0,$themth,$theday,$rr[3]); } } diff --git a/lib/adodb/drivers/adodb-mssqlpo.inc.php b/lib/adodb/drivers/adodb-mssqlpo.inc.php index 0a0ea57dedb..76dfe245a21 100644 --- a/lib/adodb/drivers/adodb-mssqlpo.inc.php +++ b/lib/adodb/drivers/adodb-mssqlpo.inc.php @@ -1,6 +1,6 @@ fetchMode !== FALSE) { + $savem = $this->SetFetchMode(FALSE); + } + + $procedures = array (); + + // get index details + + $likepattern = ''; + if ($NamePattern) { + $likepattern = " LIKE '".$NamePattern."'"; + } + $rs = $this->Execute('SHOW PROCEDURE STATUS'.$likepattern); + if (is_object($rs)) { + + // parse index data into array + while ($row = $rs->FetchRow()) { + $procedures[$row[1]] = array( + 'type' => 'PROCEDURE', + 'catalog' => '', + + 'schema' => '', + 'remarks' => $row[7], + ); + } + } + + $rs = $this->Execute('SHOW FUNCTION STATUS'.$likepattern); + if (is_object($rs)) { + // parse index data into array + while ($row = $rs->FetchRow()) { + $procedures[$row[1]] = array( + 'type' => 'FUNCTION', + 'catalog' => '', + 'schema' => '', + 'remarks' => $row[7] + ); + } + } + + // restore fetchmode + if (isset($savem)) { + $this->SetFetchMode($savem); + + } + $ADODB_FETCH_MODE = $save; + + + return $procedures; + } function MetaTables($ttype=false,$showSchema=false,$mask=false) { diff --git a/lib/adodb/drivers/adodb-mysqli.inc.php b/lib/adodb/drivers/adodb-mysqli.inc.php index 4ba3f10ab08..b1d5d4d35d8 100644 --- a/lib/adodb/drivers/adodb-mysqli.inc.php +++ b/lib/adodb/drivers/adodb-mysqli.inc.php @@ -1,6 +1,6 @@ fetchMode !== FALSE) { + $savem = $this->SetFetchMode(FALSE); + } + + $procedures = array (); + + // get index details + + $likepattern = ''; + if ($NamePattern) { + $likepattern = " LIKE '".$NamePattern."'"; + } + $rs = $this->Execute('SHOW PROCEDURE STATUS'.$likepattern); + if (is_object($rs)) { + + // parse index data into array + while ($row = $rs->FetchRow()) { + $procedures[$row[1]] = array( + 'type' => 'PROCEDURE', + 'catalog' => '', + + 'schema' => '', + 'remarks' => $row[7], + ); + } + } + + $rs = $this->Execute('SHOW FUNCTION STATUS'.$likepattern); + if (is_object($rs)) { + // parse index data into array + while ($row = $rs->FetchRow()) { + $procedures[$row[1]] = array( + 'type' => 'FUNCTION', + 'catalog' => '', + 'schema' => '', + 'remarks' => $row[7] + ); + } + } + + // restore fetchmode + if (isset($savem)) { + $this->SetFetchMode($savem); + + } + $ADODB_FETCH_MODE = $save; + + + return $procedures; + } + function MetaTables($ttype=false,$showSchema=false,$mask=false) { $save = $this->metaTablesSQL; @@ -965,16 +1025,10 @@ class ADORecordSet_mysqli extends ADORecordSet{ //if results are attached to this pointer from Stored Proceedure calls, the next standard query will die 2014 //only a problem with persistant connections - //mysqli_next_result($this->connection->_connectionID); trashes the DB side attached results. - while(mysqli_more_results($this->connection->_connectionID)){ @mysqli_next_result($this->connection->_connectionID); } - //Because you can have one attached result, without tripping mysqli_more_results - @mysqli_next_result($this->connection->_connectionID); - - mysqli_free_result($this->_queryID); $this->_queryID = false; } diff --git a/lib/adodb/drivers/adodb-mysqlpo.inc.php b/lib/adodb/drivers/adodb-mysqlpo.inc.php index 5327834b390..55176560984 100644 --- a/lib/adodb/drivers/adodb-mysqlpo.inc.php +++ b/lib/adodb/drivers/adodb-mysqlpo.inc.php @@ -1,7 +1,7 @@ dateformat."')"; + + if ($isfld) { + $d = _adodb_safedate($d); + return 'TO_DATE('.$d.",'".$this->dateformat."')"; + } if (is_string($d)) $d = ADORecordSet::UnixDate($d); @@ -1011,7 +1015,7 @@ NATSOFT.DOMAIN = return $rez; } - function Param($name,$type=false) + function Param($name,$type='C') { return ':'.$name; } diff --git a/lib/adodb/drivers/adodb-oci805.inc.php b/lib/adodb/drivers/adodb-oci805.inc.php index d0172572583..d8a5589db66 100644 --- a/lib/adodb/drivers/adodb-oci805.inc.php +++ b/lib/adodb/drivers/adodb-oci805.inc.php @@ -1,6 +1,6 @@ 'master'"; var $metaTablesSQL="select name,case when type='U' then 'T' else 'V' end from sysobjects where (type='U' or type='V') and (name not in ('sysallocations','syscolumns','syscomments','sysdepends','sysfilegroups','sysfiles','sysfiles1','sysforeignkeys','sysfulltextcatalogs','sysindexes','sysindexkeys','sysmembers','sysobjects','syspermissions','sysprotects','sysreferences','systypes','sysusers','sysalternates','sysconstraints','syssegments','REFERENTIAL_CONSTRAINTS','CHECK_CONSTRAINTS','CONSTRAINT_TABLE_USAGE','CONSTRAINT_COLUMN_USAGE','VIEWS','VIEW_TABLE_USAGE','VIEW_COLUMN_USAGE','SCHEMATA','TABLES','TABLE_CONSTRAINTS','TABLE_PRIVILEGES','COLUMNS','COLUMN_DOMAIN_USAGE','COLUMN_PRIVILEGES','DOMAINS','DOMAIN_CONSTRAINTS','KEY_COLUMN_USAGE'))"; - var $metaColumnsSQL = "select c.name,t.name,c.length from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='%s'"; + var $metaColumnsSQL = # xtype==61 is datetime + "select c.name,t.name,c.length,c.isnullable, c.status, + (case when c.xusertype=61 then 0 else c.xprec end), + (case when c.xusertype=61 then 0 else c.xscale end) + from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='%s'"; var $hasTop = 'top'; // support mssql/interbase SELECT TOP 10 * FROM TABLE var $sysDate = 'GetDate()'; var $sysTimeStamp = 'GetDate()'; @@ -133,8 +137,59 @@ order by constraint_name, referenced_table_name, keyno"; function MetaColumns($table, $normalize=true) { - $arr = ADOConnection::MetaColumns($table); - return $arr; + + $this->_findschema($table,$schema); + if ($schema) { + $dbName = $this->database; + $this->SelectDB($schema); + } + global $ADODB_FETCH_MODE; + $save = $ADODB_FETCH_MODE; + $ADODB_FETCH_MODE = ADODB_FETCH_NUM; + + if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false); + $rs = $this->Execute(sprintf($this->metaColumnsSQL,$table)); + + if ($schema) { + $this->SelectDB($dbName); + } + + if (isset($savem)) $this->SetFetchMode($savem); + $ADODB_FETCH_MODE = $save; + if (!is_object($rs)) { + $false = false; + return $false; + } + + $retarr = array(); + while (!$rs->EOF){ + $fld = new ADOFieldObject(); + $fld->name = $rs->fields[0]; + $fld->type = $rs->fields[1]; + + $fld->not_null = (!$rs->fields[3]); + $fld->auto_increment = ($rs->fields[4] == 128); // sys.syscolumns status field. 0x80 = 128 ref: http://msdn.microsoft.com/en-us/library/ms186816.aspx + + + if (isset($rs->fields[5]) && $rs->fields[5]) { + if ($rs->fields[5]>0) $fld->max_length = $rs->fields[5]; + $fld->scale = $rs->fields[6]; + if ($fld->scale>0) $fld->max_length += 1; + } else + $fld->max_length = $rs->fields[2]; + + + if ($save == ADODB_FETCH_NUM) { + $retarr[] = $fld; + } else { + $retarr[strtoupper($fld->name)] = $fld; + } + $rs->MoveNext(); + } + + $rs->Close(); + return $retarr; + } diff --git a/lib/adodb/drivers/adodb-odbc_oracle.inc.php b/lib/adodb/drivers/adodb-odbc_oracle.inc.php index a00fab219ba..a49fcd2c53b 100644 --- a/lib/adodb/drivers/adodb-odbc_oracle.inc.php +++ b/lib/adodb/drivers/adodb-odbc_oracle.inc.php @@ -1,6 +1,6 @@ _pnum += 1; return '$'.$this->_pnum; diff --git a/lib/adodb/drivers/adodb-postgres7.inc.php b/lib/adodb/drivers/adodb-postgres7.inc.php index 36d7a2f3337..30a241f92e4 100644 --- a/lib/adodb/drivers/adodb-postgres7.inc.php +++ b/lib/adodb/drivers/adodb-postgres7.inc.php @@ -1,6 +1,6 @@ 0 AND + a.attrelid = c.oid + ORDER BY a.attnum"; + + // used when schema defined + var $metaColumnsSQL1 = " + SELECT a.attname, + CASE + WHEN x.sequence_name != '' THEN 'SERIAL' + ELSE t.typname + END AS typname, + a.attlen, a.atttypmod, a.attnotnull, a.atthasdef, a.attnum + FROM pg_class c, pg_namespace n, pg_attribute a + JOIN pg_type t ON a.atttypid = t.oid + LEFT JOIN + (SELECT c.relname as sequence_name, + c1.relname as related_table, + a.attname as related_column + FROM pg_class c + JOIN pg_depend d ON d.objid = c.oid + LEFT JOIN pg_class c1 ON d.refobjid = c1.oid + LEFT JOIN pg_attribute a ON (d.refobjid, d.refobjsubid) = (a.attrelid, a.attnum) + WHERE c.relkind = 'S' AND c1.relname = '%s') x + ON x.related_column= a.attname + WHERE c.relkind in ('r','v') AND (c.relname='%s' or c.relname = lower('%s')) + AND c.relnamespace=n.oid and n.nspname='%s' + AND a.attname not like '....%%' AND a.attnum > 0 + AND a.atttypid = t.oid AND a.attrelid = c.oid + ORDER BY a.attnum"; + function ADODB_postgres7() { diff --git a/lib/adodb/drivers/adodb-postgres8.inc.php b/lib/adodb/drivers/adodb-postgres8.inc.php index 14e6e703c24..c569a1403dd 100644 --- a/lib/adodb/drivers/adodb-postgres8.inc.php +++ b/lib/adodb/drivers/adodb-postgres8.inc.php @@ -1,6 +1,6 @@ diff --git a/lib/adodb/drivers/adodb-sybase_ase.inc.php b/lib/adodb/drivers/adodb-sybase_ase.inc.php index 384ace56047..862af8d6c35 100644 --- a/lib/adodb/drivers/adodb-sybase_ase.inc.php +++ b/lib/adodb/drivers/adodb-sybase_ase.inc.php @@ -1,6 +1,6 @@ 'cn', - DB_ERROR => 'δ֪����', - DB_ERROR_ALREADY_EXISTS => '�Ѿ�����', - DB_ERROR_CANNOT_CREATE => '���ܴ���', - DB_ERROR_CANNOT_DELETE => '����ɾ��', - DB_ERROR_CANNOT_DROP => '���ܶ���', - DB_ERROR_CONSTRAINT => 'Լ������', - DB_ERROR_DIVZERO => '��0��', - DB_ERROR_INVALID => '��Ч', - DB_ERROR_INVALID_DATE => '��Ч�����ڻ���ʱ��', - DB_ERROR_INVALID_NUMBER => '��������', - DB_ERROR_MISMATCH => '��ƥ��', - DB_ERROR_NODBSELECTED => 'û����ݿⱻѡ��', - DB_ERROR_NOSUCHFIELD => 'û����Ӧ���ֶ�', - DB_ERROR_NOSUCHTABLE => 'û����Ӧ�ı�', - DB_ERROR_NOT_CAPABLE => '��ݿ��̨������', - DB_ERROR_NOT_FOUND => 'û�з���', - DB_ERROR_NOT_LOCKED => 'û�б���', - DB_ERROR_SYNTAX => '�﷨����', - DB_ERROR_UNSUPPORTED => '��֧��', - DB_ERROR_VALUE_COUNT_ON_ROW => '�������ۼ�ֵ', - DB_ERROR_INVALID_DSN => '��Ч�����Դ (DSN)', - DB_ERROR_CONNECT_FAILED => '����ʧ��', - 0 => 'û�д���', // DB_OK - DB_ERROR_NEED_MORE_DATA => '�ṩ����ݲ��ܷ��Ҫ��', - DB_ERROR_EXTENSION_NOT_FOUND=> '��չû�б�����', - DB_ERROR_NOSUCHDB => 'û����Ӧ����ݿ�', - DB_ERROR_ACCESS_VIOLATION => 'û�к��ʵ�Ȩ��' -); + 'cn', + DB_ERROR => 'δ֪´íÎó', + DB_ERROR_ALREADY_EXISTS => 'ÒѾ´æÔÚ', + DB_ERROR_CANNOT_CREATE => '²»ÄÜ´´½¨', + DB_ERROR_CANNOT_DELETE => '²»ÄÜɾ³ý', + DB_ERROR_CANNOT_DROP => '²»ÄܶªÆú', + DB_ERROR_CONSTRAINT => 'Ô¼ÊøÏÞÖÆ', + DB_ERROR_DIVZERO => '±»0³ý', + DB_ERROR_INVALID => 'ÎÞЧ', + DB_ERROR_INVALID_DATE => 'ÎÞЧµÄÈÕÆÚ»òÕßʱ¼ä', + DB_ERROR_INVALID_NUMBER => 'ÎÞЧµÄÊý×Ö', + DB_ERROR_MISMATCH => '²»Æ¥Åä', + DB_ERROR_NODBSELECTED => 'ûÓÐÊý¾Ý¿â±»Ñ¡Ôñ', + DB_ERROR_NOSUCHFIELD => 'ûÓÐÏàÓ¦µÄ×Ö¶Î', + DB_ERROR_NOSUCHTABLE => 'ûÓÐÏàÓ¦µÄ±í', + DB_ERROR_NOT_CAPABLE => 'Êý¾Ý¿âºǫ́²»¼æÈÝ', + DB_ERROR_NOT_FOUND => 'ûÓз¢ÏÖ', + DB_ERROR_NOT_LOCKED => 'ûÓб»Ëø¶¨', + DB_ERROR_SYNTAX => 'Óï·¨´íÎó', + DB_ERROR_UNSUPPORTED => '²»Ö§³Ö', + DB_ERROR_VALUE_COUNT_ON_ROW => 'ÔÚÐÐÉÏÀÛ¼ÆÖµ', + DB_ERROR_INVALID_DSN => 'ÎÞЧµÄÊý¾ÝÔ´ (DSN)', + DB_ERROR_CONNECT_FAILED => 'Á¬½Óʧ°Ü', + 0 => 'ûÓдíÎó', // DB_OK + DB_ERROR_NEED_MORE_DATA => 'ÌṩµÄÊý¾Ý²»ÄÜ·ûºÏÒªÇó', + DB_ERROR_EXTENSION_NOT_FOUND=> 'À©Õ¹Ã»Óб»·¢ÏÖ', + DB_ERROR_NOSUCHDB => 'ûÓÐÏàÓ¦µÄÊý¾Ý¿â', + DB_ERROR_ACCESS_VIOLATION => 'ûÓкÏÊʵÄȨÏÞ' +); ?> \ No newline at end of file diff --git a/lib/adodb/lang/adodb-cz.inc.php b/lib/adodb/lang/adodb-cz.inc.php index e16a22d5a74..2424c2446b8 100644 --- a/lib/adodb/lang/adodb-cz.inc.php +++ b/lib/adodb/lang/adodb-cz.inc.php @@ -1,40 +1,40 @@ - - -$ADODB_LANG_ARRAY = array ( - 'LANG' => 'cz', - DB_ERROR => 'nezn�m� chyba', - DB_ERROR_ALREADY_EXISTS => 'ji? existuje', - DB_ERROR_CANNOT_CREATE => 'nelze vytvo?it', - DB_ERROR_CANNOT_DELETE => 'nelze smazat', - DB_ERROR_CANNOT_DROP => 'nelze odstranit', - DB_ERROR_CONSTRAINT => 'poru?en� omezuj�c� podm�nky', - DB_ERROR_DIVZERO => 'd?len� nulou', - DB_ERROR_INVALID => 'neplatn�', - DB_ERROR_INVALID_DATE => 'neplatn� datum nebo ?as', - DB_ERROR_INVALID_NUMBER => 'neplatn� ?�slo', - DB_ERROR_MISMATCH => 'nesouhlas�', - DB_ERROR_NODBSELECTED => '?�dn� datab�ze nen� vybr�na', - DB_ERROR_NOSUCHFIELD => 'pole nenalezeno', - DB_ERROR_NOSUCHTABLE => 'tabulka nenalezena', - DB_ERROR_NOT_CAPABLE => 'nepodporov�no', - DB_ERROR_NOT_FOUND => 'nenalezeno', - DB_ERROR_NOT_LOCKED => 'nezam?eno', - DB_ERROR_SYNTAX => 'syntaktick� chyba', - DB_ERROR_UNSUPPORTED => 'nepodporov�no', - DB_ERROR_VALUE_COUNT_ON_ROW => '', - DB_ERROR_INVALID_DSN => 'neplatn� DSN', - DB_ERROR_CONNECT_FAILED => 'p?ipojen� selhalo', - 0 => 'bez chyb', // DB_OK - DB_ERROR_NEED_MORE_DATA => 'm�lo zdrojov�ch dat', - DB_ERROR_EXTENSION_NOT_FOUND=> 'roz?�?en� nenalezeno', - DB_ERROR_NOSUCHDB => 'datab�ze neexistuje', - DB_ERROR_ACCESS_VIOLATION => 'nedostate?n� pr�va' -); + + +$ADODB_LANG_ARRAY = array ( + 'LANG' => 'cz', + DB_ERROR => 'neznámá chyba', + DB_ERROR_ALREADY_EXISTS => 'ji? existuje', + DB_ERROR_CANNOT_CREATE => 'nelze vytvo?it', + DB_ERROR_CANNOT_DELETE => 'nelze smazat', + DB_ERROR_CANNOT_DROP => 'nelze odstranit', + DB_ERROR_CONSTRAINT => 'poru?ení omezující podmínky', + DB_ERROR_DIVZERO => 'd?lení nulou', + DB_ERROR_INVALID => 'neplatné', + DB_ERROR_INVALID_DATE => 'neplatné datum nebo ?as', + DB_ERROR_INVALID_NUMBER => 'neplatné ?íslo', + DB_ERROR_MISMATCH => 'nesouhlasí', + DB_ERROR_NODBSELECTED => '?ádná databáze není vybrána', + DB_ERROR_NOSUCHFIELD => 'pole nenalezeno', + DB_ERROR_NOSUCHTABLE => 'tabulka nenalezena', + DB_ERROR_NOT_CAPABLE => 'nepodporováno', + DB_ERROR_NOT_FOUND => 'nenalezeno', + DB_ERROR_NOT_LOCKED => 'nezam?eno', + DB_ERROR_SYNTAX => 'syntaktická chyba', + DB_ERROR_UNSUPPORTED => 'nepodporováno', + DB_ERROR_VALUE_COUNT_ON_ROW => '', + DB_ERROR_INVALID_DSN => 'neplatné DSN', + DB_ERROR_CONNECT_FAILED => 'p?ipojení selhalo', + 0 => 'bez chyb', // DB_OK + DB_ERROR_NEED_MORE_DATA => 'málo zdrojových dat', + DB_ERROR_EXTENSION_NOT_FOUND=> 'roz?í?ení nenalezeno', + DB_ERROR_NOSUCHDB => 'databáze neexistuje', + DB_ERROR_ACCESS_VIOLATION => 'nedostate?ná práva' +); ?> \ No newline at end of file diff --git a/lib/adodb/lang/adodb-de.inc.php b/lib/adodb/lang/adodb-de.inc.php index 44c57e9ff3e..244cb2f66ae 100644 --- a/lib/adodb/lang/adodb-de.inc.php +++ b/lib/adodb/lang/adodb-de.inc.php @@ -1,33 +1,33 @@ - -$ADODB_LANG_ARRAY = array ( - 'LANG' => 'de', - DB_ERROR => 'Unbekannter Fehler', - DB_ERROR_ALREADY_EXISTS => 'existiert bereits', - DB_ERROR_CANNOT_CREATE => 'kann nicht erstellen', - DB_ERROR_CANNOT_DELETE => 'kann nicht löschen', - DB_ERROR_CANNOT_DROP => 'Tabelle oder Index konnte nicht gelöscht werden', - DB_ERROR_CONSTRAINT => 'Constraint Verletzung', - DB_ERROR_DIVZERO => 'Division durch Null', - DB_ERROR_INVALID => 'ung¨ltig', - DB_ERROR_INVALID_DATE => 'ung¨ltiges Datum oder Zeit', - DB_ERROR_INVALID_NUMBER => 'ung¨ltige Zahl', - DB_ERROR_MISMATCH => 'Unverträglichkeit', - DB_ERROR_NODBSELECTED => 'keine Dantebank ausgewählt', - DB_ERROR_NOSUCHFIELD => 'Feld nicht vorhanden', - DB_ERROR_NOSUCHTABLE => 'Tabelle nicht vorhanden', - DB_ERROR_NOT_CAPABLE => 'Funktion nicht installiert', - DB_ERROR_NOT_FOUND => 'nicht gefunden', - DB_ERROR_NOT_LOCKED => 'nicht gesperrt', - DB_ERROR_SYNTAX => 'Syntaxfehler', - DB_ERROR_UNSUPPORTED => 'nicht Unterst¨tzt', - DB_ERROR_VALUE_COUNT_ON_ROW => 'Anzahl der zur¨ckgelieferten Felder entspricht nicht der Anzahl der Felder in der Abfrage', - DB_ERROR_INVALID_DSN => 'ung¨ltiger DSN', - DB_ERROR_CONNECT_FAILED => 'Verbindung konnte nicht hergestellt werden', - 0 => 'kein Fehler', // DB_OK - DB_ERROR_NEED_MORE_DATA => 'Nicht gen¨gend Daten geliefert', - DB_ERROR_EXTENSION_NOT_FOUND=> 'erweiterung nicht gefunden', - DB_ERROR_NOSUCHDB => 'keine Datenbank', - DB_ERROR_ACCESS_VIOLATION => 'ungen¨gende Rechte' -); + +$ADODB_LANG_ARRAY = array ( + 'LANG' => 'de', + DB_ERROR => 'Unbekannter Fehler', + DB_ERROR_ALREADY_EXISTS => 'existiert bereits', + DB_ERROR_CANNOT_CREATE => 'kann nicht erstellen', + DB_ERROR_CANNOT_DELETE => 'kann nicht löschen', + DB_ERROR_CANNOT_DROP => 'Tabelle oder Index konnte nicht gelöscht werden', + DB_ERROR_CONSTRAINT => 'Constraint Verletzung', + DB_ERROR_DIVZERO => 'Division durch Null', + DB_ERROR_INVALID => 'ung¨ltig', + DB_ERROR_INVALID_DATE => 'ung¨ltiges Datum oder Zeit', + DB_ERROR_INVALID_NUMBER => 'ung¨ltige Zahl', + DB_ERROR_MISMATCH => 'Unverträglichkeit', + DB_ERROR_NODBSELECTED => 'keine Dantebank ausgewählt', + DB_ERROR_NOSUCHFIELD => 'Feld nicht vorhanden', + DB_ERROR_NOSUCHTABLE => 'Tabelle nicht vorhanden', + DB_ERROR_NOT_CAPABLE => 'Funktion nicht installiert', + DB_ERROR_NOT_FOUND => 'nicht gefunden', + DB_ERROR_NOT_LOCKED => 'nicht gesperrt', + DB_ERROR_SYNTAX => 'Syntaxfehler', + DB_ERROR_UNSUPPORTED => 'nicht Unterst¨tzt', + DB_ERROR_VALUE_COUNT_ON_ROW => 'Anzahl der zur¨ckgelieferten Felder entspricht nicht der Anzahl der Felder in der Abfrage', + DB_ERROR_INVALID_DSN => 'ung¨ltiger DSN', + DB_ERROR_CONNECT_FAILED => 'Verbindung konnte nicht hergestellt werden', + 0 => 'kein Fehler', // DB_OK + DB_ERROR_NEED_MORE_DATA => 'Nicht gen¨gend Daten geliefert', + DB_ERROR_EXTENSION_NOT_FOUND=> 'erweiterung nicht gefunden', + DB_ERROR_NOSUCHDB => 'keine Datenbank', + DB_ERROR_ACCESS_VIOLATION => 'ungen¨gende Rechte' +); ?> \ No newline at end of file diff --git a/lib/adodb/lang/adodb-fa.inc.php b/lib/adodb/lang/adodb-fa.inc.php index a58a21cc6ce..5594313575e 100644 --- a/lib/adodb/lang/adodb-fa.inc.php +++ b/lib/adodb/lang/adodb-fa.inc.php @@ -1,35 +1,35 @@ - */ - -$ADODB_LANG_ARRAY = array ( - 'LANG' => 'fa', - DB_ERROR => 'خطای ناشناخته', - DB_ERROR_ALREADY_EXISTS => 'وجود دارد', - DB_ERROR_CANNOT_CREATE => 'امکان create وجود ندارد', - DB_ERROR_CANNOT_DELETE => 'امکان ØØ°Ù� وجود ندارد', - DB_ERROR_CANNOT_DROP => 'امکان drop وجود ندارد', - DB_ERROR_CONSTRAINT => 'نقض شرط', - DB_ERROR_DIVZERO => 'تقسیم بر صÙ�ر', - DB_ERROR_INVALID => 'نامعتبر', - DB_ERROR_INVALID_DATE => 'زمان یا تاریخ نامعتبر', - DB_ERROR_INVALID_NUMBER => 'عدد نامعتبر', - DB_ERROR_MISMATCH => 'عدم مطابقت', - DB_ERROR_NODBSELECTED => 'بانک اطلاعاتی انتخاب نشده است', - DB_ERROR_NOSUCHFIELD => 'چنین ستونی وجود ندارد', - DB_ERROR_NOSUCHTABLE => 'چنین جدولی وجود ندارد', - DB_ERROR_NOT_CAPABLE => 'backend بانک اطلاعاتی قادر نیست', - DB_ERROR_NOT_FOUND => 'پیدا نشد', - DB_ERROR_NOT_LOCKED => 'Ù‚Ù�Ù„ نشده', - DB_ERROR_SYNTAX => 'خطای دستوری', - DB_ERROR_UNSUPPORTED => 'پشتیبانی نمی شود', - DB_ERROR_VALUE_COUNT_ON_ROW => 'شمارش مقادیر روی ردیÙ�', - DB_ERROR_INVALID_DSN => 'DSN نامعتبر', - DB_ERROR_CONNECT_FAILED => 'ارتباط برقرار نشد', - 0 => 'بدون خطا', // DB_OK - DB_ERROR_NEED_MORE_DATA => 'داده ناکاÙ�ÛŒ است', - DB_ERROR_EXTENSION_NOT_FOUND=> 'extension پیدا نشد', - DB_ERROR_NOSUCHDB => 'چنین بانک اطلاعاتی وجود ندارد', - DB_ERROR_ACCESS_VIOLATION => 'ØÙ‚ دسترسی ناکاÙ�ÛŒ' -); + */ + +$ADODB_LANG_ARRAY = array ( + 'LANG' => 'fa', + DB_ERROR => 'خطای ناشناخته', + DB_ERROR_ALREADY_EXISTS => 'وجود دارد', + DB_ERROR_CANNOT_CREATE => 'امکان create وجود ندارد', + DB_ERROR_CANNOT_DELETE => 'امکان ØØ°Ù� وجود ندارد', + DB_ERROR_CANNOT_DROP => 'امکان drop وجود ندارد', + DB_ERROR_CONSTRAINT => 'نقض شرط', + DB_ERROR_DIVZERO => 'تقسیم بر صÙ�ر', + DB_ERROR_INVALID => 'نامعتبر', + DB_ERROR_INVALID_DATE => 'زمان یا تاریخ نامعتبر', + DB_ERROR_INVALID_NUMBER => 'عدد نامعتبر', + DB_ERROR_MISMATCH => 'عدم مطابقت', + DB_ERROR_NODBSELECTED => 'بانک اطلاعاتی انتخاب نشده است', + DB_ERROR_NOSUCHFIELD => 'چنین ستونی وجود ندارد', + DB_ERROR_NOSUCHTABLE => 'چنین جدولی وجود ندارد', + DB_ERROR_NOT_CAPABLE => 'backend بانک اطلاعاتی قادر نیست', + DB_ERROR_NOT_FOUND => 'پیدا نشد', + DB_ERROR_NOT_LOCKED => 'Ù‚Ù�Ù„ نشده', + DB_ERROR_SYNTAX => 'خطای دستوری', + DB_ERROR_UNSUPPORTED => 'پشتیبانی نمی شود', + DB_ERROR_VALUE_COUNT_ON_ROW => 'شمارش مقادیر روی ردیÙ�', + DB_ERROR_INVALID_DSN => 'DSN نامعتبر', + DB_ERROR_CONNECT_FAILED => 'ارتباط برقرار نشد', + 0 => 'بدون خطا', // DB_OK + DB_ERROR_NEED_MORE_DATA => 'داده ناکاÙ�ÛŒ است', + DB_ERROR_EXTENSION_NOT_FOUND=> 'extension پیدا نشد', + DB_ERROR_NOSUCHDB => 'چنین بانک اطلاعاتی وجود ندارد', + DB_ERROR_ACCESS_VIOLATION => 'ØÙ‚ دسترسی ناکاÙ�ÛŒ' +); ?> \ No newline at end of file diff --git a/lib/adodb/lang/adodb-fr.inc.php b/lib/adodb/lang/adodb-fr.inc.php index 11127cd60b6..066a2a5e5b7 100644 --- a/lib/adodb/lang/adodb-fr.inc.php +++ b/lib/adodb/lang/adodb-fr.inc.php @@ -1,33 +1,33 @@ - 'fr', - DB_ERROR => 'erreur inconnue', - DB_ERROR_ALREADY_EXISTS => 'existe déjà', - DB_ERROR_CANNOT_CREATE => 'crétion impossible', - DB_ERROR_CANNOT_DELETE => 'effacement impossible', - DB_ERROR_CANNOT_DROP => 'suppression impossible', - DB_ERROR_CONSTRAINT => 'violation de contrainte', - DB_ERROR_DIVZERO => 'division par zéro', - DB_ERROR_INVALID => 'invalide', - DB_ERROR_INVALID_DATE => 'date ou heure invalide', - DB_ERROR_INVALID_NUMBER => 'nombre invalide', - DB_ERROR_MISMATCH => 'erreur de concordance', - DB_ERROR_NODBSELECTED => 'pas de base de donnéessélectionnée', - DB_ERROR_NOSUCHFIELD => 'nom de colonne invalide', - DB_ERROR_NOSUCHTABLE => 'table ou vue inexistante', - DB_ERROR_NOT_CAPABLE => 'fonction optionnelle non installée', - DB_ERROR_NOT_FOUND => 'pas trouvé', - DB_ERROR_NOT_LOCKED => 'non verrouillé', - DB_ERROR_SYNTAX => 'erreur de syntaxe', - DB_ERROR_UNSUPPORTED => 'non supporté', - DB_ERROR_VALUE_COUNT_ON_ROW => 'valeur insérée trop grande pour colonne', - DB_ERROR_INVALID_DSN => 'DSN invalide', - DB_ERROR_CONNECT_FAILED => 'échec à la connexion', - 0 => "pas d'erreur", // DB_OK - DB_ERROR_NEED_MORE_DATA => 'données fournies insuffisantes', - DB_ERROR_EXTENSION_NOT_FOUND=> 'extension non trouvée', - DB_ERROR_NOSUCHDB => 'base de données inconnue', - DB_ERROR_ACCESS_VIOLATION => 'droits insuffisants' -); + 'fr', + DB_ERROR => 'erreur inconnue', + DB_ERROR_ALREADY_EXISTS => 'existe déjà', + DB_ERROR_CANNOT_CREATE => 'crétion impossible', + DB_ERROR_CANNOT_DELETE => 'effacement impossible', + DB_ERROR_CANNOT_DROP => 'suppression impossible', + DB_ERROR_CONSTRAINT => 'violation de contrainte', + DB_ERROR_DIVZERO => 'division par zéro', + DB_ERROR_INVALID => 'invalide', + DB_ERROR_INVALID_DATE => 'date ou heure invalide', + DB_ERROR_INVALID_NUMBER => 'nombre invalide', + DB_ERROR_MISMATCH => 'erreur de concordance', + DB_ERROR_NODBSELECTED => 'pas de base de donnéessélectionnée', + DB_ERROR_NOSUCHFIELD => 'nom de colonne invalide', + DB_ERROR_NOSUCHTABLE => 'table ou vue inexistante', + DB_ERROR_NOT_CAPABLE => 'fonction optionnelle non installée', + DB_ERROR_NOT_FOUND => 'pas trouvé', + DB_ERROR_NOT_LOCKED => 'non verrouillé', + DB_ERROR_SYNTAX => 'erreur de syntaxe', + DB_ERROR_UNSUPPORTED => 'non supporté', + DB_ERROR_VALUE_COUNT_ON_ROW => 'valeur insérée trop grande pour colonne', + DB_ERROR_INVALID_DSN => 'DSN invalide', + DB_ERROR_CONNECT_FAILED => 'échec à la connexion', + 0 => "pas d'erreur", // DB_OK + DB_ERROR_NEED_MORE_DATA => 'données fournies insuffisantes', + DB_ERROR_EXTENSION_NOT_FOUND=> 'extension non trouvée', + DB_ERROR_NOSUCHDB => 'base de données inconnue', + DB_ERROR_ACCESS_VIOLATION => 'droits insuffisants' +); ?> \ No newline at end of file diff --git a/lib/adodb/lang/adodb-it.inc.php b/lib/adodb/lang/adodb-it.inc.php index ac5cc5a7d96..20c5b93b630 100644 --- a/lib/adodb/lang/adodb-it.inc.php +++ b/lib/adodb/lang/adodb-it.inc.php @@ -1,34 +1,34 @@ - 'it', - DB_ERROR => 'errore sconosciuto', - DB_ERROR_ALREADY_EXISTS => 'esiste già', - DB_ERROR_CANNOT_CREATE => 'non posso creare', - DB_ERROR_CANNOT_DELETE => 'non posso cancellare', - DB_ERROR_CANNOT_DROP => 'non posso eliminare', - DB_ERROR_CONSTRAINT => 'violazione constraint', - DB_ERROR_DIVZERO => 'divisione per zero', - DB_ERROR_INVALID => 'non valido', - DB_ERROR_INVALID_DATE => 'data od ora non valida', - DB_ERROR_INVALID_NUMBER => 'numero non valido', - DB_ERROR_MISMATCH => 'diversi', - DB_ERROR_NODBSELECTED => 'nessun database selezionato', - DB_ERROR_NOSUCHFIELD => 'nessun campo trovato', - DB_ERROR_NOSUCHTABLE => 'nessuna tabella trovata', - DB_ERROR_NOT_CAPABLE => 'DB backend non abilitato', - DB_ERROR_NOT_FOUND => 'non trovato', - DB_ERROR_NOT_LOCKED => 'non bloccato', - DB_ERROR_SYNTAX => 'errore di sintassi', - DB_ERROR_UNSUPPORTED => 'non supportato', - DB_ERROR_VALUE_COUNT_ON_ROW => 'valore inserito troppo grande per una colonna', - DB_ERROR_INVALID_DSN => 'DSN non valido', - DB_ERROR_CONNECT_FAILED => 'connessione fallita', - 0 => 'nessun errore', // DB_OK - DB_ERROR_NEED_MORE_DATA => 'dati inseriti insufficienti', - DB_ERROR_EXTENSION_NOT_FOUND=> 'estensione non trovata', - DB_ERROR_NOSUCHDB => 'database non trovato', - DB_ERROR_ACCESS_VIOLATION => 'permessi insufficienti' -); + 'it', + DB_ERROR => 'errore sconosciuto', + DB_ERROR_ALREADY_EXISTS => 'esiste già', + DB_ERROR_CANNOT_CREATE => 'non posso creare', + DB_ERROR_CANNOT_DELETE => 'non posso cancellare', + DB_ERROR_CANNOT_DROP => 'non posso eliminare', + DB_ERROR_CONSTRAINT => 'violazione constraint', + DB_ERROR_DIVZERO => 'divisione per zero', + DB_ERROR_INVALID => 'non valido', + DB_ERROR_INVALID_DATE => 'data od ora non valida', + DB_ERROR_INVALID_NUMBER => 'numero non valido', + DB_ERROR_MISMATCH => 'diversi', + DB_ERROR_NODBSELECTED => 'nessun database selezionato', + DB_ERROR_NOSUCHFIELD => 'nessun campo trovato', + DB_ERROR_NOSUCHTABLE => 'nessuna tabella trovata', + DB_ERROR_NOT_CAPABLE => 'DB backend non abilitato', + DB_ERROR_NOT_FOUND => 'non trovato', + DB_ERROR_NOT_LOCKED => 'non bloccato', + DB_ERROR_SYNTAX => 'errore di sintassi', + DB_ERROR_UNSUPPORTED => 'non supportato', + DB_ERROR_VALUE_COUNT_ON_ROW => 'valore inserito troppo grande per una colonna', + DB_ERROR_INVALID_DSN => 'DSN non valido', + DB_ERROR_CONNECT_FAILED => 'connessione fallita', + 0 => 'nessun errore', // DB_OK + DB_ERROR_NEED_MORE_DATA => 'dati inseriti insufficienti', + DB_ERROR_EXTENSION_NOT_FOUND=> 'estensione non trovata', + DB_ERROR_NOSUCHDB => 'database non trovato', + DB_ERROR_ACCESS_VIOLATION => 'permessi insufficienti' +); ?> \ No newline at end of file diff --git a/lib/adodb/lang/adodb-ru1251.inc.php b/lib/adodb/lang/adodb-ru1251.inc.php index 1ccdde89f4c..3a20538a020 100644 --- a/lib/adodb/lang/adodb-ru1251.inc.php +++ b/lib/adodb/lang/adodb-ru1251.inc.php @@ -1,35 +1,35 @@ - 'ru1251', - DB_ERROR => '����������� ������', - DB_ERROR_ALREADY_EXISTS => '��� ����������', - DB_ERROR_CANNOT_CREATE => '���������� �������', - DB_ERROR_CANNOT_DELETE => '���������� �������', - DB_ERROR_CANNOT_DROP => '���������� ������� (drop)', - DB_ERROR_CONSTRAINT => '��������� ������� ��������', - DB_ERROR_DIVZERO => '������� �� 0', - DB_ERROR_INVALID => '�����������', - DB_ERROR_INVALID_DATE => '������������ ���� ��� �����', - DB_ERROR_INVALID_NUMBER => '������������ �����', - DB_ERROR_MISMATCH => '������', - DB_ERROR_NODBSELECTED => '�� �� �������', - DB_ERROR_NOSUCHFIELD => '�� ���������� ����', - DB_ERROR_NOSUCHTABLE => '�� ���������� �������', - DB_ERROR_NOT_CAPABLE => '���� �� � ���������', - DB_ERROR_NOT_FOUND => '�� �������', - DB_ERROR_NOT_LOCKED => '�� �������������', - DB_ERROR_SYNTAX => '�������������� ������', - DB_ERROR_UNSUPPORTED => '�� ��������������', - DB_ERROR_VALUE_COUNT_ON_ROW => '������� �������� � ������', - DB_ERROR_INVALID_DSN => '������������ DSN', - DB_ERROR_CONNECT_FAILED => '���������� ���������', - 0 => '��� ������', // DB_OK - DB_ERROR_NEED_MORE_DATA => '������������� ������������ ������', - DB_ERROR_EXTENSION_NOT_FOUND=> '���������� �� �������', - DB_ERROR_NOSUCHDB => '�� ���������� ��', - DB_ERROR_ACCESS_VIOLATION => '������������ ���� �������' -); + 'ru1251', + DB_ERROR => 'íåèçâåñòíàÿ îøèáêà', + DB_ERROR_ALREADY_EXISTS => 'óæå ñóùåñòâóåò', + DB_ERROR_CANNOT_CREATE => 'íåâîçìîæíî ñîçäàòü', + DB_ERROR_CANNOT_DELETE => 'íåâîçìîæíî óäàëèòü', + DB_ERROR_CANNOT_DROP => 'íåâîçìîæíî óäàëèòü (drop)', + DB_ERROR_CONSTRAINT => 'íàðóøåíèå óñëîâèé ïðîâåðêè', + DB_ERROR_DIVZERO => 'äåëåíèå íà 0', + DB_ERROR_INVALID => 'íåïðàâèëüíî', + DB_ERROR_INVALID_DATE => 'íåêîððåêòíàÿ äàòà èëè âðåìÿ', + DB_ERROR_INVALID_NUMBER => 'íåêîððåêòíîå ÷èñëî', + DB_ERROR_MISMATCH => 'îøèáêà', + DB_ERROR_NODBSELECTED => 'ÁÄ íå âûáðàíà', + DB_ERROR_NOSUCHFIELD => 'íå ñóùåñòâóåò ïîëå', + DB_ERROR_NOSUCHTABLE => 'íå ñóùåñòâóåò òàáëèöà', + DB_ERROR_NOT_CAPABLE => 'ÑÓÁÄ íå â ñîñòîÿíèè', + DB_ERROR_NOT_FOUND => 'íå íàéäåíî', + DB_ERROR_NOT_LOCKED => 'íå çàáëîêèðîâàíî', + DB_ERROR_SYNTAX => 'ñèíòàêñè÷åñêàÿ îøèáêà', + DB_ERROR_UNSUPPORTED => 'íå ïîääåðæèâàåòñÿ', + DB_ERROR_VALUE_COUNT_ON_ROW => 'ñ÷åò÷èê çíà÷åíèé â ñòðîêå', + DB_ERROR_INVALID_DSN => 'íåïðàâèëüíàÿ DSN', + DB_ERROR_CONNECT_FAILED => 'ñîåäèíåíèå íåóñïåøíî', + 0 => 'íåò îøèáêè', // DB_OK + DB_ERROR_NEED_MORE_DATA => 'ïðåäîñòàâëåíî íåäîñòàòî÷íî äàííûõ', + DB_ERROR_EXTENSION_NOT_FOUND=> 'ðàñøèðåíèå íå íàéäåíî', + DB_ERROR_NOSUCHDB => 'íå ñóùåñòâóåò ÁÄ', + DB_ERROR_ACCESS_VIOLATION => 'íåäîñòàòî÷íî ïðàâ äîñòóïà' +); ?> \ No newline at end of file diff --git a/lib/adodb/lang/adodb-sv.inc.php b/lib/adodb/lang/adodb-sv.inc.php index 268644afe6d..a9fd69816c4 100644 --- a/lib/adodb/lang/adodb-sv.inc.php +++ b/lib/adodb/lang/adodb-sv.inc.php @@ -1,33 +1,33 @@ - 'en', - DB_ERROR => 'Ok�nt fel', - DB_ERROR_ALREADY_EXISTS => 'finns redan', - DB_ERROR_CANNOT_CREATE => 'kan inte skapa', - DB_ERROR_CANNOT_DELETE => 'kan inte ta bort', - DB_ERROR_CANNOT_DROP => 'kan inte sl�ppa', - DB_ERROR_CONSTRAINT => 'begr�nsning kr�nkt', - DB_ERROR_DIVZERO => 'division med noll', - DB_ERROR_INVALID => 'ogiltig', - DB_ERROR_INVALID_DATE => 'ogiltigt datum eller tid', - DB_ERROR_INVALID_NUMBER => 'ogiltigt tal', - DB_ERROR_MISMATCH => 'felaktig matchning', - DB_ERROR_NODBSELECTED => 'ingen databas vald', - DB_ERROR_NOSUCHFIELD => 'inget s�dant f�lt', - DB_ERROR_NOSUCHTABLE => 'ingen s�dan tabell', - DB_ERROR_NOT_CAPABLE => 'DB backend klarar det inte', - DB_ERROR_NOT_FOUND => 'finns inte', - DB_ERROR_NOT_LOCKED => 'inte l�st', - DB_ERROR_SYNTAX => 'syntaxfel', - DB_ERROR_UNSUPPORTED => 'st�ds ej', - DB_ERROR_VALUE_COUNT_ON_ROW => 'v�rde r�knat p� rad', - DB_ERROR_INVALID_DSN => 'ogiltig DSN', - DB_ERROR_CONNECT_FAILED => 'anslutning misslyckades', - 0 => 'inget fel', // DB_OK - DB_ERROR_NEED_MORE_DATA => 'otillr�ckligt med data angivet', - DB_ERROR_EXTENSION_NOT_FOUND=> 'ut�kning hittades ej', - DB_ERROR_NOSUCHDB => 'ingen s�dan databas', - DB_ERROR_ACCESS_VIOLATION => 'otillr�ckliga r�ttigheter' -); + 'en', + DB_ERROR => 'Okänt fel', + DB_ERROR_ALREADY_EXISTS => 'finns redan', + DB_ERROR_CANNOT_CREATE => 'kan inte skapa', + DB_ERROR_CANNOT_DELETE => 'kan inte ta bort', + DB_ERROR_CANNOT_DROP => 'kan inte släppa', + DB_ERROR_CONSTRAINT => 'begränsning kränkt', + DB_ERROR_DIVZERO => 'division med noll', + DB_ERROR_INVALID => 'ogiltig', + DB_ERROR_INVALID_DATE => 'ogiltigt datum eller tid', + DB_ERROR_INVALID_NUMBER => 'ogiltigt tal', + DB_ERROR_MISMATCH => 'felaktig matchning', + DB_ERROR_NODBSELECTED => 'ingen databas vald', + DB_ERROR_NOSUCHFIELD => 'inget sådant fält', + DB_ERROR_NOSUCHTABLE => 'ingen sådan tabell', + DB_ERROR_NOT_CAPABLE => 'DB backend klarar det inte', + DB_ERROR_NOT_FOUND => 'finns inte', + DB_ERROR_NOT_LOCKED => 'inte låst', + DB_ERROR_SYNTAX => 'syntaxfel', + DB_ERROR_UNSUPPORTED => 'stöds ej', + DB_ERROR_VALUE_COUNT_ON_ROW => 'värde räknat på rad', + DB_ERROR_INVALID_DSN => 'ogiltig DSN', + DB_ERROR_CONNECT_FAILED => 'anslutning misslyckades', + 0 => 'inget fel', // DB_OK + DB_ERROR_NEED_MORE_DATA => 'otillräckligt med data angivet', + DB_ERROR_EXTENSION_NOT_FOUND=> 'utökning hittades ej', + DB_ERROR_NOSUCHDB => 'ingen sådan databas', + DB_ERROR_ACCESS_VIOLATION => 'otillräckliga rättigheter' +); ?> \ No newline at end of file diff --git a/lib/adodb/license.txt b/lib/adodb/license.txt index 9821fcb7642..2353871c041 100644 --- a/lib/adodb/license.txt +++ b/lib/adodb/license.txt @@ -1,182 +1,182 @@ -ADOdb is dual licensed using BSD and LGPL. - -In plain English, you do not need to distribute your application in source code form, nor do you need to distribute ADOdb source code, provided you follow the rest of terms of the BSD license. - -For more info about ADOdb, visit http://adodb.sourceforge.net/ - -BSD Style-License -================= - -Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list -of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list -of conditions and the following disclaimer in the documentation and/or other materials -provided with the distribution. - -Neither the name of the John Lim nor the names of its contributors may be used to -endorse or promote products derived from this software without specific prior written -permission. - -DISCLAIMER: -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -JOHN LIM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================== -GNU LESSER GENERAL PUBLIC LICENSE -Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - -Preamble -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - -This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. - -When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. - -To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. - -For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - -We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. - -To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - -Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. - -Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. - -When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. - -We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. - -For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. - -In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. - -Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. - -The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". - -A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. - -The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) - -"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - -1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - -a) The modified work must itself be a software library. -b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. -c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. -d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. -(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - -Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. - -This option is useful when you wish to copy part of the code of the Library into a program that is not a library. - -4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. - -If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. - -5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. - -However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. - -When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. - -If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) - -Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - -6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. - -You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: - - -a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) -b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. -c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. -d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. -e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. -For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - -7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: - - -a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. -b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. -8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. - -10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - -11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - -14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - +ADOdb is dual licensed using BSD and LGPL. + +In plain English, you do not need to distribute your application in source code form, nor do you need to distribute ADOdb source code, provided you follow the rest of terms of the BSD license. + +For more info about ADOdb, visit http://adodb.sourceforge.net/ + +BSD Style-License +================= + +Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list +of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list +of conditions and the following disclaimer in the documentation and/or other materials +provided with the distribution. + +Neither the name of the John Lim nor the names of its contributors may be used to +endorse or promote products derived from this software without specific prior written +permission. + +DISCLAIMER: +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +JOHN LIM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +========================================================== +GNU LESSER GENERAL PUBLIC LICENSE +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + +Preamble +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. + +This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. + +Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. + +We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. + +The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. + + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + +a) The modified work must itself be a software library. +b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. +c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. +d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. +(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. + +However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. + +When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. + +If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: + + +a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) +b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. +c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. +d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. +e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. +For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: + + +a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. +b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. +8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/lib/adodb/perf/perf-db2.inc.php b/lib/adodb/perf/perf-db2.inc.php index 86b71987258..3823420a635 100644 --- a/lib/adodb/perf/perf-db2.inc.php +++ b/lib/adodb/perf/perf-db2.inc.php @@ -1,6 +1,6 @@ array('RATIOH', - "select round((1-(phy.value / (cur.value + con.value)))*100,2) - from v\$sysstat cur, v\$sysstat con, v\$sysstat phy - where cur.name = 'db block gets' and - con.name = 'consistent gets' and - phy.name = 'physical reads'", - '=WarnCacheRatio'), - - 'sql cache hit ratio' => array( 'RATIOH', - 'select round(100*(sum(pins)-sum(reloads))/sum(pins),2) from v$librarycache', - 'increase shared_pool_size if too ratio low'), - - 'datadict cache hit ratio' => array('RATIOH', - "select - round((1 - (sum(getmisses) / (sum(gets) + - sum(getmisses))))*100,2) - from v\$rowcache", - 'increase shared_pool_size if too ratio low'), - - 'memory sort ratio' => array('RATIOH', - "SELECT ROUND((100 * b.VALUE) /DECODE ((a.VALUE + b.VALUE), - 0,1,(a.VALUE + b.VALUE)),2) -FROM v\$sysstat a, - v\$sysstat b -WHERE a.name = 'sorts (disk)' -AND b.name = 'sorts (memory)'", - "% of memory sorts compared to disk sorts - should be over 95%"), - - 'IO', - 'data reads' => array('IO', - "select value from v\$sysstat where name='physical reads'"), - - 'data writes' => array('IO', - "select value from v\$sysstat where name='physical writes'"), - - 'Data Cache', - - 'data cache buffers' => array( 'DATAC', - "select a.value/b.value from v\$parameter a, v\$parameter b - where a.name = 'db_cache_size' and b.name= 'db_block_size'", - 'Number of cache buffers. Tune db_cache_size if the data cache hit ratio is too low.'), - 'data cache blocksize' => array('DATAC', - "select value from v\$parameter where name='db_block_size'", - '' ), - - 'Memory Pools', - 'Mem Max Target (11g+)' => array( 'DATAC', - "select value from v\$parameter where name = 'memory_max_target'", - 'The memory_max_size is the maximum value to which memory_target can be set.' ), - 'Memory target (11g+)' => array( 'DATAC', - "select value from v\$parameter where name = 'memory_target'", - 'If memory_target is defined then SGA and PGA targets are consolidated into one memory_target.' ), - 'SGA Max Size' => array( 'DATAC', - "select nvl(value,0)/1024.0/1024 || 'M' from v\$parameter where name = 'sga_max_size'", - 'The sga_max_size is the maximum value to which sga_target can be set.' ), - 'SGA target' => array( 'DATAC', - "select nvl(value,0)/1024.0/1024 || 'M' from v\$parameter where name = 'sga_target'", - 'If sga_target is defined then data cache, shared, java and large pool size can be 0. This is because all these pools are consolidated into one sga_target.' ), - 'PGA aggr target' => array( 'DATAC', - "select nvl(value,0)/1024.0/1024 || 'M' from v\$parameter where name = 'pga_aggregate_target'", - 'If pga_aggregate_target is defined then this is the maximum memory that can be allocated for cursor operations such as sorts, group by, joins, merges. When in doubt, set it to 20% of sga_target.' ), - 'data cache size' => array('DATAC', - "select value from v\$parameter where name = 'db_cache_size'", - 'db_cache_size' ), - 'shared pool size' => array('DATAC', - "select value from v\$parameter where name = 'shared_pool_size'", - 'shared_pool_size, which holds shared sql, stored procedures, dict cache and similar shared structs' ), - 'java pool size' => array('DATAJ', - "select value from v\$parameter where name = 'java_pool_size'", - 'java_pool_size' ), - 'large pool buffer size' => array('CACHE', - "select value from v\$parameter where name='large_pool_size'", - 'this pool is for large mem allocations (not because it is larger than shared pool), for MTS sessions, parallel queries, io buffers (large_pool_size) ' ), - - 'dynamic memory usage' => array('CACHE', "select '-' from dual", '=DynMemoryUsage'), - - 'Connections', - 'current connections' => array('SESS', - 'select count(*) from sys.v_$session where username is not null', - ''), - 'max connections' => array( 'SESS', - "select value from v\$parameter where name='sessions'", - ''), - - 'Memory Utilization', - 'data cache utilization ratio' => array('RATIOU', - "select round((1-bytes/sgasize)*100, 2) - from (select sum(bytes) sgasize from sys.v_\$sgastat) s, sys.v_\$sgastat f - where name = 'free memory' and pool = 'shared pool'", - 'Percentage of data cache actually in use - should be over 85%'), - - 'shared pool utilization ratio' => array('RATIOU', - 'select round((sga.bytes/case when p.value=0 then sga.bytes else to_number(p.value) end)*100,2) - from v$sgastat sga, v$parameter p - where sga.name = \'free memory\' and sga.pool = \'shared pool\' - and p.name = \'shared_pool_size\'', - 'Percentage of shared pool actually used - too low is bad, too high is worse'), - - 'large pool utilization ratio' => array('RATIOU', - "select round((1-bytes/sgasize)*100, 2) - from (select sum(bytes) sgasize from sys.v_\$sgastat) s, sys.v_\$sgastat f - where name = 'free memory' and pool = 'large pool'", - 'Percentage of large_pool actually in use - too low is bad, too high is worse'), - 'sort buffer size' => array('CACHE', - "select value from v\$parameter where name='sort_area_size'", - 'max in-mem sort_area_size (per query), uses memory in pga' ), - - /*'pga usage at peak' => array('RATIOU', - '=PGA','Mb utilization at peak transactions (requires Oracle 9i+)'),*/ - 'Transactions', - 'rollback segments' => array('ROLLBACK', - "select count(*) from sys.v_\$rollstat", - ''), - - 'peak transactions' => array('ROLLBACK', - "select max_utilization tx_hwm - from sys.v_\$resource_limit - where resource_name = 'transactions'", - 'Taken from high-water-mark'), - 'max transactions' => array('ROLLBACK', - "select value from v\$parameter where name = 'transactions'", - 'max transactions / rollback segments < 3.5 (or transactions_per_rollback_segment)'), - 'Parameters', - 'cursor sharing' => array('CURSOR', - "select value from v\$parameter where name = 'cursor_sharing'", - 'Cursor reuse strategy. Recommended is FORCE (8i+) or SIMILAR (9i+). See cursor_sharing.'), - /* - 'cursor reuse' => array('CURSOR', - "select count(*) from (select sql_text_wo_constants, count(*) - from t1 - group by sql_text_wo_constants -having count(*) > 100)",'These are sql statements that should be using bind variables'),*/ - 'index cache cost' => array('COST', - "select value from v\$parameter where name = 'optimizer_index_caching'", - '=WarnIndexCost'), - 'random page cost' => array('COST', - "select value from v\$parameter where name = 'optimizer_index_cost_adj'", - '=WarnPageCost'), - 'Waits', - 'Recent wait events' => array('WAITS','select \'Top 5 events\' from dual','=TopRecentWaits'), -// 'Historical wait SQL' => array('WAITS','select \'Last 2 days\' from dual','=TopHistoricalWaits'), -- requires AWR license - 'Backup', - 'Achivelog Mode' => array('BACKUP', 'select log_mode from v$database', '=LogMode'), - - 'DBID' => array('BACKUP','select dbid from v$database','Primary key of database, used for recovery with an RMAN Recovery Catalog'), - 'Archive Log Dest' => array('BACKUP', "SELECT NVL(v1.value,v2.value) -FROM v\$parameter v1, v\$parameter v2 WHERE v1.name='log_archive_dest' AND v2.name='log_archive_dest_10'", ''), - - 'Flashback Area' => array('BACKUP', "select nvl(value,'Flashback Area not used') from v\$parameter where name=lower('DB_RECOVERY_FILE_DEST')", 'Flashback area is a folder where all backup data and logs can be stored and managed by Oracle. If Error: message displayed, then it is not in use.'), - - 'Flashback Usage' => array('BACKUP', "select nvl('-','Flashback Area not used') from v\$parameter where name=lower('DB_RECOVERY_FILE_DEST')", '=FlashUsage', 'Flashback area usage.'), - - 'Control File Keep Time' => array('BACKUP', "select value from v\$parameter where name='control_file_record_keep_time'",'No of days to keep RMAN info in control file. Recommended set to x2 or x3 times the frequency of your full backup.'), - 'Recent RMAN Jobs' => array('BACKUP', "select '-' from dual", "=RMAN"), - - // 'Control File Keep Time' => array('BACKUP', "select value from v\$parameter where name='control_file_record_keep_time'",'No of days to keep RMAN info in control file. I recommend it be set to x2 or x3 times the frequency of your full backup.'), - - false - - ); - - - function perf_oci8(&$conn) - { - global $gSQLBlockRows; - - $gSQLBlockRows = 1000; - $savelog = $conn->LogSQL(false); - $this->version = $conn->ServerInfo(); - $conn->LogSQL($savelog); - $this->conn = $conn; - } - - function LogMode() - { - $mode = $this->conn->GetOne("select log_mode from v\$database"); - - if ($mode == 'ARCHIVELOG') return 'To turn off archivelog:
- SQLPLUS> connect sys as sysdba; - SQLPLUS> shutdown immediate; - - SQLPLUS> startup mount exclusive; - SQLPLUS> alter database noarchivelog; - SQLPLUS> alter database open; -'; - - return 'To turn on archivelog:
- SQLPLUS> connect sys as sysdba; - SQLPLUS> shutdown immediate; - - SQLPLUS> startup mount exclusive; - SQLPLUS> alter database archivelog; - SQLPLUS> archive log start; - SQLPLUS> alter database open; -'; - } - - function TopRecentWaits() - { - - $rs = $this->conn->Execute("select * from ( - select event, round(100*time_waited/(select sum(time_waited) from v\$system_event where wait_class <> 'Idle'),1) \"% Wait\", - total_waits,time_waited, average_wait,wait_class from v\$system_event where wait_class <> 'Idle' order by 2 desc - ) where rownum <=5"); - - $ret = rs2html($rs,false,false,false,false); - return "
".$ret."
"; - - } - - function TopHistoricalWaits() - { - $days = 2; - - $rs = $this->conn->Execute("select * from ( SELECT - b.wait_class,B.NAME, - round(sum(wait_time+TIME_WAITED)/1000000) waitsecs, - parsing_schema_name, - C.SQL_TEXT, a.sql_id -FROM V\$ACTIVE_SESSION_HISTORY A - join V\$EVENT_NAME B on A.EVENT# = B.EVENT# - join V\$SQLAREA C on A.SQL_ID = C.SQL_ID -WHERE A.SAMPLE_TIME BETWEEN sysdate-$days and sysdate - and parsing_schema_name not in ('SYS','SYSMAN','DBSNMP','SYSTEM') -GROUP BY b.wait_class,parsing_schema_name,C.SQL_TEXT, B.NAME,A.sql_id -order by 3 desc) where rownum <=10"); - - $ret = rs2html($rs,false,false,false,false); - return "".$ret."
"; - - } - - function RMAN() - { - $rs = $this->conn->Execute("select * from (select start_time, end_time, operation, status, mbytes_processed, output_device_type - from V\$RMAN_STATUS order by start_time desc) where rownum <=10"); - - $ret = rs2html($rs,false,false,false,false); - return "".$ret."
"; - - } - function DynMemoryUsage() - { - if (@$this->version['version'] >= 11) { - $rs = $this->conn->Execute("select component, current_size/1024./1024 as \"CurrSize (M)\" from V\$MEMORY_DYNAMIC_COMPONENTS"); - - } else - $rs = $this->conn->Execute("select name, round(bytes/1024./1024,2) as \"CurrSize (M)\" from V\$sgainfo"); - - - $ret = rs2html($rs,false,false,false,false); - return "".$ret."
"; - } - - function FlashUsage() - { - $rs = $this->conn->Execute("select * from V\$FLASH_RECOVERY_AREA_USAGE"); - $ret = rs2html($rs,false,false,false,false); - return "".$ret."
"; - } - - function WarnPageCost($val) - { - if ($val == 100 && $this->version['version'] < 10) $s = 'Too High. '; - else $s = ''; - - return $s.'Recommended is 20-50 for TP, and 50 for data warehouses. Default is 100. See optimizer_index_cost_adj. '; - } - - function WarnIndexCost($val) - { - if ($val == 0 && $this->version['version'] < 10) $s = 'Too Low. '; - else $s = ''; - - return $s.'Percentage of indexed data blocks expected in the cache. - Recommended is 20 (fast disk array) to 30 (slower hard disks). Default is 0. - See optimizer_index_caching.'; - } - - function PGA() - { - - //if ($this->version['version'] < 9) return 'Oracle 9i or later required'; - } - function PGA_Advice() - { - $t = "Missing PLAN_TABLE
--CREATE TABLE PLAN_TABLE ( - STATEMENT_ID VARCHAR2(30), - TIMESTAMP DATE, - REMARKS VARCHAR2(80), - OPERATION VARCHAR2(30), - OPTIONS VARCHAR2(30), - OBJECT_NODE VARCHAR2(128), - OBJECT_OWNER VARCHAR2(30), - OBJECT_NAME VARCHAR2(30), - OBJECT_INSTANCE NUMBER(38), - OBJECT_TYPE VARCHAR2(30), - OPTIMIZER VARCHAR2(255), - SEARCH_COLUMNS NUMBER, - ID NUMBER(38), - PARENT_ID NUMBER(38), - POSITION NUMBER(38), - COST NUMBER(38), - CARDINALITY NUMBER(38), - BYTES NUMBER(38), - OTHER_TAG VARCHAR2(255), - PARTITION_START VARCHAR2(255), - PARTITION_STOP VARCHAR2(255), - PARTITION_ID NUMBER(38), - OTHER LONG, - DISTRIBUTION VARCHAR2(30) -); -"; - return false; - } - - $rs->Close(); - // $this->conn->debug=1; - - if ($partial) { - $sqlq = $this->conn->qstr($sql.'%'); - $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq"); - if ($arr) { - foreach($arr as $row) { - $sql = reset($row); - if (crc32($sql) == $partial) break; - } - } - } - - $s = "
Explain: ".htmlspecialchars($sql)."
"; - - $this->conn->BeginTrans(); - $id = "ADODB ".microtime(); - - $rs = $this->conn->Execute("EXPLAIN PLAN SET STATEMENT_ID='$id' FOR $sql"); - $m = $this->conn->ErrorMsg(); - if ($m) { - $this->conn->RollbackTrans(); - $this->conn->LogSQL($savelog); - $s .= "$m
"; - return $s; - } - $rs = $this->conn->Execute(" - select - ''||lpad('--', (level-1)*2,'-') || trim(operation) || ' ' || trim(options)||'' as Operation,
- object_name,COST,CARDINALITY,bytes
- FROM plan_table
-START WITH id = 0 and STATEMENT_ID='$id'
-CONNECT BY prior id=parent_id and statement_id='$id'");
-
- $s .= rs2html($rs,false,false,false,false);
- $this->conn->RollbackTrans();
- $this->conn->LogSQL($savelog);
- $s .= $this->Tracer($sql,$partial);
- return $s;
- }
-
-
- function CheckMemory()
- {
- if ($this->version['version'] < 9) return 'Oracle 9i or later required';
-
- $rs = $this->conn->Execute("
-select a.name Buffer_Pool, b.size_for_estimate as cache_mb_estimate,
- case when b.size_factor=1 then
- '<<= Current'
- when a.estd_physical_read_factor-b.estd_physical_read_factor > 0.001 and b.estd_physical_read_factor<1 then
- '- BETTER than current by ' || round((1-b.estd_physical_read_factor)/b.estd_physical_read_factor*100,2) || '%'
- else ' ' end as RATING,
- b.estd_physical_read_factor \"Phys. Reads Factor\",
- round((a.estd_physical_read_factor-b.estd_physical_read_factor)/b.estd_physical_read_factor*100,2) as \"% Improve\"
- from (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r,name from v\$db_cache_advice order by name,1) a ,
- (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r,name from v\$db_cache_advice order by name,1) b
- where a.r = b.r-1 and a.name = b.name
- ");
- if (!$rs) return false;
-
- /*
- The v$db_cache_advice utility show the marginal changes in physical data block reads for different sizes of db_cache_size
- */
- $s = "Cache that is 50% of current size is still too big
"; - } else { - $s .= "Ideal size of Data Cache is when %BETTER gets close to zero."; - $s .= rs2html($rs,false,false,false,false); - } - return $s.$this->PGA_Advice(); - } - - /* - Generate html for suspicious/expensive sql - */ - function tohtml(&$rs,$type) - { - $o1 = $rs->FetchField(0); - $o2 = $rs->FetchField(1); - $o3 = $rs->FetchField(2); - if ($rs->EOF) return 'None found
'; - $check = ''; - $sql = ''; - $s = "\n\n| ".$o1->name.' | '.$o2->name.' | '.$o3->name.' |
| ".$carr[0].' | '.$carr[1].' | '.$prefix.$sql.$suffix.' |
| ".$carr[0].' | '.$carr[1].' | '.$prefix.$sql.$suffix.' |
'; - - $save = $ADODB_CACHE_MODE; - $ADODB_CACHE_MODE = ADODB_FETCH_NUM; - if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false); - - $savelog = $this->conn->LogSQL(false); - $rs = $this->conn->SelectLimit($sql); - $this->conn->LogSQL($savelog); - - if (isset($savem)) $this->conn->SetFetchMode($savem); - $ADODB_CACHE_MODE = $save; - if ($rs) { - $s .= "\n
'; - $save = $ADODB_CACHE_MODE; - $ADODB_CACHE_MODE = ADODB_FETCH_NUM; - if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false); - - $savelog = $this->conn->LogSQL(false); - $rs = $this->conn->Execute($sql); - $this->conn->LogSQL($savelog); - - if (isset($savem)) $this->conn->SetFetchMode($savem); - $ADODB_CACHE_MODE = $save; - - if ($rs) { - $s .= "\n
+ SQLPLUS> connect sys as sysdba; + SQLPLUS> shutdown immediate; + + SQLPLUS> startup mount exclusive; + SQLPLUS> alter database noarchivelog; + SQLPLUS> alter database open; +'; + + return 'To turn on archivelog:
+ SQLPLUS> connect sys as sysdba; + SQLPLUS> shutdown immediate; + + SQLPLUS> startup mount exclusive; + SQLPLUS> alter database archivelog; + SQLPLUS> archive log start; + SQLPLUS> alter database open; +'; + } + + function TopRecentWaits() + { + + $rs = $this->conn->Execute("select * from ( + select event, round(100*time_waited/(select sum(time_waited) from v\$system_event where wait_class <> 'Idle'),1) \"% Wait\", + total_waits,time_waited, average_wait,wait_class from v\$system_event where wait_class <> 'Idle' order by 2 desc + ) where rownum <=5"); + + $ret = rs2html($rs,false,false,false,false); + return "
".$ret."
"; + + } + + function TopHistoricalWaits() + { + $days = 2; + + $rs = $this->conn->Execute("select * from ( SELECT + b.wait_class,B.NAME, + round(sum(wait_time+TIME_WAITED)/1000000) waitsecs, + parsing_schema_name, + C.SQL_TEXT, a.sql_id +FROM V\$ACTIVE_SESSION_HISTORY A + join V\$EVENT_NAME B on A.EVENT# = B.EVENT# + join V\$SQLAREA C on A.SQL_ID = C.SQL_ID +WHERE A.SAMPLE_TIME BETWEEN sysdate-$days and sysdate + and parsing_schema_name not in ('SYS','SYSMAN','DBSNMP','SYSTEM') +GROUP BY b.wait_class,parsing_schema_name,C.SQL_TEXT, B.NAME,A.sql_id +order by 3 desc) where rownum <=10"); + + $ret = rs2html($rs,false,false,false,false); + return "".$ret."
"; + + } + + function RMAN() + { + $rs = $this->conn->Execute("select * from (select start_time, end_time, operation, status, mbytes_processed, output_device_type + from V\$RMAN_STATUS order by start_time desc) where rownum <=10"); + + $ret = rs2html($rs,false,false,false,false); + return "".$ret."
"; + + } + function DynMemoryUsage() + { + if (@$this->version['version'] >= 11) { + $rs = $this->conn->Execute("select component, current_size/1024./1024 as \"CurrSize (M)\" from V\$MEMORY_DYNAMIC_COMPONENTS"); + + } else + $rs = $this->conn->Execute("select name, round(bytes/1024./1024,2) as \"CurrSize (M)\" from V\$sgainfo"); + + + $ret = rs2html($rs,false,false,false,false); + return "".$ret."
"; + } + + function FlashUsage() + { + $rs = $this->conn->Execute("select * from V\$FLASH_RECOVERY_AREA_USAGE"); + $ret = rs2html($rs,false,false,false,false); + return "".$ret."
"; + } + + function WarnPageCost($val) + { + if ($val == 100 && $this->version['version'] < 10) $s = 'Too High. '; + else $s = ''; + + return $s.'Recommended is 20-50 for TP, and 50 for data warehouses. Default is 100. See optimizer_index_cost_adj. '; + } + + function WarnIndexCost($val) + { + if ($val == 0 && $this->version['version'] < 10) $s = 'Too Low. '; + else $s = ''; + + return $s.'Percentage of indexed data blocks expected in the cache. + Recommended is 20 (fast disk array) to 30 (slower hard disks). Default is 0. + See optimizer_index_caching.'; + } + + function PGA() + { + + //if ($this->version['version'] < 9) return 'Oracle 9i or later required'; + } + function PGA_Advice() + { + $t = "Missing PLAN_TABLE
++CREATE TABLE PLAN_TABLE ( + STATEMENT_ID VARCHAR2(30), + TIMESTAMP DATE, + REMARKS VARCHAR2(80), + OPERATION VARCHAR2(30), + OPTIONS VARCHAR2(30), + OBJECT_NODE VARCHAR2(128), + OBJECT_OWNER VARCHAR2(30), + OBJECT_NAME VARCHAR2(30), + OBJECT_INSTANCE NUMBER(38), + OBJECT_TYPE VARCHAR2(30), + OPTIMIZER VARCHAR2(255), + SEARCH_COLUMNS NUMBER, + ID NUMBER(38), + PARENT_ID NUMBER(38), + POSITION NUMBER(38), + COST NUMBER(38), + CARDINALITY NUMBER(38), + BYTES NUMBER(38), + OTHER_TAG VARCHAR2(255), + PARTITION_START VARCHAR2(255), + PARTITION_STOP VARCHAR2(255), + PARTITION_ID NUMBER(38), + OTHER LONG, + DISTRIBUTION VARCHAR2(30) +); +"; + return false; + } + + $rs->Close(); + // $this->conn->debug=1; + + if ($partial) { + $sqlq = $this->conn->qstr($sql.'%'); + $arr = $this->conn->GetArray("select distinct sql1 from adodb_logsql where sql1 like $sqlq"); + if ($arr) { + foreach($arr as $row) { + $sql = reset($row); + if (crc32($sql) == $partial) break; + } + } + } + + $s = "
Explain: ".htmlspecialchars($sql)."
"; + + $this->conn->BeginTrans(); + $id = "ADODB ".microtime(); + + $rs = $this->conn->Execute("EXPLAIN PLAN SET STATEMENT_ID='$id' FOR $sql"); + $m = $this->conn->ErrorMsg(); + if ($m) { + $this->conn->RollbackTrans(); + $this->conn->LogSQL($savelog); + $s .= "$m
"; + return $s; + } + $rs = $this->conn->Execute(" + select + ''||lpad('--', (level-1)*2,'-') || trim(operation) || ' ' || trim(options)||'' as Operation,
+ object_name,COST,CARDINALITY,bytes
+ FROM plan_table
+START WITH id = 0 and STATEMENT_ID='$id'
+CONNECT BY prior id=parent_id and statement_id='$id'");
+
+ $s .= rs2html($rs,false,false,false,false);
+ $this->conn->RollbackTrans();
+ $this->conn->LogSQL($savelog);
+ $s .= $this->Tracer($sql,$partial);
+ return $s;
+ }
+
+
+ function CheckMemory()
+ {
+ if ($this->version['version'] < 9) return 'Oracle 9i or later required';
+
+ $rs = $this->conn->Execute("
+select a.name Buffer_Pool, b.size_for_estimate as cache_mb_estimate,
+ case when b.size_factor=1 then
+ '<<= Current'
+ when a.estd_physical_read_factor-b.estd_physical_read_factor > 0.001 and b.estd_physical_read_factor<1 then
+ '- BETTER than current by ' || round((1-b.estd_physical_read_factor)/b.estd_physical_read_factor*100,2) || '%'
+ else ' ' end as RATING,
+ b.estd_physical_read_factor \"Phys. Reads Factor\",
+ round((a.estd_physical_read_factor-b.estd_physical_read_factor)/b.estd_physical_read_factor*100,2) as \"% Improve\"
+ from (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r,name from v\$db_cache_advice order by name,1) a ,
+ (select size_for_estimate,size_factor,estd_physical_read_factor,rownum r,name from v\$db_cache_advice order by name,1) b
+ where a.r = b.r-1 and a.name = b.name
+ ");
+ if (!$rs) return false;
+
+ /*
+ The v$db_cache_advice utility show the marginal changes in physical data block reads for different sizes of db_cache_size
+ */
+ $s = "Cache that is 50% of current size is still too big
"; + } else { + $s .= "Ideal size of Data Cache is when %BETTER gets close to zero."; + $s .= rs2html($rs,false,false,false,false); + } + return $s.$this->PGA_Advice(); + } + + /* + Generate html for suspicious/expensive sql + */ + function tohtml(&$rs,$type) + { + $o1 = $rs->FetchField(0); + $o2 = $rs->FetchField(1); + $o3 = $rs->FetchField(2); + if ($rs->EOF) return 'None found
'; + $check = ''; + $sql = ''; + $s = "\n\n| ".$o1->name.' | '.$o2->name.' | '.$o3->name.' |
| ".$carr[0].' | '.$carr[1].' | '.$prefix.$sql.$suffix.' |
| ".$carr[0].' | '.$carr[1].' | '.$prefix.$sql.$suffix.' |
'; + + $save = $ADODB_CACHE_MODE; + $ADODB_CACHE_MODE = ADODB_FETCH_NUM; + if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false); + + $savelog = $this->conn->LogSQL(false); + $rs = $this->conn->SelectLimit($sql); + $this->conn->LogSQL($savelog); + + if (isset($savem)) $this->conn->SetFetchMode($savem); + $ADODB_CACHE_MODE = $save; + if ($rs) { + $s .= "\n
'; + $save = $ADODB_CACHE_MODE; + $ADODB_CACHE_MODE = ADODB_FETCH_NUM; + if ($this->conn->fetchMode !== false) $savem = $this->conn->SetFetchMode(false); + + $savelog = $this->conn->LogSQL(false); + $rs = $this->conn->Execute($sql); + $this->conn->LogSQL($savelog); + + if (isset($savem)) $this->conn->SetFetchMode($savem); + $ADODB_CACHE_MODE = $save; + + if ($rs) { + $s .= "\n