From: martin Date: Mon, 9 Sep 2002 06:23:39 +0000 (+0000) Subject: Whoops ... last conversion actully tampered with comment formatting X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e5c2a9e44100b838b54c48b74de3442c0c126fb5;p=moodle.git Whoops ... last conversion actully tampered with comment formatting ... I've fixed that now. --- diff --git a/lib/adodb/adodb-cryptsession.php b/lib/adodb/adodb-cryptsession.php index c757f54b41..f6d89f9358 100644 --- a/lib/adodb/adodb-cryptsession.php +++ b/lib/adodb/adodb-cryptsession.php @@ -75,7 +75,7 @@ GLOBAL $ADODB_SESSION_CONNECT, $ADODB_SESS_DEBUG, $ADODB_SESS_INSERT; - /* $ADODB_SESS_DEBUG = true; */ + //$ADODB_SESS_DEBUG = true; /* SET THE FOLLOWING PARAMETERS */ if (empty($ADODB_SESSION_DRIVER)) { @@ -101,8 +101,8 @@ $ADODB_CRYPT_KEY = 'CRYPTED ADODB SESSIONS ROCK!'; $ADODB_SESS_LIFE = get_cfg_var('session.gc_maxlifetime'); if ($ADODB_SESS_LIFE <= 1) { - /* bug in PHP 4.0.3 pl 1 -- how about other versions? */ - /* print "

Session Error: PHP.INI setting session.gc_maxlifetimenot set: $ADODB_SESS_LIFE

"; */ + // bug in PHP 4.0.3 pl 1 -- how about other versions? + //print "

Session Error: PHP.INI setting session.gc_maxlifetimenot set: $ADODB_SESS_LIFE

"; $ADODB_SESS_LIFE=1440; } @@ -148,7 +148,7 @@ global $ADODB_SESS_CONN,$ADODB_SESS_INSERT,$ADODB_SESSION_TBL; $ADODB_SESS_INSERT = true; $v = ''; } else { - /* Decrypt session data */ + // Decrypt session data $v = rawurldecode($Crypt->Decrypt(reset($rs->fields), ADODB_Session_Key())); } $rs->Close(); @@ -166,7 +166,7 @@ $Crypt = new MD5Crypt; $expiry = time() + $ADODB_SESS_LIFE; - /* encrypt session data.. */ + // encrypt session data.. $val = $Crypt->Encrypt(rawurlencode($val), ADODB_Session_Key()); $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry,data='$val' WHERE sesskey='$key'"; $rs = $ADODB_SESS_CONN->Execute($qry); @@ -179,8 +179,8 @@ $Crypt = new MD5Crypt; if ($rs) $rs->Close(); else print '

Session Insert: '.$ADODB_SESS_CONN->ErrorMsg().'

'; } - /* bug in access driver (could be odbc?) means that info is not commited */ - /* properly unless select statement executed in Win2000 */ + // bug in access driver (could be odbc?) means that info is not commited + // properly unless select statement executed in Win2000 if ($ADODB_SESS_CONN->databaseType == 'access') $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'"); return isset($rs); @@ -203,7 +203,7 @@ function adodb_sess_gc($maxlifetime) { $rs = $ADODB_SESS_CONN->Execute($qry); if ($rs) $rs->Close(); - /* suggested by Cameron, "GaM3R" */ + // suggested by Cameron, "GaM3R" if (defined('ADODB_SESSION_OPTIMIZE')) { switch( $ADODB_SESSION_DRIVER ) { diff --git a/lib/adodb/adodb-csvlib.inc.php b/lib/adodb/adodb-csvlib.inc.php index 6d213a1759..50a3bf093c 100644 --- a/lib/adodb/adodb-csvlib.inc.php +++ b/lib/adodb/adodb-csvlib.inc.php @@ -29,9 +29,9 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese $max = ($rs) ? $rs->FieldCount() : 0; if ($sql) $sql = urlencode($sql); - /* metadata setup */ + // metadata setup - if ($max <= 0 || $rs->dataProvider == 'empty') { /* is insert/update/delete */ + if ($max <= 0 || $rs->dataProvider == 'empty') { // is insert/update/delete if (is_object($conn)) { $sql .= ','.$conn->Affected_Rows(); $sql .= ','.$conn->Insert_ID(); @@ -44,7 +44,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese $tt = ($rs->timeCreated) ? $rs->timeCreated : time(); $line = "====0,$tt,$sql\n"; } - /* column definitions */ + // column definitions for($i=0; $i < $max; $i++) { $o = $rs->FetchField($i); $line .= urlencode($o->name).':'.$rs->MetaType($o->type,$o->max_length).":$o->max_length,"; @@ -52,7 +52,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese $text = substr($line,0,strlen($line)-1)."\n"; - /* get data */ + // get data if ($rs->databaseType == 'array') { $text .= serialize($rs->_array); } else { @@ -92,15 +92,15 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese $ttl = 0; if ($meta = fgetcsv ($fp, 8192, ",")) { - /* check if error message */ + // check if error message if (substr($meta[0],0,4) === '****') { $err = trim(substr($meta[0],4,1024)); fclose($fp); return false; } - /* check for meta data */ - /* $meta[0] is -1 means return an empty recordset */ - /* $meta[1] contains a time */ + // check for meta data + // $meta[0] is -1 means return an empty recordset + // $meta[1] contains a time if (substr($meta[0],0,4) === '====') { @@ -156,10 +156,10 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese fclose($fp); $err = "Timeout 0"; return false; - } /* switch */ + } // switch - } /* if check flush cache */ - }/* (timeout>0) */ + } // if check flush cache + }// (timeout>0) $ttl = $meta[1]; } $meta = fgetcsv($fp, 8192, ","); @@ -170,7 +170,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese } } - /* Get Column definitions */ + // Get Column definitions $flds = array(); foreach($meta as $o) { $o2 = explode(':',$o); @@ -188,12 +188,12 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese } else { fclose($fp); $err = "Recordset had unexpected EOF 2"; - /* print "$url ";print_r($meta); */ - /* die(); */ + //print "$url ";print_r($meta); + //die(); return false; } - /* slurp in the data */ + // slurp in the data $MAXSIZE = 128000; $text = fread($fp,$MAXSIZE); $cnt = 1; @@ -205,7 +205,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese fclose($fp); $arr = @unserialize($text); - /* var_dump($arr); */ + //var_dump($arr); if (!is_array($arr)) { $err = "Recordset had unexpected EOF 3"; return false; diff --git a/lib/adodb/adodb-errorhandler.inc.php b/lib/adodb/adodb-errorhandler.inc.php index ba170d9d9e..fb89039a6e 100644 --- a/lib/adodb/adodb-errorhandler.inc.php +++ b/lib/adodb/adodb-errorhandler.inc.php @@ -67,7 +67,7 @@ function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false) } - /* print "

$s

"; */ + //print "

$s

"; trigger_error($s,E_USER_ERROR); } ?> diff --git a/lib/adodb/adodb-errorpear.inc.php b/lib/adodb/adodb-errorpear.inc.php index 5669f1cd3d..b82b72876e 100644 --- a/lib/adodb/adodb-errorpear.inc.php +++ b/lib/adodb/adodb-errorpear.inc.php @@ -17,7 +17,7 @@ define('ADODB_ERROR_HANDLER','ADODB_Error_PEAR'); /* * Enabled the following if you want to terminate scripts when an error occurs */ -/* PEAR::setErrorHandling (PEAR_ERROR_DIE); */ +//PEAR::setErrorHandling (PEAR_ERROR_DIE); /* * Name of the PEAR_Error derived class to call. @@ -69,7 +69,7 @@ global $ADODB_Last_PEAR_Error; $GLOBALS['_PEAR_default_error_options'], $errmsg); - /* print "

!$s

"; */ + //print "

!$s

"; } /** diff --git a/lib/adodb/adodb-lib.inc.php b/lib/adodb/adodb-lib.inc.php index 50c3910192..57f8ac09ee 100644 --- a/lib/adodb/adodb-lib.inc.php +++ b/lib/adodb/adodb-lib.inc.php @@ -10,7 +10,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese */ -/* Requires $ADODB_FETCH_MODE = ADODB_FETCH_NUM */ +// Requires $ADODB_FETCH_MODE = ADODB_FETCH_NUM function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=false, $size=0, $selectAttr='',$compareFields0=true) { @@ -61,7 +61,7 @@ function _adodb_getmenu(&$zthis, $name,$defstr='',$blank1stItem=true,$multiple=f $s .= "\n'.htmlspecialchars($zval).''; } $zthis->MoveNext(); - } /* while */ + } // while return $s ."\n\n"; } @@ -82,25 +82,25 @@ function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, $atlastpage = false; $lastpageno=1; - /* If an invalid nrows is supplied, */ - /* we assume a default value of 10 rows per page */ + // If an invalid nrows is supplied, + // we assume a default value of 10 rows per page if (!isset($nrows) || $nrows <= 0) $nrows = 10; - $qryRecs = false; /* count records for no offset */ + $qryRecs = false; //count records for no offset - /* jlim - attempt query rewrite first */ + // jlim - attempt query rewrite first $rewritesql = preg_replace( '/^\s*SELECT\s.*\sFROM\s/is','SELECT COUNT(*) FROM ',$sql); if ($rewritesql != $sql){ - /* fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails */ - /* with mssql, access and postgresql */ + // fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails + // with mssql, access and postgresql $rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$rewritesql); if ($secs2cache) { - /* we only use half the time of secs2cache because the count can quickly */ - /* become inaccurate if new records are added */ + // we only use half the time of secs2cache because the count can quickly + // become inaccurate if new records are added $rs = $zthis->CacheExecute($secs2cache/2,$rewritesql); if ($rs) { if (!$rs->EOF) $qryRecs = reset($rs->fields); @@ -111,11 +111,11 @@ function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, $lastpageno = (int) ceil($qryRecs / $nrows); } - /* query rewrite failed - so try slower way... */ + // query rewrite failed - so try slower way... if ($qryRecs === false) { $rstest = &$zthis->Execute($sql); if ($rstest) { - /* save total records */ + //save total records $qryRecs = $rstest->RecordCount(); if ($qryRecs == -1) if (!$rstest->EOF) { @@ -131,21 +131,21 @@ function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, $zthis->_maxRecordCount = $qryRecs; - /* If page number <= 1, then we are at the first page */ + // If page number <= 1, then we are at the first page if (!isset($page) || $page <= 1) { $page = 1; $atfirstpage = true; } - /* ***** Here we check whether $page is the last page or */ - /* whether we are trying to retrieve */ - /* a page number greater than the last page number. */ + // ***** Here we check whether $page is the last page or + // whether we are trying to retrieve + // a page number greater than the last page number. if ($page >= $lastpageno) { $page = $lastpageno; $atlastpage = true; } - /* We get the data we want */ + // We get the data we want $offset = $nrows * ($page-1); if ($secs2cache > 0) $rsreturn = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr, $arg3); @@ -153,7 +153,7 @@ function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, $rsreturn = &$zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $arg3, $secs2cache); - /* Before returning the RecordSet, we set the pagination properties we need */ + // Before returning the RecordSet, we set the pagination properties we need if ($rsreturn) { $rsreturn->rowsPerPage = $nrows; $rsreturn->AbsolutePage($page); @@ -164,21 +164,21 @@ function &_adodb_pageexecute_all_rows(&$zthis, $sql, $nrows, $page, return $rsreturn; } -/* Iván Oliva version */ +// Iván Oliva version function &_adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputarr=false, $arg3=false, $secs2cache=0) { $atfirstpage = false; $atlastpage = false; - if (!isset($page) || $page <= 1) { /* If page number <= 1, then we are at the first page */ + if (!isset($page) || $page <= 1) { // If page number <= 1, then we are at the first page $page = 1; $atfirstpage = true; } - if ($nrows <= 0) $nrows = 10; /* If an invalid nrows is supplied, we assume a default value of 10 rows per page */ + if ($nrows <= 0) $nrows = 10; // If an invalid nrows is supplied, we assume a default value of 10 rows per page - /* ***** Here we check whether $page is the last page or whether we are trying to retrieve a page number greater than */ - /* the last page number. */ + // ***** Here we check whether $page is the last page or whether we are trying to retrieve a page number greater than + // the last page number. $pagecounter = $page + 1; $pagecounteroffset = ($pagecounter * $nrows) - $nrows; if ($secs2cache>0) $rstest = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $pagecounteroffset, $inputarr, $arg3); @@ -194,18 +194,18 @@ function &_adodb_pageexecute_no_last_page(&$zthis, $sql, $nrows, $page, $inputar } if ($rstest) $rstest->Close(); } - if ($atlastpage) { /* If we are at the last page or beyond it, we are going to retrieve it */ + if ($atlastpage) { // If we are at the last page or beyond it, we are going to retrieve it $page = $pagecounter; - if ($page == 1) $atfirstpage = true; /* We have to do this again in case the last page is the same as the first */ - /* ... page, that is, the recordset has only 1 page. */ + if ($page == 1) $atfirstpage = true; // We have to do this again in case the last page is the same as the first + //... page, that is, the recordset has only 1 page. } - /* We get the data we want */ + // We get the data we want $offset = $nrows * ($page-1); if ($secs2cache > 0) $rsreturn = &$zthis->CacheSelectLimit($secs2cache, $sql, $nrows, $offset, $inputarr, $arg3); else $rsreturn = &$zthis->SelectLimit($sql, $nrows, $offset, $inputarr, $arg3, $secs2cache); - /* Before returning the RecordSet, we set the pagination properties we need */ + // Before returning the RecordSet, we set the pagination properties we need if ($rsreturn) { $rsreturn->rowsPerPage = $nrows; $rsreturn->AbsolutePage($page); @@ -224,42 +224,42 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq $fieldUpdatedCount = 0; - /* Get the table name from the existing query. */ + // Get the table name from the existing query. preg_match("/FROM\s".ADODB_TABLE_REGEX."/i", $rs->sql, $tableName); - /* Get the full where clause excluding the word "WHERE" from */ - /* the existing query. */ + // Get the full where clause excluding the word "WHERE" from + // the existing query. preg_match("/WHERE\s(.*)/i", $rs->sql, $whereClause); - /* updateSQL will contain the full update query when all */ - /* processing has completed. */ + // updateSQL will contain the full update query when all + // processing has completed. $updateSQL = "UPDATE " . $tableName[1] . " SET "; - /* Loop through all of the fields in the recordset */ + // Loop through all of the fields in the recordset for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) { - /* Get the field from the recordset */ + // Get the field from the recordset $field = $rs->FetchField($i); - /* If the recordset field is one */ - /* of the fields passed in then process. */ + // If the recordset field is one + // of the fields passed in then process. if (isset($arrFields[$field->name])) { - /* If the existing field value in the recordset */ - /* is different from the value passed in then */ - /* go ahead and append the field name and new value to */ - /* the update query. */ + // If the existing field value in the recordset + // is different from the value passed in then + // go ahead and append the field name and new value to + // the update query. if ($forceUpdate || strcmp($rs->fields[$i], $arrFields[$field->name])) { - /* Set the counter for the number of fields that will be updated. */ + // Set the counter for the number of fields that will be updated. $fieldUpdatedCount++; - /* Based on the datatype of the field */ - /* Format the value properly for the database */ + // Based on the datatype of the field + // Format the value properly for the database $mt = $rs->MetaType($field->type); - /* "mike" patch and "Ryan Bailey" */ - /* PostgreSQL uses a 't' or 'f' and therefore needs to be processed as a string ('C') type field. */ + // "mike" patch and "Ryan Bailey" + //PostgreSQL uses a 't' or 'f' and therefore needs to be processed as a string ('C') type field. if ((substr($zthis->databaseType,0,8) == "postgres") && ($mt == "L")) $mt = "C"; switch($mt) { @@ -281,13 +281,13 @@ function _adodb_getupdatesql(&$zthis,&$rs, $arrFields,$forceUpdate=false,$magicq }; }; - /* If there were any modified fields then build the rest of the update query. */ + // If there were any modified fields then build the rest of the update query. if ($fieldUpdatedCount > 0 || $forceUpdate) { - /* Strip off the comma and space on the end of the update query. */ + // Strip off the comma and space on the end of the update query. $updateSQL = substr($updateSQL, 0, -2); - /* If the recordset has a where clause then use that same where clause */ - /* for the update. */ + // If the recordset has a where clause then use that same where clause + // for the update. if ($whereClause[1]) $updateSQL .= " WHERE " . $whereClause[1]; return $updateSQL; @@ -308,32 +308,32 @@ function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false) $fieldInsertedCount = 0; - /* Get the table name from the existing query. */ + // Get the table name from the existing query. preg_match("/FROM\s".ADODB_TABLE_REGEX."/i", $rs->sql, $tableName); - /* Loop through all of the fields in the recordset */ + // Loop through all of the fields in the recordset for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) { - /* Get the field from the recordset */ + // Get the field from the recordset $field = $rs->FetchField($i); - /* If the recordset field is one */ - /* of the fields passed in then process. */ + // If the recordset field is one + // of the fields passed in then process. if (isset($arrFields[$field->name])) { - /* Set the counter for the number of fields that will be inserted. */ + // Set the counter for the number of fields that will be inserted. $fieldInsertedCount++; - /* Get the name of the fields to insert */ + // Get the name of the fields to insert $fields .= $field->name . ", "; $mt = $rs->MetaType($field->type); - /* "mike" patch and "Ryan Bailey" */ - /* PostgreSQL uses a 't' or 'f' and therefore needs to be processed as a string ('C') type field. */ + // "mike" patch and "Ryan Bailey" + //PostgreSQL uses a 't' or 'f' and therefore needs to be processed as a string ('C') type field. if ((substr($zthis->databaseType,0,8) == "postgres") && ($mt == "L")) $mt = "C"; - /* Based on the datatype of the field */ - /* Format the value properly for the database */ + // Based on the datatype of the field + // Format the value properly for the database switch($mt) { case "C": case "X": @@ -352,15 +352,15 @@ function _adodb_getinsertsql(&$zthis,&$rs,$arrFields,$magicq=false) }; }; - /* If there were any inserted fields then build the rest of the insert query. */ + // If there were any inserted fields then build the rest of the insert query. if ($fieldInsertedCount > 0) { - /* Strip off the comma and space on the end of both the fields */ - /* and their values. */ + // Strip off the comma and space on the end of both the fields + // and their values. $fields = substr($fields, 0, -2); $values = substr($values, 0, -2); - /* Append the fields and their values to the insert query. */ + // Append the fields and their values to the insert query. $insertSQL = "INSERT INTO " . $tableName[1] . " ( $fields ) VALUES ( $values )"; return $insertSQL; diff --git a/lib/adodb/adodb-pager.inc.php b/lib/adodb/adodb-pager.inc.php index c09f44a6c8..37beaa3a78 100644 --- a/lib/adodb/adodb-pager.inc.php +++ b/lib/adodb/adodb-pager.inc.php @@ -23,16 +23,16 @@ delete records. */ class ADODB_Pager { - var $id; /* unique id for pager (defaults to 'adodb') */ - var $db; /* ADODB connection object */ - var $sql; /* sql used */ - var $rs; /* recordset generated */ - var $curr_page; /* current page number before Render() called, calculated in constructor */ - var $rows; /* number of rows per page */ + var $id; // unique id for pager (defaults to 'adodb') + var $db; // ADODB connection object + var $sql; // sql used + var $rs; // recordset generated + var $curr_page; // current page number before Render() called, calculated in constructor + var $rows; // number of rows per page var $gridAttributes = 'width=100% border=1 bgcolor=white'; - /* Localize text strings here */ + // Localize text strings here var $first = '|<'; var $prev = '<<'; var $next = '>>'; @@ -40,15 +40,15 @@ class ADODB_Pager { var $page = 'Page'; var $cache = 0; #secs to cache with CachePageExecute() - /* ---------------------------------------------- */ - /* constructor */ - /* */ - /* $db adodb connection object */ - /* $sql sql statement */ - /* $id optional id to identify which pager, */ - /* if you have multiple on 1 page. */ - /* $id should be only be [a-z0-9]* */ - /* */ + //---------------------------------------------- + // constructor + // + // $db adodb connection object + // $sql sql statement + // $id optional id to identify which pager, + // if you have multiple on 1 page. + // $id should be only be [a-z0-9]* + // function ADODB_Pager(&$db,$sql,$id = 'adodb') { global $HTTP_SERVER_VARS,$PHP_SELF,$HTTP_SESSION_VARS,$HTTP_GET_VARS; @@ -71,8 +71,8 @@ class ADODB_Pager { } - /* --------------------------- */ - /* Display link to first page */ + //--------------------------- + // Display link to first page function Render_First($anchor=true) { global $PHP_SELF; @@ -85,8 +85,8 @@ class ADODB_Pager { } } - /* -------------------------- */ - /* Display link to next page */ + //-------------------------- + // Display link to next page function render_next($anchor=true) { global $PHP_SELF; @@ -100,12 +100,12 @@ class ADODB_Pager { } } - /* ------------------ */ - /* Link to last page */ - /* */ - /* for better performance with large recordsets, you can set */ - /* $this->db->pageExecuteCountRows = false, which disables */ - /* last page counting. */ + //------------------ + // Link to last page + // + // for better performance with large recordsets, you can set + // $this->db->pageExecuteCountRows = false, which disables + // last page counting. function render_last($anchor=true) { global $PHP_SELF; @@ -121,8 +121,8 @@ class ADODB_Pager { } } - /* ---------------------- */ - /* Link to previous page */ + //---------------------- + // Link to previous page function render_prev($anchor=true) { global $PHP_SELF; @@ -135,14 +135,14 @@ class ADODB_Pager { } } - /* -------------------------------------------------------- */ - /* Simply rendering of grid. You should override this for */ - /* better control over the format of the grid */ - /* */ - /* We use output buffering to keep code clean and readable. */ + //-------------------------------------------------------- + // Simply rendering of grid. You should override this for + // better control over the format of the grid + // + // We use output buffering to keep code clean and readable. function RenderGrid() { - global $gSQLBlockRows; /* used by rs2html to indicate how many rows to display */ + global $gSQLBlockRows; // used by rs2html to indicate how many rows to display include_once(ADODB_DIR.'/tohtml.inc.php'); ob_start(); $gSQLBlockRows = $this->rows; @@ -152,10 +152,10 @@ class ADODB_Pager { return $s; } - /* ------------------------------------------------------- */ - /* Navigation bar */ - /* */ - /* we use output buffering to keep the code easy to read. */ + //------------------------------------------------------- + // Navigation bar + // + // we use output buffering to keep the code easy to read. function RenderNav() { ob_start(); @@ -178,16 +178,16 @@ class ADODB_Pager { return $s; } - /* ------------------- */ - /* This is the footer */ + //------------------- + // This is the footer function RenderPageCount() { if (!$this->db->pageExecuteCountRows) return ''; return "$this->page ".$this->curr_page."/".$this->rs->LastPageNo().""; } - /* ----------------------------------- */ - /* Call this class to draw everything. */ + //----------------------------------- + // Call this class to draw everything. function Render($rows=10) { global $ADODB_COUNTRECS; @@ -221,8 +221,8 @@ class ADODB_Pager { $this->RenderLayout($header,$grid,$footer); } - /* ------------------------------------------------------ */ - /* override this to control overall layout and formating */ + //------------------------------------------------------ + // override this to control overall layout and formating function RenderLayout($header,$grid,$footer) { echo " @@ -302,7 +302,7 @@ You will use $conn->Connect() or @@ -369,7 +369,7 @@ You will use $conn->Connect() or PConnect('DSN','user','pwd'). - @@ -818,9 +818,9 @@ another way of handling errors using ADOdb's custom error handlers.

ADOdb provides two custom handlers which you can modify for your needs. The first one is in the ADOdb-errorhandler.inc.php file. This makes -use of the standard PHP functions error_reporting */ +use of the standard PHP functions error_reporting to control what error messages types to display, -and trigger_error which invokes the default */ +and trigger_error which invokes the default PHP error handler.

Including the above file will cause trigger_error($errorstring,E_USER_ERROR) @@ -850,7 +850,7 @@ if ($rs) $rs2html($rs);

If you want to log the error message, you can do so by defining the following optional constants ADODB_ERROR_LOG_TYPE and ADODB_ERROR_LOG_DEST. ADODB_ERROR_LOG_TYPE is - the error log message type (see error_log */ + the error log message type (see error_log in the PHP manual). In this case we set it to 3, which means log to the file defined by the constant ADODB_ERROR_LOG_DEST. @@ -911,7 +911,7 @@ PEAR::setErrorHandling('PEAR_ERROR_DIE');

Data Source Names

We now support connecting using PEAR style DSN's. A DSN is a connection string of the form:

-

$dsn = "$driver:/* $username:$password@$hostname/$databasename";

*/ +

$dsn = "$driver://$username:$password@$hostname/$databasename";

You pass the DSN to the static class function DB::Connect. An example:

   include_once('../adodb/adodb-pear.inc.php');
    $username = 'root';
@@ -919,7 +919,7 @@ PEAR::setErrorHandling('PEAR_ERROR_DIE');
    $hostname = 'localhost';
    $databasename = 'xphplens';
    $driver = 'mysql';
-   $dsn = "$driver:/* $username:$password@$hostname/$databasename";
*/ + $dsn = "$driver://$username:$password@$hostname/$databasename";
   $db = DB::Connect($dsn);
$rs = $db->Execute('select firstname,lastname from adoxyz'); $cnt = 0; while ($arr = $rs->FetchRow()) { @@ -1074,7 +1074,7 @@ this.

 # $oraname in tnsnames.ora/ONAMES/HOSTNAMES
  $conn->Connect(false, 'scott', 'tiger', $oraname); 
  $conn->Connect('server:1521', 'scott', 'tiger', 'ServiceName'); # bypass tnsnames.ora
-

There are many examples of connecting to a database at php.weblogs.com/ADOdb, */ +

There are many examples of connecting to a database at php.weblogs.com/ADOdb, and in the testdatabases.inc.php file included in the release.

PConnect($host,[$user],[$password],[$database])

Persistent connect to data source or server $host, using userid $user @@ -1127,7 +1127,7 @@ $rs = $db->Execute('select name from table where val=:key',

Alternatively, since ADOdb 1.80, the $secs2cache parameter is optional:

	$conn->Connect(...);
-   	$conn->cacheSecs = 3600*24; /*  cache 24 hours */
+   	$conn->cacheSecs = 3600*24; // cache 24 hours
 	$rs = $conn->CacheExecute('select * from table');
 

If multiple calls to CacheExecute() are made and the recordset is still cached, @@ -1192,7 +1192,7 @@ $rs = $db->Execute('select name from table where val=:key',

Since 1.80, $secs2cache has been optional:

	$conn->Connect(...);
-   	$conn->cacheSecs = 3600*24; /*  cache 24 hours */
+   	$conn->cacheSecs = 3600*24; // cache 24 hours
 	$rs = $conn->CacheSelectLimit('select * from table',10);

CacheFlush($sql)

@@ -1200,7 +1200,7 @@ $rs = $db->Execute('select name from table where val=:key', If you want to flush all cached recordsets, execute the following PHP code (works only under Unix): system("rm -f `find ".ADODB_CACHE_DIR." -name ADODB_*.cache`");

-

For general cleanup of all expired files, you should use crontab */ +

For general cleanup of all expired files, you should use crontab on Unix, or at.exe on Windows, and a shell script similar to the following:

#------------------------------------------------------
@@ -1421,7 +1421,7 @@ for ($i=0; $i < $max; $i++)
$DB->Execute( [$isOutput] Indicates direction of parameter 0/false=IN 1=OUT 2= IN/OUT. This is ignored in oci8 as this driver auto-detects the direction.
[$maxLen] Maximum length of the parameter variable.
- [$type] Consult mssql_bind and ocibindbyname */ + [$type] Consult mssql_bind and ocibindbyname docs at php.net for more info on legal values for type.

In mssql, $opt can hold the following elements: array('type' => integer, maxLen =>integer). Example:

@@ -1901,12 +1901,12 @@ $rs = $conn->Execute

ADOConnection Fields to Set

canSeek: Set to true if the _seek function works.

ToDo:

-

See the RoadMap article.

*/ -

Also see the ADOdb proxy article */ +

See the RoadMap article.

+

Also see the ADOdb proxy article for bridging Windows and Unix databases using http remote procedure calls. For - your education, visit palslib.com for database info, */ + your education, visit palslib.com for database info, and read this article - on Optimizing PHP. */ + on Optimizing PHP.

Change Log

@@ -2023,7 +2023,7 @@ CacheSelectLimit(), the secs2cache is still compulsory - sigh. when supporting new ADODB_FETCH_MODEs.

Mattia Rossi (mattia#technologist.com) contributed BlobDecode() and UpdateBlobFile() for postgresql using the postgres specific pg_lo_import()/pg_lo_open() - i don't use them but hopefully others will - find this useful. See this posting */ + find this useful. See this posting for an example of usage.

Added UpdateBlobFile() for uploading files to a database.

Made UpdateBlob() compatible with oci8po driver. @@ -2181,7 +2181,7 @@ in MetaType() improved. MetaColumns() returns columns in correct sort order.

Cached recordset timestamp not saved in some scenarios. Fixed.

1.10 19 May 2001

Added caching. CacheExecute() and CacheSelectLimit(). -

Added csv driver. See http://php.weblogs.com/ADODB_csv. */ +

Added csv driver. See http://php.weblogs.com/ADODB_csv.

Fixed SelectLimit(), SELECT TOP not working under certain circumstances.

Added better Frontbase support of MetaTypes() by Frank M. Kromann.

1.01 24 April 2001

diff --git a/lib/adodb/server.php b/lib/adodb/server.php index b2697d1787..202ae5b3e9 100644 --- a/lib/adodb/server.php +++ b/lib/adodb/server.php @@ -31,13 +31,13 @@ $ACCEPTIP = ''; * Connection parameters */ $driver = 'mysql'; -$host = 'localhost'; /* DSN for odbc */ +$host = 'localhost'; // DSN for odbc $uid = 'root'; $pwd = ''; $database = 'northwind'; /*============================ DO NOT MODIFY BELOW HERE =================================*/ -/* $sep must match csv2rs() in adodb.inc.php */ +// $sep must match csv2rs() in adodb.inc.php $sep = ' :::: '; include('./adodb.inc.php'); @@ -48,11 +48,11 @@ function err($s) die('**** '.$s.' '); } -/* undo stupid magic quotes */ +// undo stupid magic quotes function undomq(&$m) { if (get_magic_quotes_gpc()) { - /* undo the damage */ + // undo the damage $m = str_replace('\\\\','\\',$m); $m = str_replace('\"','"',$m); $m = str_replace('\\\'','\'',$m); @@ -61,7 +61,7 @@ function undomq(&$m) return $m; } -/* /////////////////////////////////////// DEFINITIONS */ +///////////////////////////////////////// DEFINITIONS $remote = $HTTP_SERVER_VARS["REMOTE_ADDR"]; @@ -87,7 +87,7 @@ if (isset($HTTP_GET_VARS['nrows'])) { } else $rs = $conn->Execute($sql); if ($rs){ - /* $rs->timeToLive = 1; */ + //$rs->timeToLive = 1; echo _rs2serialize($rs,$conn,$sql); $rs->Close(); } else diff --git a/lib/adodb/tests/benchmark.php b/lib/adodb/tests/benchmark.php index e9e2eee9ac..0a3d1691b0 100644 --- a/lib/adodb/tests/benchmark.php +++ b/lib/adodb/tests/benchmark.php @@ -1,4 +1,4 @@ - */ + @@ -18,15 +18,15 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese It should not be used as proof of the superiority of one database over the other. */ -/* $testmssql = true; */ -/* $testvfp = true; */ +//$testmssql = true; +//$testvfp = true; $testoracle = true; -/* $testado = true; */ -/* $testibase = true; */ +//$testado = true; +//$testibase = true; $testaccess = true; $testmysql = true; -set_time_limit(240); /* increase timeout */ +set_time_limit(240); // increase timeout include("../tohtml.inc.php"); include("../adodb.inc.php"); @@ -42,20 +42,20 @@ GLOBAL $ADODB_version,$ADODB_FETCH_MODE; print "

ADODB Version: $ADODB_version Host: $db->host   Database: $db->database

"; - /* perform query once to cache results so we are only testing throughput */ + // perform query once to cache results so we are only testing throughput $rs = $db->Execute($sql); if (!$rs){ print "Error in recordset

"; return; } $arr = $rs->GetArray(); - /* $db->debug = true; */ + //$db->debug = true; $start = microtime(); for ($i=0; $i < $max; $i++) { $rs = $db->Execute($sql); $arr = $rs->GetArray(); - /* print $arr[0][1]; */ + // print $arr[0][1]; } $end = microtime(); $start = explode(' ',$start); @@ -64,7 +64,7 @@ GLOBAL $ADODB_version,$ADODB_FETCH_MODE; print_r($start); print_r($end); - /* print_r($arr); */ + // print_r($arr); $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]); printf ("

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

",$total,$max, sizeof($arr)); flush(); @@ -74,7 +74,7 @@ GLOBAL $ADODB_version,$ADODB_FETCH_MODE;
", diff --git a/lib/adodb/adodb-pear.inc.php b/lib/adodb/adodb-pear.inc.php index 71af9320b6..a057331640 100644 --- a/lib/adodb/adodb-pear.inc.php +++ b/lib/adodb/adodb-pear.inc.php @@ -140,7 +140,7 @@ class DB if (is_array($options) && isset($options["debug"]) && $options["debug"] >= 2) { - /* expose php errors with sufficient debug level */ + // expose php errors with sufficient debug level @include_once("adodb-$type.inc.php"); } else { @include_once("adodb-$type.inc.php"); @@ -251,8 +251,8 @@ class DB 'password' => false ); - /* Find phptype and dbsyntax */ - if (($pos = strpos($dsn, ':/* ')) !== false) { */ + // Find phptype and dbsyntax + if (($pos = strpos($dsn, '://')) !== false) { $str = substr($dsn, 0, $pos); $dsn = substr($dsn, $pos + 3); } else { @@ -260,8 +260,8 @@ class DB $dsn = NULL; } - /* Get phptype and dbsyntax */ - /* $str => phptype(dbsyntax) */ + // Get phptype and dbsyntax + // $str => phptype(dbsyntax) if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) { $parsed['phptype'] = $arr[1]; $parsed['dbsyntax'] = (empty($arr[2])) ? $arr[1] : $arr[2]; @@ -274,8 +274,8 @@ class DB return $parsed; } - /* Get (if found): username and password */ - /* $dsn => username:password@protocol+hostspec/database */ + // Get (if found): username and password + // $dsn => username:password@protocol+hostspec/database if (($at = strpos($dsn,'@')) !== false) { $str = substr($dsn, 0, $at); $dsn = substr($dsn, $at + 1); @@ -287,8 +287,8 @@ class DB } } - /* Find protocol and hostspec */ - /* $dsn => protocol+hostspec/database */ + // Find protocol and hostspec + // $dsn => protocol+hostspec/database if (($pos=strpos($dsn, '/')) !== false) { $str = substr($dsn, 0, $pos); $dsn = substr($dsn, $pos + 1); @@ -297,8 +297,8 @@ class DB $dsn = NULL; } - /* Get protocol + hostspec */ - /* $str => protocol+hostspec */ + // Get protocol + hostspec + // $str => protocol+hostspec if (($pos=strpos($str, '+')) !== false) { $parsed['protocol'] = substr($str, 0, $pos); $parsed['hostspec'] = urldecode(substr($str, $pos + 1)); @@ -306,8 +306,8 @@ class DB $parsed['hostspec'] = urldecode($str); } - /* Get dabase if any */ - /* $dsn => database */ + // Get dabase if any + // $dsn => database if (!empty($dsn)) { $parsed['database'] = $dsn; } diff --git a/lib/adodb/adodb-session.php b/lib/adodb/adodb-session.php index 9ec5d93cc6..ba830df369 100644 --- a/lib/adodb/adodb-session.php +++ b/lib/adodb/adodb-session.php @@ -73,16 +73,16 @@ GLOBAL $ADODB_SESSION_CONNECT, $ADODB_SESS_LIFE = get_cfg_var('session.gc_maxlifetime'); if ($ADODB_SESS_LIFE <= 1) { - /* bug in PHP 4.0.3 pl 1 -- how about other versions? */ - /* print "

Session Error: PHP.INI setting session.gc_maxlifetimenot set: $ADODB_SESS_LIFE

"; */ + // bug in PHP 4.0.3 pl 1 -- how about other versions? + //print "

Session Error: PHP.INI setting session.gc_maxlifetimenot set: $ADODB_SESS_LIFE

"; $ADODB_SESS_LIFE=1440; } $ADODB_SESSION_CRC = false; - /* $ADODB_SESS_DEBUG = true; */ + //$ADODB_SESS_DEBUG = true; - /* //////////////////////////////// */ + ////////////////////////////////// /* SET THE FOLLOWING PARAMETERS */ - /* //////////////////////////////// */ + ////////////////////////////////// if (empty($ADODB_SESSION_DRIVER)) { $ADODB_SESSION_DRIVER='mysql'; @@ -92,7 +92,7 @@ GLOBAL $ADODB_SESSION_CONNECT, $ADODB_SESSION_DB ='xphplens_2'; } - /* Made table name configurable - by David Johnson djohnson@inpro.net */ + // Made table name configurable - by David Johnson djohnson@inpro.net if (empty($ADODB_SESSION_TBL)){ $ADODB_SESSION_TBL = 'sessions'; } @@ -105,7 +105,7 @@ GLOBAL $ADODB_SESSION_CONNECT, function adodb_sess_open($save_path, $session_name,$persist=true) { GLOBAL $ADODB_SESS_CONN; - /* if( $persist) print "PERSIST "; */ + //if( $persist) print "PERSIST "; if (isset($ADODB_SESS_CONN)) return true; GLOBAL $ADODB_SESSION_CONNECT, @@ -115,7 +115,7 @@ GLOBAL $ADODB_SESSION_CONNECT, $ADODB_SESSION_DB, $ADODB_SESS_DEBUG; - /* cannot use & below - do not know why... */ + // cannot use & below - do not know why... $ADODB_SESS_CONN = ADONewConnection($ADODB_SESSION_DRIVER); if (!empty($ADODB_SESS_DEBUG)) { $ADODB_SESS_CONN->debug = true; @@ -158,14 +158,14 @@ global $ADODB_SESS_CONN,$ADODB_SESS_INSERT,$ADODB_SESSION_TBL,$ADODB_SESSION_CRC $rs->Close(); - /* new optimization adodb 2.1 */ + // new optimization adodb 2.1 $ADODB_SESSION_CRC = crc32($v); return $v; } else $ADODB_SESS_INSERT = true; - return ''; /* thx to Jorma Tuomainen, webmaster#wizactive.com */ + return ''; // thx to Jorma Tuomainen, webmaster#wizactive.com } /****************************************************************************************\ @@ -184,7 +184,7 @@ function adodb_sess_write($key, $val) $expiry = time() + $ADODB_SESS_LIFE; - /* new optimization adodb 2.1 */ + // new optimization adodb 2.1 if ($ADODB_SESSION_CRC !== false && $ADODB_SESSION_CRC == crc32($val)) { if ($ADODB_SESS_DEBUG) echo "

Session: No need to update - crc32 not changed

"; return true; @@ -201,8 +201,8 @@ function adodb_sess_write($key, $val) if ($rs) $rs->Close(); else print '

Session Insert: '.$ADODB_SESS_CONN->ErrorMsg().'

'; } - /* bug in access driver (could be odbc?) means that info is not commited */ - /* properly unless select statement executed in Win2000 */ + // bug in access driver (could be odbc?) means that info is not commited + // properly unless select statement executed in Win2000 if ($ADODB_SESS_CONN->databaseType == 'access') $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'"); return isset($rs); @@ -225,7 +225,7 @@ function adodb_sess_gc($maxlifetime) $rs = $ADODB_SESS_CONN->Execute($qry); if ($rs) $rs->Close(); - /* suggested by Cameron, "GaM3R" */ + // suggested by Cameron, "GaM3R" if (defined('ADODB_SESSION_OPTIMIZE')) { switch( $ADODB_SESSION_DRIVER ) { diff --git a/lib/adodb/adodb.inc.php b/lib/adodb/adodb.inc.php index b99eb18479..a499f6c595 100644 --- a/lib/adodb/adodb.inc.php +++ b/lib/adodb/adodb.inc.php @@ -20,9 +20,9 @@ if (!defined('_ADODB_LAYER')) { define('_ADODB_LAYER',1); - /* ============================================================================================== */ - /* CONSTANT DEFINITIONS */ - /* ============================================================================================== */ + //============================================================================================== + // CONSTANT DEFINITIONS + //============================================================================================== define('ADODB_BAD_RS','

Bad $rs in %s. Connection or SQL invalid. Try using $connection->debug=true;

'); @@ -31,9 +31,9 @@ define('ADODB_FETCH_ASSOC',2); define('ADODB_FETCH_BOTH',3); - /* allow [ ] @ and . in table names */ + // allow [ ] @ and . in table names define('ADODB_TABLE_REGEX','([]0-9a-z_\.\@\[-]*)'); - if (!defined('MAX_BLOB_SIZE')) define('MAX_BLOB_SIZE',999999); /* 900K */ + if (!defined('MAX_BLOB_SIZE')) define('MAX_BLOB_SIZE',999999); // 900K if (!defined('ADODB_PREFETCH_ROWS')) define('ADODB_PREFETCH_ROWS',10); @@ -44,42 +44,42 @@ if (!defined('ADODB_DIR')) define('ADODB_DIR',dirname(__FILE__)); if (strpos(strtoupper(PHP_OS),'WIN') !== false) { - /* windows, negative timestamps are illegal as of php 4.2.0 */ + // windows, negative timestamps are illegal as of php 4.2.0 define('TIMESTAMP_FIRST_YEAR',1970); } else define('TIMESTAMP_FIRST_YEAR',1904); - /* ============================================================================================== */ - /* GLOBAL VARIABLES */ - /* ============================================================================================== */ + //============================================================================================== + // GLOBAL VARIABLES + //============================================================================================== GLOBAL - $ADODB_vers, /* database version */ - $ADODB_Database, /* last database driver used */ - $ADODB_COUNTRECS, /* count number of records returned - slows down query */ - $ADODB_CACHE_DIR, /* directory to cache recordsets */ - $ADODB_FETCH_MODE; /* DEFAULT, NUM, ASSOC or BOTH. Default follows native driver default... */ + $ADODB_vers, // database version + $ADODB_Database, // last database driver used + $ADODB_COUNTRECS, // count number of records returned - slows down query + $ADODB_CACHE_DIR, // directory to cache recordsets + $ADODB_FETCH_MODE; // DEFAULT, NUM, ASSOC or BOTH. Default follows native driver default... - /* ============================================================================================== */ - /* GLOBAL SETUP */ - /* ============================================================================================== */ + //============================================================================================== + // GLOBAL SETUP + //============================================================================================== $ADODB_FETCH_MODE = ADODB_FETCH_DEFAULT; if (!isset($ADODB_CACHE_DIR)) { $ADODB_CACHE_DIR = '/tmp'; } else { - /* do not accept url based paths, eg. http:/ or ftp:/ */ - if (strpos($ADODB_CACHE_DIR,':/* ') !== false) */ - die("Illegal path http:/* or ftp://"); */ + // do not accept url based paths, eg. http:/ or ftp:/ + if (strpos($ADODB_CACHE_DIR,'://') !== false) + die("Illegal path http:// or ftp://"); } - /* ============================================================================================== */ - /* CHANGE NOTHING BELOW UNLESS YOU ARE CODING */ - /* ============================================================================================== */ + //============================================================================================== + // CHANGE NOTHING BELOW UNLESS YOU ARE CODING + //============================================================================================== - /* Initialize random number generator for randomizing cache flushes */ + // Initialize random number generator for randomizing cache flushes srand(((double)microtime())*1000000); /** @@ -99,9 +99,9 @@ */ $ADODB_COUNTRECS = true; - /* ============================================================================================== */ - /* CLASS ADOFieldObject */ - /* ============================================================================================== */ + //============================================================================================== + // CLASS ADOFieldObject + //============================================================================================== /** * Helper class for FetchFields -- holds info on a column @@ -111,20 +111,20 @@ var $max_length=0; var $type=""; - /* additional fields by dannym... (danny_milo@yahoo.com) */ + // additional fields by dannym... (danny_milo@yahoo.com) var $not_null = false; - /* actually, this has already been built-in in the postgres, fbsql AND mysql module? ^-^ */ - /* so we can as well make not_null standard (leaving it at "false" does not harm anyways) */ + // actually, this has already been built-in in the postgres, fbsql AND mysql module? ^-^ + // so we can as well make not_null standard (leaving it at "false" does not harm anyways) - var $has_default = false; /* this one I have done only in mysql and postgres for now ... */ - /* others to come (dannym) */ - var $default_value; /* default, if any, and supported. Check has_default first. */ + var $has_default = false; // this one I have done only in mysql and postgres for now ... + // others to come (dannym) + var $default_value; // default, if any, and supported. Check has_default first. } - /* ============================================================================================== */ - /* CLASS ADOConnection */ - /* ============================================================================================== */ + //============================================================================================== + // CLASS ADOConnection + //============================================================================================== /** * Connection object. For connecting to databases, and executing queries. @@ -134,58 +134,58 @@ * PUBLIC VARS */ var $dataProvider = 'native'; - var $databaseType = ''; /* RDBMS currently in use, eg. odbc, mysql, mssql */ - var $database = ''; /* Name of database to be used. */ - var $host = ''; /* The hostname of the database server */ - var $user = ''; /* The username which is used to connect to the database server. */ - var $password = ''; /* Password for the username */ - var $debug = false; /* if set to true will output sql statements */ - var $maxblobsize = 64000; /* maximum size of blobs or large text fields -- some databases die otherwise like foxpro */ - var $concat_operator = '+'; /* default concat operator -- change to || for Oracle/Interbase */ - var $fmtDate = "'Y-m-d'"; /* used by DBDate() as the default date format used by the database */ - var $fmtTimeStamp = "'Y-m-d, h:i:s A'"; /* used by DBTimeStamp as the default timestamp fmt. */ - var $true = '1'; /* string that represents TRUE for a database */ - var $false = '0'; /* string that represents FALSE for a database */ - var $replaceQuote = "\\'"; /* string to use to replace quotes */ - var $hasInsertID = false; /* supports autoincrement ID? */ - var $hasAffectedRows = false; /* supports affected rows for update/delete? */ - var $charSet=false; /* character set to use - only for interbase */ + var $databaseType = ''; // RDBMS currently in use, eg. odbc, mysql, mssql + var $database = ''; // Name of database to be used. + var $host = ''; // The hostname of the database server + var $user = ''; // The username which is used to connect to the database server. + var $password = ''; // Password for the username + var $debug = false; // if set to true will output sql statements + var $maxblobsize = 64000; // maximum size of blobs or large text fields -- some databases die otherwise like foxpro + var $concat_operator = '+'; // default concat operator -- change to || for Oracle/Interbase + var $fmtDate = "'Y-m-d'"; // used by DBDate() as the default date format used by the database + var $fmtTimeStamp = "'Y-m-d, h:i:s A'"; // used by DBTimeStamp as the default timestamp fmt. + var $true = '1'; // string that represents TRUE for a database + var $false = '0'; // string that represents FALSE for a database + var $replaceQuote = "\\'"; // string to use to replace quotes + var $hasInsertID = false; // supports autoincrement ID? + var $hasAffectedRows = false; // supports affected rows for update/delete? + var $charSet=false; // character set to use - only for interbase var $metaTablesSQL = ''; - var $hasTop = false; /* support mssql/access SELECT TOP 10 * FROM TABLE */ - var $hasLimit = false; /* support pgsql/mysql SELECT * FROM TABLE LIMIT 10 */ - var $readOnly = false; /* this is a readonly database - used by phpLens */ - var $hasMoveFirst = false; /* has ability to run MoveFirst(), scrolling backwards */ - var $hasGenID = false; /* can generate sequences using GenID(); */ - var $genID = 0; /* sequence id used by GenID(); */ - var $raiseErrorFn = false; /* error function to call */ - var $upperCase = false; /* uppercase function to call for searching/where */ - var $isoDates = false; /* accepts dates in ISO format */ - var $cacheSecs = 3600; /* cache for 1 hour */ - var $sysDate = false; /* name of function that returns the current date */ - var $sysTimeStamp = false; /* name of function that returns the current timestamp */ + var $hasTop = false; // support mssql/access SELECT TOP 10 * FROM TABLE + var $hasLimit = false; // support pgsql/mysql SELECT * FROM TABLE LIMIT 10 + var $readOnly = false; // this is a readonly database - used by phpLens + var $hasMoveFirst = false; // has ability to run MoveFirst(), scrolling backwards + var $hasGenID = false; // can generate sequences using GenID(); + var $genID = 0; // sequence id used by GenID(); + var $raiseErrorFn = false; // error function to call + var $upperCase = false; // uppercase function to call for searching/where + var $isoDates = false; // accepts dates in ISO format + var $cacheSecs = 3600; // cache for 1 hour + var $sysDate = false; // name of function that returns the current date + var $sysTimeStamp = false; // name of function that returns the current timestamp var $arrayClass = 'ADORecordSet_array'; - /* oracle specific stuff */ + // oracle specific stuff var $noNullStrings = false; var $numCacheHits = 0; var $numCacheMisses = 0; var $pageExecuteCountRows = true; - var $uniqueSort = false; /* indicates that all fields in order by must be unique */ + var $uniqueSort = false; // indicates that all fields in order by must be unique /* * PRIVATE VARS */ - var $_connectionID = false; /* The returned link identifier whenever a successful database connection is made. */ */ + var $_connectionID = false; // The returned link identifier whenever a successful database connection is made. */ - var $_errorMsg = ''; /* A variable which was used to keep the returned last error message. The value will */ - /* then returned by the errorMsg() function */ + var $_errorMsg = ''; // A variable which was used to keep the returned last error message. The value will + //then returned by the errorMsg() function - var $_queryID = false; /* This variable keeps the last created result link identifier. */ */ + var $_queryID = false; // This variable keeps the last created result link identifier. */ - var $_isPersistentConnection = false; /* A boolean variable to state whether its a persistent connection or normal connection. */ */ + var $_isPersistentConnection = false; // A boolean variable to state whether its a persistent connection or normal connection. */ - var $_bindInputArray = false; /* set to true if ADOConnection.Execute() permits binding of array parameters. */ + var $_bindInputArray = false; // set to true if ADOConnection.Execute() permits binding of array parameters. - var $autoCommit = true; /* do not modify this yourself - actually private */ + var $autoCommit = true; // do not modify this yourself - actually private /** * Constructor @@ -210,7 +210,7 @@ { if ($argHostname != "") $this->host = $argHostname; if ($argUsername != "") $this->user = $argUsername; - if ($argPassword != "") $this->password = $argPassword; /* not stored for security reasons */ + if ($argPassword != "") $this->password = $argPassword; // not stored for security reasons if ($argDatabaseName != "") $this->database = $argDatabaseName; $this->_isPersistentConnection = false; @@ -381,7 +381,7 @@ */ function &LimitQuery($sql, $offset, $count) { - $rs = &$this->SelectLimit($sql, $count, $offset); /* swap */ + $rs = &$this->SelectLimit($sql, $count, $offset); // swap if (!$rs && defined('ADODB_PEAR')) return ADODB_PEAR_Error(); return $rs; } @@ -432,8 +432,8 @@ foreach($inputarr as $v) { $sql .= $sqlarr[$i]; - /* from Ron Baldwin */ - /* Only quote string types */ + // from Ron Baldwin + // Only quote string types if (gettype($v) == 'string') $sql .= $this->qstr($v); else if ($v === null) @@ -449,7 +449,7 @@ $inputarr = false; } - /* debug version of query */ + // debug version of query if ($this->debug) { global $HTTP_SERVER_VARS; @@ -464,7 +464,7 @@ if (is_array($sql)) $sqlTxt = $sql[0]; else $sqlTxt = $sql; - /* check if running from browser or command-line */ + // check if running from browser or command-line $inBrowser = isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']); if ($inBrowser) @@ -480,8 +480,8 @@ because ErrorNo() calls Execute('SELECT @ERROR'), causing recure */ if ($this->databaseType == 'mssql') { - /* ErrorNo is a slow function call in mssql, and not reliable */ - /* in PHP 4.0.6 */ + // ErrorNo is a slow function call in mssql, and not reliable + // in PHP 4.0.6 if($emsg = $this->ErrorMsg()) { $err = $this->ErrorNo(); if ($err) { @@ -495,25 +495,25 @@ flush(); } } else - /* non-debug version of query */ + // non-debug version of query $this->_queryID =@$this->_query($sql,$inputarr,$arg3); - /* error handling if query fails */ + // error handling if query fails if ($this->_queryID === false) { if ($fn = $this->raiseErrorFn) { $fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,$inputarr); } return false; } else if ($this->_queryID === true){ - /* return simplified empty recordset for inserts/updates/deletes with lower overhead */ + // return simplified empty recordset for inserts/updates/deletes with lower overhead $rs = new ADORecordSet_empty(); return $rs; } - /* return real recordset from select statement */ + // return real recordset from select statement $rsclass = "ADORecordSet_".$this->databaseType; - $rs = new $rsclass($this->_queryID); /* &new not supported by older PHP versions */ - $rs->connection = &$this; /* Pablo suggestion */ + $rs = new $rsclass($this->_queryID); // &new not supported by older PHP versions + $rs->connection = &$this; // Pablo suggestion $rs->Init(); if (is_array($sql)) $rs->sql = $sql[0]; @@ -540,7 +540,7 @@ function GenID($seqname='adodbseq',$startID=1) { if (!$this->hasGenID) { - return 0; /* formerly returns false pre 1.60 */ + return 0; // formerly returns false pre 1.60 } $getnext = sprintf($this->_genIDSQL,$seqname); @@ -551,7 +551,7 @@ $rs = $this->Execute($getnext); } if ($rs && !$rs->EOF) $this->genID = (integer) reset($rs->fields); - else $this->genID = 0; /* false */ + else $this->genID = 0; // false if ($rs) $rs->Close(); @@ -660,7 +660,7 @@ function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$arg3=false,$secs2cache=0) { if ($this->hasTop && $nrows > 0) { - /* suggested by Reinhard Balling. Access requires top after distinct */ + // suggested by Reinhard Balling. Access requires top after distinct if ($offset <= 0) { $sql = preg_replace( @@ -677,8 +677,8 @@ } - /* if $offset>0, we want to skip rows, and $ADODB_COUNTRECS is set, we buffer rows */ - /* 0 to offset-1 which will be discarded anyway. So we disable $ADODB_COUNTRECS. */ + // if $offset>0, we want to skip rows, and $ADODB_COUNTRECS is set, we buffer rows + // 0 to offset-1 which will be discarded anyway. So we disable $ADODB_COUNTRECS. global $ADODB_COUNTRECS; $savec = $ADODB_COUNTRECS; @@ -696,7 +696,7 @@ if ($rs && !$rs->EOF) { return $this->_rs2rs($rs,$nrows,$offset); } - /* print_r($rs); */ + //print_r($rs); return $rs; } @@ -813,7 +813,7 @@ $v = $this->qstr($v); $fieldArray[$k] = $v; } - if (in_array($k,$keyCol)) continue; /* skip UPDATE if is key */ + if (in_array($k,$keyCol)) continue; // skip UPDATE if is key if ($first) { $first = false; @@ -879,7 +879,7 @@ if (!is_numeric($secs2cache)) { if ($sql === false) $sql = -1; if ($offset == -1) $offset = false; - /* sql, nrows, offset,inputarr,arg3 */ + // sql, nrows, offset,inputarr,arg3 return $this->SelectLimit($secs2cache,$sql,$nrows,$offset,$inputarr,$this->cacheSecs); } if ($sql === false) echo "Warning: \$sql missing from CacheSelectLimit()
\n"; @@ -890,7 +890,7 @@ function CacheFlush($sql) { $f = $this->_gencachename($sql,false); - adodb_write_file($f,''); /* is adodb_write_file needed? */ + adodb_write_file($f,''); // is adodb_write_file needed? @unlink($f); } @@ -927,7 +927,7 @@ $secs2cache = $this->cacheSecs; } include_once(ADODB_DIR.'/adodb-csvlib.inc.php'); - /* cannot cache if $inputarr set */ + // cannot cache if $inputarr set if ($inputarr) return $this->Execute($sql, $inputarr, $arg3); $md5file = $this->_gencachename($sql,true); @@ -943,13 +943,13 @@ } if (!$rs) { - /* no cached rs found */ + // no cached rs found if ($this->debug) print " $md5file cache failure: $err
\n"; $rs = &$this->Execute($sql,$inputarr,$arg3); if ($rs) { $eof = $rs->EOF; - $rs = &$this->_rs2rs($rs); /* read entire recordset into memory immediately */ - $txt = _rs2serialize($rs,false,$sql); /* serialize */ + $rs = &$this->_rs2rs($rs); // read entire recordset into memory immediately + $txt = _rs2serialize($rs,false,$sql); // serialize if (!adodb_write_file($md5file,$txt,$this->debug)) { if ($fn = $this->raiseErrorFn) { @@ -959,15 +959,15 @@ } if ($rs->EOF && !$eof) { $rs->MoveFirst(); - /* $rs = &csv2rs($md5file,$err); */ - $rs->connection = &$this; /* Pablo suggestion */ + //$rs = &csv2rs($md5file,$err); + $rs->connection = &$this; // Pablo suggestion } } else @unlink($md5file); } else { - /* ok, set cached object found */ - $rs->connection = &$this; /* Pablo suggestion */ + // ok, set cached object found + $rs->connection = &$this; // Pablo suggestion if ($this->debug){ $ttl = $rs->timeCreated + $secs2cache - time(); print " $md5file reloaded, ttl=$ttl
\n"; @@ -1099,7 +1099,7 @@ */ function CharMax() { - return 255; /* make it conservative if not defined */ + return 255; // make it conservative if not defined } @@ -1108,7 +1108,7 @@ */ function TextMax() { - return 4000; /* make it conservative if not defined */ + return 4000; // make it conservative if not defined } @@ -1119,10 +1119,10 @@ { return $this->_close(); - /* "Simon Lee" reports that persistent connections need */ - /* to be closed too! */ - /* if ($this->_isPersistentConnection != true) return $this->_close(); */ - /* else return true; */ + // "Simon Lee" reports that persistent connections need + // to be closed too! + //if ($this->_isPersistentConnection != true) return $this->_close(); + //else return true; } @@ -1210,7 +1210,7 @@ if ($rs === false) return false; $retarr = array(); - while (!$rs->EOF) { /* print_r($rs->fields); */ + while (!$rs->EOF) { //print_r($rs->fields); $fld = new ADOFieldObject(); $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; @@ -1309,7 +1309,7 @@ ($v), $rr)) return false; if ($rr[1] <= TIMESTAMP_FIRST_YEAR) return 0; - /* h-m-s-MM-DD-YY */ + // h-m-s-MM-DD-YY return mktime(0,0,0,$rr[2],$rr[3],$rr[1]); } @@ -1327,7 +1327,7 @@ ($v), $rr)) return false; if ($rr[1] <= TIMESTAMP_FIRST_YEAR && $rr[2]<= 1) return 0; - /* h-m-s-MM-DD-YY */ + // h-m-s-MM-DD-YY return @mktime($rr[5],$rr[6],$rr[7],$rr[2],$rr[3],$rr[1]); } @@ -1353,12 +1353,12 @@ return "'".str_replace("'",$this->replaceQuote,$s)."'"; } - /* undo magic quotes for " */ + // undo magic quotes for " $s = str_replace('\\"','"',$s); - if ($this->replaceQuote == "\\'") /* ' already quoted, no need to change anything */ + if ($this->replaceQuote == "\\'") // ' already quoted, no need to change anything return "'$s'"; - else {/* change \' to '' for sybase/mssql */ + else {// change \' to '' for sybase/mssql $s = str_replace('\\\\','\\',$s); return "'".str_replace("\\'",$this->replaceQuote,$s)."'"; } @@ -1409,13 +1409,13 @@ return $this->PageExecute($sql,$nrows,$page,$inputarr,$arg3,$secs2cache); } -} /* end class ADOConnection */ +} // end class ADOConnection - /* ============================================================================================== */ - /* CLASS ADOFetchObj */ - /* ============================================================================================== */ + //============================================================================================== + // CLASS ADOFetchObj + //============================================================================================== /** * Internal placeholder for record objects. Used by ADORecordSet->FetchObj(). @@ -1423,9 +1423,9 @@ class ADOFetchObj { }; - /* ============================================================================================== */ - /* CLASS ADORecordSet_empty */ - /* ============================================================================================== */ + //============================================================================================== + // CLASS ADORecordSet_empty + //============================================================================================== /** * Lightweight recordset when there are no records to be returned @@ -1445,9 +1445,9 @@ function FieldCount(){ return 0;} } - /* ============================================================================================== */ - /* CLASS ADORecordSet */ - /* ============================================================================================== */ + //============================================================================================== + // CLASS ADORecordSet + //============================================================================================== /** * RecordSet class that represents the dataset returned by the database. @@ -1460,21 +1460,21 @@ * public variables */ var $dataProvider = "native"; - var $fields = false; /* holds the current row data */ - var $blobSize = 64; /* any varchar/char field this size or greater is treated as a blob */ - /* in other words, we use a text area for editting. */ - var $canSeek = false; /* indicates that seek is supported */ - var $sql; /* sql text */ + var $fields = false; // holds the current row data + var $blobSize = 64; // any varchar/char field this size or greater is treated as a blob + // in other words, we use a text area for editting. + var $canSeek = false; // indicates that seek is supported + var $sql; // sql text var $EOF = false; /* Indicates that the current record position is after the last record in a Recordset object. */ - var $emptyTimeStamp = ' '; /* what to display when $time==0 */ - var $emptyDate = ' '; /* what to display when $time==0 */ + var $emptyTimeStamp = ' '; // what to display when $time==0 + var $emptyDate = ' '; // what to display when $time==0 var $debug = false; - var $timeCreated=0; /* datetime in Unix format rs created -- for cached recordsets */ + var $timeCreated=0; // datetime in Unix format rs created -- for cached recordsets - var $bind = false; /* used by Fields() to hold array - should be private? */ - var $fetchMode; /* default fetch mode */ - var $connection = false; /* the parent connection */ + var $bind = false; // used by Fields() to hold array - should be private? + var $fetchMode; // default fetch mode + var $connection = false; // the parent connection /* * private variables */ @@ -1664,16 +1664,16 @@ } } } else { - /* return scalar values */ + // return scalar values if ($numIndex) { while (!$this->EOF) { - /* some bug in mssql PHP 4.02 -- doesn't handle references properly so we FORCE creating a new string */ + // some bug in mssql PHP 4.02 -- doesn't handle references properly so we FORCE creating a new string $results[trim(($this->fields[0]))] = $this->fields[1]; $this->MoveNext(); } } else { while (!$this->EOF) { - /* some bug in mssql PHP 4.02 -- doesn't handle references properly so we FORCE creating a new string */ + // some bug in mssql PHP 4.02 -- doesn't handle references properly so we FORCE creating a new string $v1 = trim(reset($this->fields)); $v2 = ''.next($this->fields); $results[$v1] = $v2; @@ -1695,7 +1695,7 @@ function UserTimeStamp($v,$fmt='Y-m-d H:i:s') { $tt = $this->UnixTimeStamp($v); - /* $tt == -1 if pre TIMESTAMP_FIRST_YEAR */ + // $tt == -1 if pre TIMESTAMP_FIRST_YEAR if (($tt === false || $tt == -1) && $v != false) return $v; if ($tt == 0) return $this->emptyTimeStamp; @@ -1712,10 +1712,10 @@ function UserDate($v,$fmt='Y-m-d') { $tt = $this->UnixDate($v); - /* $tt == -1 if pre TIMESTAMP_FIRST_YEAR */ + // $tt == -1 if pre TIMESTAMP_FIRST_YEAR if (($tt === false || $tt == -1) && $v != false) return $v; else if ($tt == 0) return $this->emptyDate; - else if ($tt == -1) { /* pre-TIMESTAMP_FIRST_YEAR */ + else if ($tt == -1) { // pre-TIMESTAMP_FIRST_YEAR } return date($fmt,$tt); @@ -1733,7 +1733,7 @@ ($v), $rr)) return false; if ($rr[1] <= 1903) return 0; - /* h-m-s-MM-DD-YY */ + // h-m-s-MM-DD-YY return mktime(0,0,0,$rr[2],$rr[3],$rr[1]); } @@ -1750,7 +1750,7 @@ ($v), $rr)) return false; if ($rr[1] <= 1903 && $rr[2]<= 1) return 0; - /* h-m-s-MM-DD-YY */ + // h-m-s-MM-DD-YY return @mktime($rr[5],$rr[6],$rr[7],$rr[2],$rr[3],$rr[1]); } @@ -1808,7 +1808,7 @@ if ($this->EOF) return (defined('PEAR_ERROR_RETURN')) ? new PEAR_Error('EOF',-1): false; $arr = $this->fields; $this->MoveNext(); - return 1; /* DB_OK */ + return 1; // DB_OK } @@ -1878,7 +1878,7 @@ $this->_currentRow = $rowNumber; if ($this->_fetch()) { $this->EOF = false; - /* $this->_currentRow += 1; */ + // $this->_currentRow += 1; return true; } } else @@ -1946,9 +1946,9 @@ */ function Close() { - /* free connection object - this seems to globally free the object */ - /* and not merely the reference, so don't do this... */ - /* $this->connection = false; */ + // free connection object - this seems to globally free the object + // and not merely the reference, so don't do this... + // $this->connection = false; if (!$this->_closed) { $this->_closed = true; return $this->_close(); @@ -1992,7 +1992,7 @@ function PO_RecordCount($table="", $condition="") { $lnumrows = $this->_numOfRows; - /* the database doesn't support native recordcount, so we do a workaround */ + // the database doesn't support native recordcount, so we do a workaround if ($lnumrows == -1 && $this->connection) { IF ($table) { if ($condition) $condition = " WHERE " . $condition; @@ -2031,7 +2031,7 @@ */ function &FetchField($fieldoffset) { - /* must be defined by child class */ + // must be defined by child class } /** @@ -2221,11 +2221,11 @@ if ($status != false) $this->_atLastPage = $status; return $this->_atLastPage; } -} /* end class ADORecordSet */ +} // end class ADORecordSet - /* ============================================================================================== */ - /* CLASS ADORecordSet_array */ - /* ============================================================================================== */ + //============================================================================================== + // CLASS ADORecordSet_array + //============================================================================================== /** * This class encapsulates the concept of a recordset created in memory @@ -2238,11 +2238,11 @@ { var $databaseType = "array"; - var $_array; /* holds the 2-dimensional data array */ - var $_types; /* the array of types of each column (C B I L M) */ - var $_colnames; /* names of each column in array */ - var $_skiprow1; /* skip 1st row because it holds column names */ - var $_fieldarr; /* holds array of field objects */ + var $_array; // holds the 2-dimensional data array + var $_types; // the array of types of each column (C B I L M) + var $_colnames; // names of each column in array + var $_skiprow1; // skip 1st row because it holds column names + var $_fieldarr; // holds array of field objects var $canSeek = true; var $affectedrows = false; var $insertid = false; @@ -2255,7 +2255,7 @@ { global $ADODB_FETCH_MODE; - $this->ADORecordSet($fakeid); /* fake queryID */ + $this->ADORecordSet($fakeid); // fake queryID $this->fetchMode = $ADODB_FETCH_MODE; } @@ -2333,7 +2333,7 @@ $o = new ADOFieldObject(); $o->name = $this->_colnames[$fieldOffset]; $o->type = $this->_types[$fieldOffset]; - $o->max_length = -1; /* length not known */ + $o->max_length = -1; // length not known return $o; } @@ -2363,11 +2363,11 @@ return true; } - } /* ADORecordSet_array */ + } // ADORecordSet_array - /* ============================================================================================== */ - /* HELPER FUNCTIONS */ - /* ============================================================================================== */ + //============================================================================================== + // HELPER FUNCTIONS + //============================================================================================== /** * Synonym for ADOLoadCode. @@ -2436,7 +2436,7 @@ */ function adodb_write_file($filename, $contents,$debug=false) { - # http:/* www.php.net/bugs.php?id=9203 Bug that flock fails on Windows */ + # http://www.php.net/bugs.php?id=9203 Bug that flock fails on Windows # So to simulate locking, we assume that rename is an atomic operation. # First we delete $filename, then we create a $tempfile write to it and # rename to the desired $filename. If the rename works, then we successfully @@ -2448,11 +2448,11 @@ # 3. adodb reads stale file because unlink fails -- ok, $rs timeout occurs # 4. another process creates $filename between unlink() and rename() -- ok, rename() fails and cache updated if (strpos(strtoupper(PHP_OS),'WIN') !== false) { - /* skip the decimal place */ + // skip the decimal place $mtime = substr(str_replace(' ','_',microtime()),2); - /* unlink will let some latencies develop, so uniqid() is more random */ + // unlink will let some latencies develop, so uniqid() is more random @unlink($filename); - /* getmypid() actually returns 0 on Win98 - never mind! */ + // getmypid() actually returns 0 on Win98 - never mind! $tmpname = $filename.uniqid($mtime).getmypid(); if (!($fd = fopen($tmpname,'a'))) return false; $ok = ftruncate($fd,0); @@ -2482,5 +2482,5 @@ return $ok; } -} /* defined */ +} // defined ?> \ No newline at end of file diff --git a/lib/adodb/crypt.inc.php b/lib/adodb/crypt.inc.php index a84b6371b0..deb9c22347 100644 --- a/lib/adodb/crypt.inc.php +++ b/lib/adodb/crypt.inc.php @@ -1,5 +1,5 @@ */ +// Session Encryption by Ari Kuorikoski class MD5Crypt{ function keyED($txt,$encrypt_key){ $encrypt_key = md5($encrypt_key); diff --git a/lib/adodb/drivers/adodb-access.inc.php b/lib/adodb/drivers/adodb-access.inc.php index 21bdb78b6b..0e5074308e 100644 --- a/lib/adodb/drivers/adodb-access.inc.php +++ b/lib/adodb/drivers/adodb-access.inc.php @@ -18,10 +18,10 @@ if (!defined('_ADODB_ODBC_LAYER')) { class ADODB_access extends ADODB_odbc { var $databaseType = 'access'; - var $hasTop = 'top'; /* support mssql SELECT TOP 10 * FROM TABLE */ + var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE var $fmtDate = "#Y-m-d#"; - var $fmtTimeStamp = "#Y-m-d h:i:sA#"; /* note not comma */ - var $_bindInputArray = false; /* strangely enough, setting to true does not work reliably */ + var $fmtTimeStamp = "#Y-m-d h:i:sA#"; // note not comma + var $_bindInputArray = false; // strangely enough, setting to true does not work reliably var $sysDate = "FORMAT(NOW,'yyyy-mm-dd')"; var $sysTimeStamp = 'NOW'; @@ -66,5 +66,5 @@ class ADORecordSet_access extends ADORecordSet_odbc { return $this->ADORecordSet_odbc($id); } } -} /* class */ +} // class ?> \ No newline at end of file diff --git a/lib/adodb/drivers/adodb-ado.inc.php b/lib/adodb/drivers/adodb-ado.inc.php index 83c822bfa5..f458d1fe02 100644 --- a/lib/adodb/drivers/adodb-ado.inc.php +++ b/lib/adodb/drivers/adodb-ado.inc.php @@ -19,15 +19,15 @@ class ADODB_ado extends ADOConnection { var $_bindInputArray = false; var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d, h:i:sA'"; - var $replaceQuote = "''"; /* string to use to replace quotes */ + var $replaceQuote = "''"; // string to use to replace quotes var $dataProvider = "ado"; var $hasAffectedRows = true; - var $adoParameterType = 201; /* 201 = long varchar, 203=long wide varchar, 205 = long varbinary */ + var $adoParameterType = 201; // 201 = long varchar, 203=long wide varchar, 205 = long varbinary var $_affectedRows = false; var $_thisTransactions; var $_inTransaction = 0; - var $_cursor_type = 3; /* 3=adOpenStatic,0=adOpenForwardOnly,1=adOpenKeyset,2=adOpenDynamic */ - var $_cursor_location = 3; /* 2=adUseServer, 3 = adUseClient; */ + var $_cursor_type = 3; // 3=adOpenStatic,0=adOpenForwardOnly,1=adOpenKeyset,2=adOpenDynamic + var $_cursor_location = 3; // 2=adUseServer, 3 = adUseClient; var $_lock_type = -1; var $_execute_option = -1; @@ -42,9 +42,9 @@ class ADODB_ado extends ADOConnection { return $this->_affectedRows; } - /* you can also pass a connection string like this: */ - /* */ - /* $DB->Connect('USER ID=sa;PASSWORD=pwd;SERVER=mangrove;DATABASE=ai',false,false,'SQLOLEDB'); */ + // you can also pass a connection string like this: + // + // $DB->Connect('USER ID=sa;PASSWORD=pwd;SERVER=mangrove;DATABASE=ai',false,false,'SQLOLEDB'); function _connect($argHostname, $argUsername, $argPassword, $argProvider= 'MSDASQL') { $u = 'UID'; @@ -55,17 +55,17 @@ class ADODB_ado extends ADOConnection { /* special support if provider is mssql or access */ if ($argProvider=='mssql') { - $u = 'User Id'; /* User parameter name for OLEDB */ + $u = 'User Id'; //User parameter name for OLEDB $p = 'Password'; - $argProvider = "SQLOLEDB"; /* SQL Server Provider */ + $argProvider = "SQLOLEDB"; // SQL Server Provider - /* not yet */ - /* if ($argDatabasename) $argHostname .= ";Initial Catalog=$argDatabasename"; */ + // not yet + //if ($argDatabasename) $argHostname .= ";Initial Catalog=$argDatabasename"; - /* use trusted conection for SQL if username not specified */ + //use trusted conection for SQL if username not specified if (!$argUsername) $argHostname .= ";Trusted_Connection=Yes"; } else if ($argProvider=='access') - $argProvider = "Microsoft.Jet.OLEDB.4.0"; /* Microsoft Jet Provider */ + $argProvider = "Microsoft.Jet.OLEDB.4.0"; // Microsoft Jet Provider if ($argProvider) $dbc->Provider = $argProvider; @@ -73,7 +73,7 @@ class ADODB_ado extends ADOConnection { if ($argPassword)$argHostname .= ";$p=$argPassword"; if ($this->debug) print "

Host=".$argHostname."
version=$dbc->version

"; - /* @ added below for php 4.0.1 and earlier */ + // @ added below for php 4.0.1 and earlier @$dbc->Open((string) $argHostname); $this->_connectionID = $dbc; @@ -82,7 +82,7 @@ class ADODB_ado extends ADOConnection { return $dbc->State > 0; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argProvider='MSDASQL') { return $this->_connect($argHostname,$argUsername,$argPassword,$argProvider); @@ -135,15 +135,15 @@ class ADODB_ado extends ADOConnection { $arr= array(); $dbc = $this->_connectionID; - $adors=@$dbc->OpenSchema(20);/* tables */ + $adors=@$dbc->OpenSchema(20);//tables if ($adors){ - $f = $adors->Fields(2);/* table/view name */ - $t = $adors->Fields(3);/* table type */ + $f = $adors->Fields(2);//table/view name + $t = $adors->Fields(3);//table type while (!$adors->EOF){ $tt=substr($t->value,0,6); if ($tt!='SYSTEM' && $tt !='ACCESS') $arr[]=$f->value; - /* print $f->value . ' ' . $t->value.'
'; */ + //print $f->value . ' ' . $t->value.'
'; $adors->MoveNext(); } $adors->Close(); @@ -158,10 +158,10 @@ class ADODB_ado extends ADOConnection { $arr= array(); $dbc = $this->_connectionID; - $adors=@$dbc->OpenSchema(4);/* tables */ + $adors=@$dbc->OpenSchema(4);//tables if ($adors){ - $t = $adors->Fields(2);/* table/view name */ + $t = $adors->Fields(2);//table/view name while (!$adors->EOF){ @@ -170,7 +170,7 @@ class ADODB_ado extends ADOConnection { $fld = new ADOFieldObject(); $c = $adors->Fields(3); $fld->name = $c->Value; - $fld->type = 'CHAR'; /* cannot discover type in ADO! */ + $fld->type = 'CHAR'; // cannot discover type in ADO! $fld->max_length = -1; $arr[strtoupper($fld->name)]=$fld; } @@ -189,7 +189,7 @@ class ADODB_ado extends ADOConnection { $dbc = $this->_connectionID; - /* return rs */ + // return rs if ($inputarr) { $oCmd = new COM('ADODB.Command'); $oCmd->ActiveConnection = $dbc; @@ -197,10 +197,10 @@ class ADODB_ado extends ADOConnection { $oCmd->CommandType = 1; foreach($inputarr as $val) { - /* name, type, direction 1 = input, len, */ + // name, type, direction 1 = input, len, $this->adoParameterType = 130; $p = $oCmd->CreateParameter('name',$this->adoParameterType,1,strlen($val),$val); - /* print $p->Type.' '.$p->value; */ + //print $p->Type.' '.$p->value; $oCmd->Parameters->Append($p); } $p = false; @@ -220,7 +220,7 @@ class ADODB_ado extends ADOConnection { if ($dbc->Errors->Count > 0) return false; if (! $rs) return false; - if ($rs->State == 0) return true; /* 0 = adStateClosed means no records returned */ + if ($rs->State == 0) return true; // 0 = adStateClosed means no records returned return $rs; } @@ -269,7 +269,7 @@ class ADODB_ado extends ADOConnection { return $err->NativeError; } - /* returns true or false */ + // returns true or false function _close() { if ($this->_connectionID) $this->_connectionID->Close(); @@ -289,8 +289,8 @@ class ADORecordSet_ado extends ADORecordSet { var $bind = false; var $databaseType = "ado"; var $dataProvider = "ado"; - var $_tarr = false; /* caches the types */ - var $_flds; /* and field objects */ + var $_tarr = false; // caches the types + var $_flds; // and field objects var $canSeek = true; var $hideErrors = true; @@ -303,9 +303,9 @@ class ADORecordSet_ado extends ADORecordSet { } - /* returns the field object */ + // returns the field object function FetchField($fieldOffset = -1) { - $off=$fieldOffset+1; /* offsets begin at 1 */ + $off=$fieldOffset+1; // offsets begin at 1 $o= new ADOFieldObject(); $rs = $this->_queryID; @@ -317,7 +317,7 @@ class ADORecordSet_ado extends ADORecordSet { $o->ado_type = $t; - /* print "off=$off name=$o->name type=$o->type len=$o->max_length
"; */ + //print "off=$off name=$o->name type=$o->type len=$o->max_length
"; return $o; } @@ -347,15 +347,15 @@ class ADORecordSet_ado extends ADORecordSet { } - /* should only be used to move forward as we normally use forward-only cursors */ + // should only be used to move forward as we normally use forward-only cursors function _seek($row) { $rs = $this->_queryID; - /* absoluteposition doesn't work -- my maths is wrong ? */ - /* $rs->AbsolutePosition->$row-2; */ - /* return true; */ + // absoluteposition doesn't work -- my maths is wrong ? + // $rs->AbsolutePosition->$row-2; + // return true; if ($this->_currentRow > $row) return false; - @$rs->Move((integer)$row - $this->_currentRow-1); /* adBookmarkFirst */ + @$rs->Move((integer)$row - $this->_currentRow-1); //adBookmarkFirst return true; } @@ -447,15 +447,15 @@ class ADORecordSet_ado extends ADORecordSet { switch ($t) { case 0: - case 12: /* variant */ - case 8: /* bstr */ - case 129: /* char */ - case 130: /* wc */ - case 200: /* varc */ - case 202:/* varWC */ - case 128: /* bin */ - case 204: /* varBin */ - case 72: /* guid */ + case 12: // variant + case 8: // bstr + case 129: //char + case 130: //wc + case 200: // varc + case 202:// varWC + case 128: // bin + case 204: // varBin + case 72: // guid if ($len <= $this->blobSize) return 'C'; case 201: @@ -473,20 +473,20 @@ class ADORecordSet_ado extends ADORecordSet { case 11: return 'L'; - case 16:/* adTinyInt = 16, */ - case 2:/* adSmallInt = 2, */ - case 3:/* adInteger = 3, */ - case 4:/* adBigInt = 20, */ - case 17:/* adUnsignedTinyInt = 17, */ - case 18:/* adUnsignedSmallInt = 18, */ - case 19:/* adUnsignedInt = 19, */ - case 20:/* adUnsignedBigInt = 21, */ + case 16:// adTinyInt = 16, + case 2://adSmallInt = 2, + case 3://adInteger = 3, + case 4://adBigInt = 20, + case 17://adUnsignedTinyInt = 17, + case 18://adUnsignedSmallInt = 18, + case 19://adUnsignedInt = 19, + case 20://adUnsignedBigInt = 21, return 'I'; default: return 'N'; } } - /* time stamp not supported yet */ + // time stamp not supported yet function _fetch() { $rs = $this->_queryID; @@ -501,32 +501,32 @@ class ADORecordSet_ado extends ADORecordSet { $flds[] = $f; $tarr[] = $f->Type; } - /* bind types and flds only once */ + // bind types and flds only once $this->_tarr = $tarr; $this->_flds = $flds; } $t = reset($this->_tarr); $f = reset($this->_flds); - if ($this->hideErrors) $olde = error_reporting(E_ERROR|E_CORE_ERROR);/* sometimes $f->value be null */ + if ($this->hideErrors) $olde = error_reporting(E_ERROR|E_CORE_ERROR);// sometimes $f->value be null for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) { switch($t) { - case 135: /* timestamp */ + case 135: // timestamp $this->fields[] = date('Y-m-d H:i:s',(integer)$f->value); break; - case 133:/* A date value (yyyymmdd) */ + case 133:// A date value (yyyymmdd) $val = $f->value; $this->fields[] = substr($val,0,4).'-'.substr($val,4,2).'-'.substr($val,6,2); break; - case 7: /* adDate */ + case 7: // adDate $this->fields[] = date('Y-m-d',(integer)$f->value); break; - case 1: /* null */ + case 1: // null $this->fields[] = false; break; - case 6: /* currency is not supported properly; */ + case 6: // currency is not supported properly; print '
'.$f->Name.': currency type not supported by PHP
'; $this->fields[] = (float) $f->value; break; @@ -534,12 +534,12 @@ class ADORecordSet_ado extends ADORecordSet { $this->fields[] = $f->value; break; } - /* print " $f->value $t, "; */ + //print " $f->value $t, "; $f = next($this->_flds); $t = next($this->_tarr); - } /* for */ + } // for if ($this->hideErrors) error_reporting($olde); - @$rs->MoveNext(); /* @ needed for some versions of PHP! */ + @$rs->MoveNext(); // @ needed for some versions of PHP! if ($this->fetchMode == ADODB_FETCH_ASSOC) { $this->fields = $this->GetRowAssoc(false); @@ -550,7 +550,7 @@ class ADORecordSet_ado extends ADORecordSet { function _close() { $this->_flds = false; - @$this->_queryID->Close();/* by Pete Dishman (peterd@telephonetics.co.uk) */ + @$this->_queryID->Close();// by Pete Dishman (peterd@telephonetics.co.uk) $this->_queryID = false; } diff --git a/lib/adodb/drivers/adodb-ado_access.inc.php b/lib/adodb/drivers/adodb-ado_access.inc.php index ead40536ff..338d2e7163 100644 --- a/lib/adodb/drivers/adodb-ado_access.inc.php +++ b/lib/adodb/drivers/adodb-ado_access.inc.php @@ -17,9 +17,9 @@ if (!defined('_ADODB_ADO_LAYER')) { class ADODB_ado_access extends ADODB_ado { var $databaseType = 'ado_access'; - var $hasTop = 'top'; /* support mssql SELECT TOP 10 * FROM TABLE */ + var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE var $fmtDate = "#Y-m-d#"; - var $fmtTimeStamp = "#Y-m-d h:i:sA#";/* note no comma */ + var $fmtTimeStamp = "#Y-m-d h:i:sA#";// note no comma var $sysDate = "FORMAT(NOW,'yyyy-mm-dd')"; var $sysTimeStamp = 'NOW'; diff --git a/lib/adodb/drivers/adodb-ado_mssql.inc.php b/lib/adodb/drivers/adodb-ado_mssql.inc.php index 400545a8c3..1144072722 100644 --- a/lib/adodb/drivers/adodb-ado_mssql.inc.php +++ b/lib/adodb/drivers/adodb-ado_mssql.inc.php @@ -24,7 +24,7 @@ class ADODB_ado_mssql extends ADODB_ado { var $hasTop = 'top'; var $sysDate = 'GetDate()'; var $sysTimeStamp = 'GetDate()'; - /* var $_inTransaction = 1; // always open recordsets, so no transaction problems. */ + //var $_inTransaction = 1; // always open recordsets, so no transaction problems. function ADODB_ado_mssql() { diff --git a/lib/adodb/drivers/adodb-borland_ibase.inc.php b/lib/adodb/drivers/adodb-borland_ibase.inc.php index 5c295a30bc..6a6f4b1275 100644 --- a/lib/adodb/drivers/adodb-borland_ibase.inc.php +++ b/lib/adodb/drivers/adodb-borland_ibase.inc.php @@ -22,11 +22,11 @@ class ADODB_borland_ibase extends ADODB_ibase { $this->ADODB_ibase(); } - /* Note that Interbase 6.5 uses ROWS instead - don't you love forking wars! */ - /* SELECT col1, col2 FROM table ROWS 5 -- get 5 rows */ - /* SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2 */ - /* Firebird uses */ - /* SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE */ + // Note that Interbase 6.5 uses ROWS instead - don't you love forking wars! + // SELECT col1, col2 FROM table ROWS 5 -- get 5 rows + // SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2 + // Firebird uses + // SELECT FIRST 5 SKIP 2 col1, col2 FROM TABLE function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $arg3=false,$secs=0) { if ($nrows > 0) { @@ -37,9 +37,9 @@ class ADODB_borland_ibase extends ADODB_ibase { $str = " ROWS $a TO $b"; } } else { - /* ok, skip */ + // ok, skip $a = $offset + 1; - $str = " ROWS $a TO 999999999"; /* 999 million */ + $str = " ROWS $a TO 999999999"; // 999 million } $sql .= $str; diff --git a/lib/adodb/drivers/adodb-csv.inc.php b/lib/adodb/drivers/adodb-csv.inc.php index 672cc6f5d6..38b679c5a9 100644 --- a/lib/adodb/drivers/adodb-csv.inc.php +++ b/lib/adodb/drivers/adodb-csv.inc.php @@ -24,7 +24,7 @@ class ADODB_csv extends ADOConnection { var $_affectedrows=0; var $_insertid=0; var $_url; - var $replaceQuote = "''"; /* string to use to replace quotes */ + var $replaceQuote = "''"; // string to use to replace quotes function ADODB_csv() { @@ -46,18 +46,18 @@ class ADODB_csv extends ADOConnection { } - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { - if (strtolower(substr($argHostname,0,7)) !== 'http:/* ') return false; */ + if (strtolower(substr($argHostname,0,7)) !== 'http://') return false; $this->_url = $argHostname; return true; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { - if (strtolower(substr($argHostname,0,7)) !== 'http:/* ') return false; */ + if (strtolower(substr($argHostname,0,7)) !== 'http://') return false; $this->_url = $argHostname; return true; } @@ -68,7 +68,7 @@ class ADODB_csv extends ADOConnection { } - /* parameters use PostgreSQL convention, not MySQL */ + // parameters use PostgreSQL convention, not MySQL function &SelectLimit($sql,$nrows=-1,$offset=-1,$arg3=false) { global $ADODB_FETCH_MODE; @@ -100,7 +100,7 @@ class ADODB_csv extends ADOConnection { return $rs; } - /* returns queryID or false */ + // returns queryID or false function &Execute($sql,$inputarr=false,$arg3=false) { global $ADODB_FETCH_MODE; @@ -112,8 +112,8 @@ class ADODB_csv extends ADOConnection { foreach($inputarr as $v) { $sql .= $sqlarr[$i]; - /* from Ron Baldwin */ - /* Only quote string types */ + // from Ron Baldwin + // Only quote string types if (gettype($v) == 'string') $sql .= $this->qstr($v); else if ($v === null) @@ -170,12 +170,12 @@ class ADODB_csv extends ADOConnection { return $this->_errorNo; } - /* returns true or false */ + // returns true or false function _close() { return true; } -} /* class */ +} // class class ADORecordset_csv extends ADORecordset { function ADORecordset_csv($id) @@ -189,6 +189,6 @@ class ADORecordset_csv extends ADORecordset { } } -} /* define */ +} // define ?> \ No newline at end of file diff --git a/lib/adodb/drivers/adodb-db2.inc.php b/lib/adodb/drivers/adodb-db2.inc.php index 66f85f85ba..a667666f5a 100644 --- a/lib/adodb/drivers/adodb-db2.inc.php +++ b/lib/adodb/drivers/adodb-db2.inc.php @@ -69,15 +69,15 @@ class ADODB_DB2 extends ADODB_odbc { var $concat_operator = 'CONCAT'; var $sysDate = 'CURRENT DATE'; var $sysTimeStamp = 'CURRENT TIMESTAMP'; - /* var $curmode = SQL_CUR_USE_ODBC; */ + //var $curmode = SQL_CUR_USE_ODBC; function ADODB_DB2() { $this->ADODB_odbc(); } - /* returns true or false */ - /* curmode is not properly supported by DB2 odbc driver according to Mark Newnham */ + // returns true or false + // curmode is not properly supported by DB2 odbc driver according to Mark Newnham function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; @@ -86,11 +86,11 @@ class ADODB_DB2 extends ADODB_odbc { $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword); $this->_errorMsg = $php_errormsg; - /* if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); */ + //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); return $this->_connectionID != false; } - /* returns true or false */ + // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; @@ -98,7 +98,7 @@ class ADODB_DB2 extends ADODB_odbc { $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword); $this->_errorMsg = $php_errormsg; - /* if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); */ + //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); return $this->_connectionID != false; } @@ -111,7 +111,7 @@ class ADODB_DB2 extends ADODB_odbc { function &SelectLimit($sql,$nrows=-1,$offset=-1,$arg3=false) { if ($offset <= 0) { - /* could also use " OPTIMIZE FOR $nrows ROWS " */ + // could also use " OPTIMIZE FOR $nrows ROWS " $sql .= " FETCH FIRST $nrows ROWS ONLY "; return $this->Execute($sql,false,$arg3); } else { @@ -144,7 +144,7 @@ class ADORecordSet_db2 extends ADORecordSet_odbc { case 'LONGCHAR': case 'TEXT': case 'CLOB': - case 'DBCLOB': /* double-byte */ + case 'DBCLOB': // double-byte return 'X'; case 'BLOB': @@ -159,12 +159,12 @@ class ADORecordSet_db2 extends ADORecordSet_odbc { case 'TIMESTAMP': return 'T'; - /* case 'BOOLEAN': */ - /* case 'BIT': */ - /* return 'L'; */ + //case 'BOOLEAN': + //case 'BIT': + // return 'L'; - /* case 'COUNTER': */ - /* return 'R'; */ + //case 'COUNTER': + // return 'R'; case 'INT': case 'INTEGER': @@ -177,5 +177,5 @@ class ADORecordSet_db2 extends ADORecordSet_odbc { } } -} /* define */ +} //define ?> \ No newline at end of file diff --git a/lib/adodb/drivers/adodb-fbsql.inc.php b/lib/adodb/drivers/adodb-fbsql.inc.php index c1a04b30a0..0551cccd18 100644 --- a/lib/adodb/drivers/adodb-fbsql.inc.php +++ b/lib/adodb/drivers/adodb-fbsql.inc.php @@ -47,7 +47,7 @@ class ADODB_fbsql extends ADOConnection { return $arr; } - /* returns concatenated string */ + // returns concatenated string function Concat() { $s = ""; @@ -64,7 +64,7 @@ class ADODB_fbsql extends ADOConnection { else return ''; } - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = fbsql_connect($argHostname,$argUsername,$argPassword); @@ -73,7 +73,7 @@ class ADODB_fbsql extends ADOConnection { return true; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = fbsql_pconnect($argHostname,$argUsername,$argPassword); @@ -96,7 +96,7 @@ class ADODB_fbsql extends ADOConnection { $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; - /* split type into type(length): */ + // split type into type(length): if (preg_match("/^(.+)\((\d+)\)$/", $fld->type, $query_array)) { $fld->type = $query_array[1]; $fld->max_length = $query_array[2]; @@ -117,7 +117,7 @@ class ADODB_fbsql extends ADOConnection { return false; } - /* returns true or false */ + // returns true or false function SelectDB($dbName) { $this->databaseName = $dbName; @@ -128,7 +128,7 @@ class ADODB_fbsql extends ADOConnection { } - /* returns queryID or false */ + // returns queryID or false function _query($sql,$inputarr) { return fbsql_query("$sql;",$this->_connectionID); @@ -147,7 +147,7 @@ class ADODB_fbsql extends ADOConnection { return @fbsql_errno($this->_connectionID); } - /* returns true or false */ + // returns true or false function _close() { return @fbsql_close($this->_connectionID); @@ -188,13 +188,13 @@ class ADORecordSet_fbsql extends ADORecordSet{ function &FetchField($fieldOffset = -1) { if ($fieldOffset != -1) { $o = @fbsql_fetch_field($this->_queryID, $fieldOffset); - /* $o->max_length = -1; // fbsql returns the max length less spaces -- so it is unrealiable */ + //$o->max_length = -1; // fbsql returns the max length less spaces -- so it is unrealiable $f = @fbsql_field_flags($this->_queryID,$fieldOffset); $o->binary = (strpos($f,'binary')!== false); } else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */ - $o = @fbsql_fetch_field($this->_queryID);/* fbsql returns the max length less spaces -- so it is unrealiable */ - /* $o->max_length = -1; */ + $o = @fbsql_fetch_field($this->_queryID);// fbsql returns the max length less spaces -- so it is unrealiable + //$o->max_length = -1; } return $o; @@ -217,7 +217,7 @@ class ADORecordSet_fbsql extends ADORecordSet{ function MetaType($t,$len=-1,$fieldobj=false) { - $len = -1; /* fbsql max_length is not accurate */ + $len = -1; // fbsql max_length is not accurate switch (strtoupper($t)) { case 'CHARACTER': case 'CHARACTER VARYING': @@ -227,7 +227,7 @@ class ADORecordSet_fbsql extends ADORecordSet{ case 'BIT VARYING': if ($len <= $this->blobSize) return 'C'; - /* so we have to check whether binary... */ + // so we have to check whether binary... case 'IMAGE': case 'LONGBLOB': case 'BLOB': @@ -254,6 +254,6 @@ class ADORecordSet_fbsql extends ADORecordSet{ } } -} /* class */ -} /* defined */ +} //class +} // defined ?> \ No newline at end of file diff --git a/lib/adodb/drivers/adodb-firebird.inc.php b/lib/adodb/drivers/adodb-firebird.inc.php index a0d528ac4f..f1b2919ab5 100644 --- a/lib/adodb/drivers/adodb-firebird.inc.php +++ b/lib/adodb/drivers/adodb-firebird.inc.php @@ -21,9 +21,9 @@ class ADODB_firebird extends ADODB_ibase { $this->ADODB_ibase(); } - /* Note that Interbase 6.5 uses this ROWS instead - don't you love forking wars! */ - /* SELECT col1, col2 FROM table ROWS 5 -- get 5 rows */ - /* SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2 */ + // Note that Interbase 6.5 uses this ROWS instead - don't you love forking wars! + // SELECT col1, col2 FROM table ROWS 5 -- get 5 rows + // SELECT col1, col2 FROM TABLE ORDER BY col1 ROWS 3 TO 7 -- first 5 skip 2 function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $arg3=false,$secs=0) { $str = 'SELECT '; diff --git a/lib/adodb/drivers/adodb-ibase.inc.php b/lib/adodb/drivers/adodb-ibase.inc.php index 8e83f1f5ae..72c3149827 100644 --- a/lib/adodb/drivers/adodb-ibase.inc.php +++ b/lib/adodb/drivers/adodb-ibase.inc.php @@ -25,7 +25,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese class ADODB_ibase extends ADOConnection { var $databaseType = "ibase"; - var $replaceQuote = "\'"; /* string to use to replace quotes */ + var $replaceQuote = "\'"; // string to use to replace quotes var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d, H:i:s'"; var $concat_operator='||'; @@ -49,7 +49,7 @@ class ADODB_ibase extends ADOConnection { function BeginTrans() { $this->autoCommit = false; - $this->_transactionID = $this->_connectionID;/* ibase_trans($this->ibasetrans, $this->_connectionID); */ + $this->_transactionID = $this->_connectionID;//ibase_trans($this->ibasetrans, $this->_connectionID); return $this->_transactionID; } @@ -59,7 +59,7 @@ class ADODB_ibase extends ADOConnection { $ret = false; $this->autoCommit = true; if ($this->_transactionID) { - /* print ' commit '; */ + //print ' commit '; $ret = ibase_commit($this->_transactionID); } $this->_transactionID = false; @@ -77,11 +77,11 @@ class ADODB_ibase extends ADOConnection { return $ret; } - /* See http://community.borland.com/article/0,1410,25844,00.html */ + // See http://community.borland.com/article/0,1410,25844,00.html function RowLock($tables,$where,$col) { if ($this->autoCommit) $this->BeginTrans(); - $this->Execute("UPDATE $table SET $col=$col WHERE $where "); /* is this correct - jlim? */ + $this->Execute("UPDATE $table SET $col=$col WHERE $where "); // is this correct - jlim? return 1; } @@ -102,7 +102,7 @@ class ADODB_ibase extends ADOConnection { $rs = $this->Execute($getnext); } if ($rs && !$rs->EOF) $this->genID = (integer) reset($rs->fields); - else $this->genID = 0; /* false */ + else $this->genID = 0; // false if ($rs) $rs->Close(); @@ -127,13 +127,13 @@ class ADODB_ibase extends ADOConnection { return $this->_errorMsg; } - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { - /* if ($this->charSet !== false) */ + //if ($this->charSet !== false) $this->_connectionID = ibase_connect($argHostname,$argUsername,$argPassword,$this->charSet,$this->buffers,$this->dialect); - /* else */ - /* $this->_connectionID = ibase_connect($argHostname,$argUsername,$argPassword); */ + // else + // $this->_connectionID = ibase_connect($argHostname,$argUsername,$argPassword); if ($this->_connectionID === false) { $this->_handleerror(); @@ -142,13 +142,13 @@ class ADODB_ibase extends ADOConnection { return true; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { - /* if ($this->charSet !== false) */ + //if ($this->charSet !== false) $this->_connectionID = ibase_pconnect($argHostname,$argUsername,$argPassword,$this->charSet,$this->buffers,$this->dialect); - /* else */ - /* $this->_connectionID = ibase_pconnect($argHostname,$argUsername,$argPassword); */ + // else + // $this->_connectionID = ibase_pconnect($argHostname,$argUsername,$argPassword); if ($this->_connectionID === false) { $this->_handleerror(); @@ -166,8 +166,8 @@ class ADODB_ibase extends ADOConnection { return array($sql,$stmt); } - /* returns query ID if successful, otherwise false */ - /* there have been reports of problems with nested queries - the code is probably not re-entrant? */ + // returns query ID if successful, otherwise false + // there have been reports of problems with nested queries - the code is probably not re-entrant? function _query($sql,$iarr=false) { if (is_array($sql)) { @@ -203,14 +203,14 @@ class ADODB_ibase extends ADOConnection { return $ret; } - /* returns true or false */ + // returns true or false function _close() { if (!$this->autoCommit) @ibase_rollback($this->_connectionID); return @ibase_close($this->_connectionID); } - /* returns array of ADOFieldObjects for current table */ + // returns array of ADOFieldObjects for current table function &MetaColumns($table) { global $ADODB_FETCH_MODE; @@ -226,7 +226,7 @@ class ADODB_ibase extends ADOConnection { if ($rs === false) return false; $retarr = array(); - while (!$rs->EOF) { /* print_r($rs->fields); */ + while (!$rs->EOF) { //print_r($rs->fields); $fld = new ADOFieldObject(); $fld->name = $rs->fields[0]; $tt = $rs->fields[1]; @@ -259,7 +259,7 @@ class ADODB_ibase extends ADOConnection { return false; } - /* no longer needed in php 4.1.0, but still backward compatible */ + // no longer needed in php 4.1.0, but still backward compatible function &BlobEncode( $blob ) { $blobid = ibase_blob_create( $this->_connectionID); @@ -267,11 +267,11 @@ class ADODB_ibase extends ADOConnection { return ibase_blob_close( $blobid ); } - /* no longer needed in php 4.1.0, but still backward compatible */ + // no longer needed in php 4.1.0, but still backward compatible function &BlobDecode( $blob ) { $blobid = ibase_blob_open( $blob ); - $realblob = ibase_blob_get( $blobid,MAX_BLOB_SIZE); /* 2nd param is max size of blob -- Kevin Boillet */ + $realblob = ibase_blob_get( $blobid,MAX_BLOB_SIZE); // 2nd param is max size of blob -- Kevin Boillet ibase_blob_close( $blobid ); return( $realblob ); @@ -393,9 +393,9 @@ class ADORecordset_ibase extends ADORecordSet case 'TIMESTAMP': case 'DATE': return 'D'; - /* case 'T': return 'T'; */ + //case 'T': return 'T'; - /* case 'L': return 'L'; */ + //case 'L': return 'L'; case 'INT': case 'SHORT': case 'INTEGER': return 'I'; diff --git a/lib/adodb/drivers/adodb-informix72.inc.php b/lib/adodb/drivers/adodb-informix72.inc.php index f47e5edc6b..3118b1b7fb 100644 --- a/lib/adodb/drivers/adodb-informix72.inc.php +++ b/lib/adodb/drivers/adodb-informix72.inc.php @@ -17,7 +17,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim. All rights reserved. class ADODB_informix72 extends ADOConnection { var $databaseType = "informix72"; var $dataProvider = "informix"; - var $replaceQuote = "''"; /* string to use to replace quotes */ + var $replaceQuote = "''"; // string to use to replace quotes var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d H:i:s'"; var $hasInsertID = true; @@ -30,17 +30,17 @@ class ADODB_informix72 extends ADOConnection { var $has_insertid = true; var $_autocommit = true; - var $_bindInputArray = true; /* set to true if ADOConnection.Execute() permits binding of array parameters. */ + var $_bindInputArray = true; // set to true if ADOConnection.Execute() permits binding of array parameters. var $sysDate = 'TODAY'; var $sysTimeStamp = 'CURRENT'; function ADODB_informix72() { - /* alternatively, use older method: */ - /* putenv("DBDATE=Y4MD-"); */ + // alternatively, use older method: + //putenv("DBDATE=Y4MD-"); - /* force ISO date format */ + // force ISO date format putenv('GL_DATE=%Y-%m-%d'); } @@ -104,7 +104,7 @@ class ADODB_informix72 extends ADOConnection { } - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { $dbs = $argDatabasename . "@" . $argHostname; @@ -114,7 +114,7 @@ class ADODB_informix72 extends ADOConnection { return true; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { $dbs = $argDatabasename . "@" . $argHostname; @@ -132,12 +132,12 @@ class ADODB_informix72 extends ADOConnection { else return array($sql,$stmt); } */ - /* returns query ID if successful, otherwise false */ + // returns query ID if successful, otherwise false function _query($sql,$inputarr) { global $ADODB_COUNTRECS; - /* String parameters have to be converted using ifx_create_char */ + // String parameters have to be converted using ifx_create_char if ($inputarr) { foreach($inputarr as $v) { if (gettype($v) == 'string') { @@ -149,8 +149,8 @@ class ADODB_informix72 extends ADOConnection { } } - /* In case of select statement, we use a scroll cursor in order */ - /* to be able to call "move", or "movefirst" statements */ + // In case of select statement, we use a scroll cursor in order + // to be able to call "move", or "movefirst" statements if ($ADODB_COUNTRECS && preg_match("/^[\\t\\n ]*select/i", $sql)) { if ($inputarr) { $this->lastQuery = ifx_query($sql,$this->_connectionID, IFX_SCROLL, $tab); @@ -168,15 +168,15 @@ class ADODB_informix72 extends ADOConnection { } } - /* Following line have been commented because autocommit mode is */ - /* not supported by informix SE 7.2 */ + // Following line have been commented because autocommit mode is + // not supported by informix SE 7.2 - /* if ($this->_autocommit) ifx_query('COMMIT',$this->_connectionID); */ + //if ($this->_autocommit) ifx_query('COMMIT',$this->_connectionID); return $this->lastQuery; } - /* returns true or false */ + // returns true or false function _close() { $this->lastQuery = false; @@ -216,7 +216,7 @@ class ADORecordset_informix72 extends ADORecordSet { foreach($fp as $k => $v) { $o = new ADOFieldObject; $o->name = $k; - $arr = split(';',$v); /* "SQLTYPE;length;precision;scale;ISNULLABLE" */ + $arr = split(';',$v); //"SQLTYPE;length;precision;scale;ISNULLABLE" $o->type = $arr[0]; $o->max_length = $arr[1]; $this->_fieldprops[] = $o; @@ -227,7 +227,7 @@ class ADORecordset_informix72 extends ADORecordSet { function _initrs() { - $this->_numOfRows = -1; /* ifx_affected_rows not reliable, only returns estimate -- ($ADODB_COUNTRECS)? ifx_affected_rows($this->_queryID):-1; */ + $this->_numOfRows = -1; // ifx_affected_rows not reliable, only returns estimate -- ($ADODB_COUNTRECS)? ifx_affected_rows($this->_queryID):-1; $this->_numOfFields = ifx_num_fields($this->_queryID); } diff --git a/lib/adodb/drivers/adodb-mssql.inc.php b/lib/adodb/drivers/adodb-mssql.inc.php index d8a7763028..57d52e8c4a 100644 --- a/lib/adodb/drivers/adodb-mssql.inc.php +++ b/lib/adodb/drivers/adodb-mssql.inc.php @@ -14,31 +14,31 @@ Set tabs to 4 for best viewing. */ -/* ---------------------------------------------------------------- */ -/* MSSQL returns dates with the format Oct 13 2002 or 13 Oct 2002 */ -/* and this causes tons of problems because localized versions of */ -/* MSSQL will return the dates in dmy or mdy order; and also the */ -/* month strings depends on what language has been configured. The */ -/* following two variables allow you to control the localization */ -/* settings - Ugh. */ -/* */ -/* MORE LOCALIZATION INFO */ -/* ---------------------- */ -/* To configure datetime, look for and modify sqlcommn.loc, */ -/* typically found in c:\mssql\install */ -/* Also read : */ -/* http://support.microsoft.com/default.aspx?scid=kb;EN-US;q220918 */ -/* Alternatively use: */ -/* CONVERT(char(12),datecol,120) */ -/* ---------------------------------------------------------------- */ +//---------------------------------------------------------------- +// MSSQL returns dates with the format Oct 13 2002 or 13 Oct 2002 +// and this causes tons of problems because localized versions of +// MSSQL will return the dates in dmy or mdy order; and also the +// month strings depends on what language has been configured. The +// following two variables allow you to control the localization +// settings - Ugh. +// +// MORE LOCALIZATION INFO +// ---------------------- +// To configure datetime, look for and modify sqlcommn.loc, +// typically found in c:\mssql\install +// Also read : +// http://support.microsoft.com/default.aspx?scid=kb;EN-US;q220918 +// Alternatively use: +// CONVERT(char(12),datecol,120) +//---------------------------------------------------------------- -global $ADODB_mssql_date_order; /* 'dmy' and 'mdy' supported */ +global $ADODB_mssql_date_order; // 'dmy' and 'mdy' supported $ADODB_mssql_has_datetimeconvert = (strnatcmp(PHP_VERSION,'4.2.0')>=0); if ($ADODB_mssql_has_datetimeconvert) { ini_set('mssql.datetimeconvert',0); } else { -global $ADODB_mssql_mths; /* array, months must be upper-case */ +global $ADODB_mssql_mths; // array, months must be upper-case global $ADODB_mssql_has_datetimeconvert; $ADODB_mssql_date_order = 'mdy'; @@ -46,9 +46,9 @@ global $ADODB_mssql_has_datetimeconvert; 'JAN'=>1,'FEB'=>2,'MAR'=>3,'APR'=>4,'MAY'=>5,'JUN'=>6, 'JUL'=>7,'AUG'=>8,'SEP'=>9,'OCT'=>10,'NOV'=>11,'DEC'=>12); } -/* --------------------------------------------------------------------------- */ -/* Call this to autoset $ADODB_mssql_date_order at the beginning of your code, */ -/* just after you connect to the database. Supports mdy and dmy only */ +//--------------------------------------------------------------------------- +// Call this to autoset $ADODB_mssql_date_order at the beginning of your code, +// just after you connect to the database. Supports mdy and dmy only function AutoDetect_MSSQL_Date_Order($conn) { global $ADODB_mssql_date_order; @@ -69,14 +69,14 @@ global $ADODB_mssql_date_order; class ADODB_mssql extends ADOConnection { var $databaseType = "mssql"; - var $replaceQuote = "''"; /* string to use to replace quotes */ + var $replaceQuote = "''"; // string to use to replace quotes var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d h:i:sA'"; var $hasInsertID = true; var $hasAffectedRows = true; var $metaTablesSQL="select name 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 $hasTop = 'top'; /* support mssql SELECT TOP 10 * FROM TABLE */ + var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE var $_hastrans = false; var $hasGenID = true; var $sysDate = 'GetDate()'; @@ -91,12 +91,12 @@ class ADODB_mssql extends ADOConnection { $this->_has_mssql_init = (strnatcmp(PHP_VERSION,'4.1.0')>=0); } - /* might require begintrans -- committrans */ + // might require begintrans -- committrans function _insertid() { return $this->GetOne('select @@identity'); } - /* might require begintrans -- committrans */ + // might require begintrans -- committrans function _affectedrows() { return $this->GetOne('select @@rowcount'); @@ -111,7 +111,7 @@ class ADODB_mssql extends ADOConnection { function GenID($seq='adodbseq',$start=1) { - /* $this->debug=1; */ + //$this->debug=1; $this->Execute('BEGIN TRANSACTION adodbseq'); $ok = $this->Execute("update $seq with (tablock,holdlock) set id = id + 1"); if (!$ok) { @@ -128,8 +128,8 @@ class ADODB_mssql extends ADOConnection { $this->Execute('COMMIT TRANSACTION adodbseq'); return $num; - /* in old implementation, pre 1.90, we returned GUID... */ - /* return $this->GetOne("SELECT CONVERT(varchar(255), NEWID()) AS 'Char'"); */ + // in old implementation, pre 1.90, we returned GUID... + //return $this->GetOne("SELECT CONVERT(varchar(255), NEWID()) AS 'Char'"); } function CommitTrans($ok=true) @@ -166,7 +166,7 @@ class ADODB_mssql extends ADOConnection { return $this->GetOne("select top 1 null as ignore from $tables with (ROWLOCK,HOLDLOCK) where $where"); } - /* From: Fernando Moreira */ + //From: Fernando Moreira function MetaDatabases() { if(@mssql_select_db("master")) { @@ -219,7 +219,7 @@ class ADODB_mssql extends ADOConnection { else return -1; } - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = mssql_connect($argHostname,$argUsername,$argPassword); @@ -229,7 +229,7 @@ class ADODB_mssql extends ADOConnection { } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = mssql_pconnect($argHostname,$argUsername,$argPassword); @@ -279,7 +279,7 @@ class ADODB_mssql extends ADOConnection { return $sql; } - $isNull = is_null($var); /* php 4.0.4 and above... */ + $isNull = is_null($var); // php 4.0.4 and above... if ($type === false) switch(gettype($var)) { @@ -314,7 +314,7 @@ class ADODB_mssql extends ADOConnection { return $this->Execute($sql) != false; } - /* returns query ID if successful, otherwise false */ + // returns query ID if successful, otherwise false function _query($sql,$inputarr) { $this->_errorMsg = false; @@ -322,7 +322,7 @@ class ADODB_mssql extends ADOConnection { return mssql_query($sql,$this->_connectionID); } - /* returns true or false */ + // returns true or false function _close() { if ($this->_hastrans) $this->RollbackTrans(); @@ -331,7 +331,7 @@ class ADODB_mssql extends ADOConnection { return $rez; } - /* mssql uses a default date like Dec 30 2000 12:00AM */ + // mssql uses a default date like Dec 30 2000 12:00AM function UnixDate($v) { return ADORecordSet_array_mssql::UnixDate($v); @@ -351,7 +351,7 @@ class ADORecordset_mssql extends ADORecordSet { var $databaseType = "mssql"; var $canSeek = true; - /* _mths works only in non-localised system */ + // _mths works only in non-localised system function ADORecordset_mssql($id) { @@ -361,8 +361,8 @@ class ADORecordset_mssql extends ADORecordSet { return $this->ADORecordSet($id); } - /* Contributed by "Sven Axelsson" */ - /* get next resultset - requires PHP 4.0.5 or later */ + //Contributed by "Sven Axelsson" + // get next resultset - requires PHP 4.0.5 or later function NextRecordSet() { if (!mssql_next_result($this->_queryID)) return false; @@ -416,7 +416,7 @@ class ADORecordset_mssql extends ADORecordSet { return @mssql_data_seek($this->_queryID, $row); } - /* speedup */ + // speedup function MoveNext() { if (!$this->EOF) { @@ -430,8 +430,8 @@ class ADORecordset_mssql extends ADORecordSet { return false; } - /* INSERT UPDATE DELETE returns false even if no error occurs in 4.0.4 */ - /* also the date format has been changed from YYYY-mm-dd to dd MMM YYYY in 4.0.4. Idiot! */ + // INSERT UPDATE DELETE returns false even if no error occurs in 4.0.4 + // also the date format has been changed from YYYY-mm-dd to dd MMM YYYY in 4.0.4. Idiot! function _fetch($ignore_fields=false) { if ($this->fetchMode & ADODB_FETCH_ASSOC) $this->fields = @mssql_fetch_array($this->_queryID); @@ -447,7 +447,7 @@ class ADORecordset_mssql extends ADORecordSet { $this->_queryID = false; return $rez; } - /* mssql uses a default date like Dec 30 2000 12:00AM */ + // mssql uses a default date like Dec 30 2000 12:00AM function UnixDate($v) { return ADORecordSet_array_mssql::UnixDate($v); @@ -467,7 +467,7 @@ class ADORecordSet_array_mssql extends ADORecordSet_array { $this->ADORecordSet_array($id); } - /* mssql uses a default date like Dec 30 2000 12:00AM */ + // mssql uses a default date like Dec 30 2000 12:00AM function UnixDate($v) { global $ADODB_mssql_has_datetimeconvert; @@ -475,7 +475,7 @@ class ADORecordSet_array_mssql extends ADORecordSet_array { global $ADODB_mssql_mths,$ADODB_mssql_date_order; - /* Dec 30 2000 12:00AM */ + //Dec 30 2000 12:00AM if ($ADODB_mssql_date_order == 'dmy') { if (!preg_match( "|^([0-9]{1,2})[-/\. ]+([A-Za-z]{3})[-/\. ]+([0-9]{4})|" ,$v, $rr)) { return parent::UnixDate($v); @@ -495,7 +495,7 @@ class ADORecordSet_array_mssql extends ADORecordSet_array { } $themth = $ADODB_mssql_mths[$themth]; if ($themth <= 0) return false; - /* h-m-s-MM-DD-YY */ + // h-m-s-MM-DD-YY return mktime(0,0,0,$themth,$theday,$rr[3]); } @@ -506,7 +506,7 @@ class ADORecordSet_array_mssql extends ADORecordSet_array { global $ADODB_mssql_mths,$ADODB_mssql_date_order; - /* Dec 30 2000 12:00AM */ + //Dec 30 2000 12:00AM if ($ADODB_mssql_date_order == 'dmy') { if (!preg_match( "|^([0-9]{1,2})[-/\. ]+([A-Za-z]{3})[-/\. ]+([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})|" ,$v, $rr)) return parent::UnixTimeStamp($v); @@ -536,7 +536,7 @@ class ADORecordSet_array_mssql extends ADORecordSet_array { default: break; } - /* h-m-s-MM-DD-YY */ + // h-m-s-MM-DD-YY return mktime($rr[4],$rr[5],0,$themth,$theday,$rr[3]); } } diff --git a/lib/adodb/drivers/adodb-mysql.inc.php b/lib/adodb/drivers/adodb-mysql.inc.php index ce4ca9efa8..8ebd284ecf 100644 --- a/lib/adodb/drivers/adodb-mysql.inc.php +++ b/lib/adodb/drivers/adodb-mysql.inc.php @@ -26,7 +26,7 @@ class ADODB_mysql extends ADOConnection { var $hasMoveFirst = true; var $hasGenID = true; var $upperCase = 'upper'; - var $isoDates = true; /* accepts dates in ISO format */ + var $isoDates = true; // accepts dates in ISO format var $sysDate = 'CURDATE()'; var $sysTimeStamp = 'NOW()'; var $forceNewConnect = false; @@ -45,15 +45,15 @@ class ADODB_mysql extends ADOConnection { return mysql_affected_rows($this->_connectionID); } - /* See http://www.mysql.com/doc/M/i/Miscellaneous_functions.html */ - /* Reference on Last_Insert_ID on the recommended way to simulate sequences */ + // See http://www.mysql.com/doc/M/i/Miscellaneous_functions.html + // Reference on Last_Insert_ID on the recommended way to simulate sequences var $_genIDSQL = "update %s set id=LAST_INSERT_ID(id+1);"; var $_genSeqSQL = "create table %s (id int not null)"; var $_genSeq2SQL = "insert into %s values (%s)"; function GenID($seqname='adodbseq',$startID=1) { - /* if (!$this->hasGenID) return false; */ + //if (!$this->hasGenID) return false; $getnext = sprintf($this->_genIDSQL,$seqname); $rs = @$this->Execute($getnext); if (!$rs) { @@ -82,7 +82,7 @@ class ADODB_mysql extends ADOConnection { return $arr; } - /* returns concatenated string */ + // returns concatenated string function Concat() { $s = ""; @@ -96,13 +96,13 @@ class ADODB_mysql extends ADOConnection { } else $s .= ','.$a; }*/ - /* suggestion by andrew005@mnogo.ru */ + // suggestion by andrew005@mnogo.ru $s = implode(',',$arr); if (strlen($s) > 0) return "CONCAT($s)"; else return ''; } - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { if ($this->forceNewConnect && (strnatcmp(PHP_VERSION,'4.2.0')>=0)) @@ -114,7 +114,7 @@ class ADODB_mysql extends ADOConnection { return true; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword); @@ -144,7 +144,7 @@ class ADODB_mysql extends ADOConnection { $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; - /* split type into type(length): */ + // split type into type(length): if (preg_match("/^(.+)\((\d+)\)$/", $fld->type, $query_array)) { $fld->type = $query_array[1]; $fld->max_length = $query_array[2]; @@ -174,7 +174,7 @@ class ADODB_mysql extends ADOConnection { return false; } - /* returns true or false */ + // returns true or false function SelectDB($dbName) { $this->databaseName = $dbName; @@ -184,7 +184,7 @@ class ADODB_mysql extends ADOConnection { else return false; } - /* parameters use PostgreSQL convention, not MySQL */ + // parameters use PostgreSQL convention, not MySQL function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false, $arg3=false,$secs=0) { $offsetStr =($offset>=0) ? "$offset," : ''; @@ -194,12 +194,12 @@ class ADODB_mysql extends ADOConnection { } - /* returns queryID or false */ + // returns queryID or false function _query($sql,$inputarr) { global $ADODB_COUNTRECS; if($ADODB_COUNTRECS) return mysql_query($sql,$this->_connectionID); - else return mysql_unbuffered_query($sql,$this->_connectionID); /* requires PHP >= 4.0.6 */ + else return mysql_unbuffered_query($sql,$this->_connectionID); // requires PHP >= 4.0.6 } /* Returns: the last error message from previous database operation */ @@ -219,7 +219,7 @@ class ADODB_mysql extends ADOConnection { - /* returns true or false */ + // returns true or false function _close() { @mysql_close($this->_connectionID); @@ -241,7 +241,7 @@ class ADODB_mysql extends ADOConnection { case 'T': return 'DATETIME'; case 'L': return 'TINYINT'; case 'R': return 'INTEGER NOT NULL AUTO_INCREMENT'; - case 'I': return 'INTEGER'; /* enough for 9 petabytes! */ + case 'I': return 'INTEGER'; // enough for 9 petabytes! case 'F': return 'DOUBLE'; case 'N': return 'NUMERIC'; @@ -305,14 +305,14 @@ class ADORecordSet_mysql extends ADORecordSet{ if ($fieldOffset != -1) { $o = mysql_fetch_field($this->_queryID, $fieldOffset); $f = @mysql_field_flags($this->_queryID,$fieldOffset); - $o->max_length = @mysql_field_len($this->_queryID,$fieldOffset); /* suggested by: Jim Nicholson (jnich@att.com) */ - /* $o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable */ + $o->max_length = @mysql_field_len($this->_queryID,$fieldOffset); // suggested by: Jim Nicholson (jnich@att.com) + //$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable $o->binary = (strpos($f,'binary')!== false); } else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */ $o = @mysql_fetch_field($this->_queryID); - $o->max_length = @mysql_field_len($this->_queryID); /* suggested by: Jim Nicholson (jnich@att.com) */ - /* $o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable */ + $o->max_length = @mysql_field_len($this->_queryID); // suggested by: Jim Nicholson (jnich@att.com) + //$o->max_length = -1; // mysql returns the max length less spaces -- so it is unrealiable } return $o; @@ -327,7 +327,7 @@ class ADORecordSet_mysql extends ADORecordSet{ /* Use associative array to get fields array */ function Fields($colname) { - /* added @ by "Michael William Miller" */ + // added @ by "Michael William Miller" if ($this->fetchMode != MYSQL_NUM) return @$this->fields[$colname]; if (!$this->bind) { @@ -359,12 +359,12 @@ class ADORecordSet_mysql extends ADORecordSet{ return false; } */ - /* 10% speedup to move MoveNext to child class */ + // 10% speedup to move MoveNext to child class function MoveNext() { if (!$this->EOF) { $this->_currentRow++; - /* using & below slows things down by 20%! */ + // using & below slows things down by 20%! $this->fields = @mysql_fetch_array($this->_queryID,$this->fetchMode); if (is_array($this->fields)) return true; @@ -393,7 +393,7 @@ class ADORecordSet_mysql extends ADORecordSet{ function MetaType($t,$len=-1,$fieldobj=false) { - $len = -1; /* mysql max_length is not accurate */ + $len = -1; // mysql max_length is not accurate switch (strtoupper($t)) { case 'STRING': case 'CHAR': @@ -409,8 +409,8 @@ class ADORecordSet_mysql extends ADORecordSet{ case 'MEDIUMTEXT': return 'X'; - /* php_mysql extension always returns 'blob' even if 'text' */ - /* so we have to check whether binary... */ + // php_mysql extension always returns 'blob' even if 'text' + // so we have to check whether binary... case 'IMAGE': case 'LONGBLOB': case 'BLOB': diff --git a/lib/adodb/drivers/adodb-oci8.inc.php b/lib/adodb/drivers/adodb-oci8.inc.php index 4fd7142b03..255dbf2a49 100644 --- a/lib/adodb/drivers/adodb-oci8.inc.php +++ b/lib/adodb/drivers/adodb-oci8.inc.php @@ -35,14 +35,14 @@ You can also modify the date format using the ALTER SESSION command. class ADODB_oci8 extends ADOConnection { var $databaseType = 'oci8'; var $dataProvider = 'oci8'; - var $replaceQuote = "''"; /* string to use to replace quotes */ + var $replaceQuote = "''"; // string to use to replace quotes var $concat_operator='||'; var $sysDate = "TRUNC(SYSDATE)"; var $sysTimeStamp = 'SYSDATE'; var $_stmt; var $_commit = OCI_COMMIT_ON_SUCCESS; - var $_initdate = true; /* init date to YYYY-MM-DD */ + var $_initdate = true; // init date to YYYY-MM-DD var $metaTablesSQL = "select table_name from cat where table_type in ('TABLE','VIEW')"; var $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno"; var $_bindInputArray = true; @@ -55,7 +55,7 @@ class ADODB_oci8 extends ADOConnection { var $connectSID = false; var $_bind = false; var $_hasOCIFetchStatement = false; - var $_getarray = false; /* currently not working */ + var $_getarray = false; // currently not working function ADODB_oci8() { @@ -67,7 +67,7 @@ class ADODB_oci8 extends ADOConnection { return OCIRowCount($this->_stmt); } - /* format and return date string in database date format */ + // format and return date string in database date format function DBDate($d) { if (empty($d) && $d !== 0) return 'null'; @@ -76,7 +76,7 @@ class ADODB_oci8 extends ADOConnection { return 'TO_DATE('.date($this->fmtDate,$d).",'YYYY-MM-DD')"; } - /* format and return date string in database timestamp format */ + // format and return date string in database timestamp format function DBTimeStamp($ts) { if (empty($ts) && $ts !== 0) return 'null'; @@ -159,11 +159,11 @@ NATSOFT.DOMAIN = ) ) */ - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename,$persist=false) { - if($argHostname) { /* added by Jorma Tuomainen */ + if($argHostname) { // added by Jorma Tuomainen if(strpos($argHostname,":")) { $argHostinfo=explode(":",$argHostname); $argHostname=$argHostinfo[0]; @@ -180,7 +180,7 @@ NATSOFT.DOMAIN = .")(PORT=$argHostport))(CONNECT_DATA=(SERVICE_NAME=$argDatabasename)))"; } - /* if ($argHostname) print "

Connect: 1st argument should be left blank for $this->databaseType

"; */ + //if ($argHostname) print "

Connect: 1st argument should be left blank for $this->databaseType

"; if ($persist)$this->_connectionID = OCIPLogon($argUsername,$argPassword, $argDatabasename); else $this->_connectionID = OCILogon($argUsername,$argPassword, $argDatabasename); @@ -189,10 +189,10 @@ NATSOFT.DOMAIN = $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD'"); } - /* print OCIServerVersion($this->_connectionID); */ + //print OCIServerVersion($this->_connectionID); return true; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename,true); @@ -215,7 +215,7 @@ NATSOFT.DOMAIN = */ function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$arg3=false,$secs2cache=0) { - /* seems that oracle only supports 1 hint comment in 8i */ + // seems that oracle only supports 1 hint comment in 8i if (strpos($sql,'/*+') !== false) $sql = str_replace('/*+ ','/*+FIRST_ROWS ',$sql); else @@ -224,17 +224,17 @@ NATSOFT.DOMAIN = if ($offset < 100) { if ($nrows > 0) { if ($offset > 0) $nrows += $offset; - /* $inputarr['adodb_rownum'] = $nrows; */ + //$inputarr['adodb_rownum'] = $nrows; $sql = "select * from ($sql) where rownum <= $nrows"; $nrows = -1; } - /* note that $nrows = 0 still has to work ==> no rows returned */ + // note that $nrows = 0 still has to work ==> no rows returned return ADOConnection::SelectLimit($sql,$nrows,$offset,$inputarr,$arg3,$secs2cache); } else { - /* Algorithm by Tomas V V Cox, from PEAR DB oci8.php */ + // Algorithm by Tomas V V Cox, from PEAR DB oci8.php - /* Let Oracle return the name of the columns */ + // Let Oracle return the name of the columns $q_fields = "SELECT * FROM ($sql) WHERE NULL = NULL"; if (!$result = OCIParse($this->_connectionID, $q_fields)) { return false; @@ -250,7 +250,7 @@ NATSOFT.DOMAIN = $fields = implode(',', $cols); $nrows += $offset; - $offset += 1; /* in Oracle rownum starts at 1 */ + $offset += 1; // in Oracle rownum starts at 1 $sql = "SELECT $fields FROM". "(SELECT rownum as adodb_rownum, $fields FROM". @@ -348,7 +348,7 @@ NATSOFT.DOMAIN = static $BINDNUM = 0; $stmt = OCIParse($this->_connectionID,$sql); - if (!$stmt) return $sql; /* error in statement, let Execute() handle the error */ + if (!$stmt) return $sql; // error in statement, let Execute() handle the error $BINDNUM += 1; return array($sql,$stmt,0,$BINDNUM); @@ -389,11 +389,11 @@ NATSOFT.DOMAIN = if (!is_array($stmt)) return false; if ($name == false) { if ($type !== false) $rez = OCIBindByName($stmt[1],":".$name,$var,$size,$type); - else $rez = OCIBindByName($stmt[1],":".$stmt[2],$var,$size); /* +1 byte for null terminator */ + else $rez = OCIBindByName($stmt[1],":".$stmt[2],$var,$size); // +1 byte for null terminator $stmt[2] += 1; } else { if ($type !== false) $rez = OCIBindByName($stmt[1],":".$name,$var,$size,$type); - else $rez = OCIBindByName($stmt[1],":".$name,$var,$size); /* +1 byte for null terminator */ + else $rez = OCIBindByName($stmt[1],":".$name,$var,$size); // +1 byte for null terminator } return $rez; @@ -440,18 +440,18 @@ NATSOFT.DOMAIN = */ function _query($sql,$inputarr) { - if (is_array($sql)) { /* is prepared sql */ + if (is_array($sql)) { // is prepared sql $stmt = $sql[1]; - /* we try to bind to permanent array, so that OCIBindByName is persistent */ - /* and carried out once only - note that max array element size is 4000 chars */ + // we try to bind to permanent array, so that OCIBindByName is persistent + // and carried out once only - note that max array element size is 4000 chars if (is_array($inputarr)) { $bindpos = $sql[3]; if (isset($this->_bind[$bindpos])) { - /* all tied up already */ + // all tied up already $bindarr = &$this->_bind[$bindpos]; } else { - /* one statement to bind them all */ + // one statement to bind them all $bindarr = array(); foreach($inputarr as $k => $v) { $bindarr[$k] = $v; @@ -471,16 +471,16 @@ NATSOFT.DOMAIN = if (is_array($inputarr)) { foreach($inputarr as $k => $v) { if (is_array($v)) { - if (sizeof($v) == 2) /* suggested by g.giunta@libero. */ + if (sizeof($v) == 2) // suggested by g.giunta@libero. OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1]); else OCIBindByName($stmt,":$k",$inputarr[$k][0],$v[1],$v[2]); } else { $len = -1; if ($v === ' ') $len = 1; - if (isset($bindarr)) { /* is prepared sql, so no need to ocibindbyname again */ + if (isset($bindarr)) { // is prepared sql, so no need to ocibindbyname again $bindarr[$k] = $v; - } else { /* dynamic sql, so rebind every time */ + } else { // dynamic sql, so rebind every time OCIBindByName($stmt,":$k",$inputarr[$k],$len); } } @@ -495,7 +495,7 @@ NATSOFT.DOMAIN = return false; } - /* returns true or false */ + // returns true or false function _close() { if (!$this->autoCommit) OCIRollback($this->_connectionID); @@ -506,7 +506,7 @@ NATSOFT.DOMAIN = function MetaPrimaryKeys($table) { - /* tested with oracle 8.1.7 */ + // tested with oracle 8.1.7 $table = strtoupper($table); $sql = "SELECT /*+ RULE */ distinct b.column_name FROM ALL_CONSTRAINTS a @@ -542,7 +542,7 @@ NATSOFT.DOMAIN = case 'T': return 'DATE'; case 'L': return 'NUMBER(1)'; case 'R': return false; - case 'I': return 'NUMBER(16)'; /* enough for 9 petabytes! */ + case 'I': return 'NUMBER(16)'; // enough for 9 petabytes! case 'F': return 'NUMBER'; case 'N': return 'NUMBER'; @@ -584,12 +584,12 @@ NATSOFT.DOMAIN = return "'".str_replace("'",$this->replaceQuote,$s)."'"; } - /* undo magic quotes for " */ + // undo magic quotes for " $s = str_replace('\\"','"',$s); - if ($this->replaceQuote == "\\'") /* ' already quoted, no need to change anything */ + if ($this->replaceQuote == "\\'") // ' already quoted, no need to change anything return "'$s'"; - else {/* change \' to '' for sybase/mssql */ + else {// change \' to '' for sybase/mssql $s = str_replace('\\\\','\\',$s); return "'".str_replace("\\'",$this->replaceQuote,$s)."'"; } @@ -606,7 +606,7 @@ class ADORecordset_oci8 extends ADORecordSet { var $databaseType = 'oci8'; var $bind=false; var $_fieldobjs; - /* var $_arr = false; */ + //var $_arr = false; function ADORecordset_oci8($queryID) { @@ -670,7 +670,7 @@ class ADORecordset_oci8 extends ADORecordSet { $fld->type = OCIcolumntype($this->_queryID, $fieldOffset); $fld->max_length = OCIcolumnsize($this->_queryID, $fieldOffset); if ($fld->type == 'NUMBER') { - /* $p = OCIColumnPrecision($this->_queryID, $fieldOffset); */ + //$p = OCIColumnPrecision($this->_queryID, $fieldOffset); $sc = OCIColumnScale($this->_queryID, $fieldOffset); if ($sc == 0) $fld->type = 'INT'; } @@ -692,7 +692,7 @@ class ADORecordset_oci8 extends ADORecordSet { */ function GetArray($nRows = -1) { - /* if ($this->_arr) return $this->_arr; */ + // if ($this->_arr) return $this->_arr; $results = array(); $cnt = 0; while (!$this->EOF && $nRows != $cnt) { @@ -702,7 +702,7 @@ class ADORecordset_oci8 extends ADORecordSet { return $results; } - /* 10% speedup to move MoveNext to child class */ + // 10% speedup to move MoveNext to child class function MoveNext() { if (!$this->EOF) { @@ -795,7 +795,7 @@ class ADORecordset_oci8 extends ADORecordSet { case 'DATE': return 'D'; - /* case 'T': return 'T'; */ + //case 'T': return 'T'; case 'INT': case 'SMALLINT': diff --git a/lib/adodb/drivers/adodb-oci805.inc.php b/lib/adodb/drivers/adodb-oci805.inc.php index 29ff582b61..682c65ec6a 100644 --- a/lib/adodb/drivers/adodb-oci805.inc.php +++ b/lib/adodb/drivers/adodb-oci805.inc.php @@ -25,7 +25,7 @@ class ADODB_oci805 extends ADODB_oci8 { function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$arg3=false,$secs2cache=0) { - /* seems that oracle only supports 1 hint comment in 8i */ + // seems that oracle only supports 1 hint comment in 8i if (strpos($sql,'/*+') !== false) $sql = str_replace('/*+ ','/*+FIRST_ROWS ',$sql); else diff --git a/lib/adodb/drivers/adodb-oci8po.inc.php b/lib/adodb/drivers/adodb-oci8po.inc.php index ed4d0ec1ab..84d48fc918 100644 --- a/lib/adodb/drivers/adodb-oci8po.inc.php +++ b/lib/adodb/drivers/adodb-oci8po.inc.php @@ -33,7 +33,7 @@ class ADODB_oci8po extends ADODB_oci8 { return ADODB_oci8::Prepare($sql); } - /* emulate handling of parameters ? ?, replacing with :bind0 :bind1 */ + // emulate handling of parameters ? ?, replacing with :bind0 :bind1 function _query($sql,$inputarr) { if (is_array($inputarr)) { @@ -82,7 +82,7 @@ class ADORecordset_oci8po extends ADORecordset_oci8 { return $this->fields[$this->bind[strtoupper($colname)]]; } - /* lowercase field names... */ + // lowercase field names... function &_FetchField($fieldOffset = -1) { $fld = new ADOFieldObject; @@ -91,14 +91,14 @@ class ADORecordset_oci8po extends ADORecordset_oci8 { $fld->type = OCIcolumntype($this->_queryID, $fieldOffset); $fld->max_length = OCIcolumnsize($this->_queryID, $fieldOffset); if ($fld->type == 'NUMBER') { - /* $p = OCIColumnPrecision($this->_queryID, $fieldOffset); */ + //$p = OCIColumnPrecision($this->_queryID, $fieldOffset); $sc = OCIColumnScale($this->_queryID, $fieldOffset); if ($sc == 0) $fld->type = 'INT'; } return $fld; } - /* 10% speedup to move MoveNext to child class */ + // 10% speedup to move MoveNext to child class function MoveNext() { if (!$this->EOF) { @@ -132,7 +132,7 @@ class ADORecordset_oci8po extends ADORecordset_oci8 { return $results; } - /* Uggh - a useless slowdown */ + // Uggh - a useless slowdown function _updatefields() { $arr = array(); diff --git a/lib/adodb/drivers/adodb-odbc.inc.php b/lib/adodb/drivers/adodb-odbc.inc.php index a80399a174..28a88b30a3 100644 --- a/lib/adodb/drivers/adodb-odbc.inc.php +++ b/lib/adodb/drivers/adodb-odbc.inc.php @@ -20,13 +20,13 @@ class ADODB_odbc extends ADOConnection { var $databaseType = "odbc"; var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d, h:i:sA'"; - var $replaceQuote = "''"; /* string to use to replace quotes */ + var $replaceQuote = "''"; // string to use to replace quotes var $dataProvider = "odbc"; var $hasAffectedRows = true; var $binmode = ODBC_BINMODE_RETURN; - /* var $longreadlen = 8000; // default number of chars to return for a Blob/Long field */ + //var $longreadlen = 8000; // default number of chars to return for a Blob/Long field var $_bindInputArray = false; - var $curmode = SQL_CUR_USE_DRIVER; /* See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L */ + var $curmode = SQL_CUR_USE_DRIVER; // See sqlext.h, SQL_CUR_DEFAULT == SQL_CUR_USE_DRIVER == 2L var $_genSeqSQL = "create table %s (id integer)"; var $_autocommit = true; var $_haserrorfunctions = true; @@ -54,8 +54,8 @@ class ADODB_odbc extends ADOConnection { */ function GenID($seq='adodbseq',$start=1) { - /* if you have to modify the parameter below, your database is overloaded, */ - /* or you need to implement generation of id's yourself! */ + // if you have to modify the parameter below, your database is overloaded, + // or you need to implement generation of id's yourself! $MAXLOOPS = 100; while (--$MAXLOOPS>=0) { @@ -87,15 +87,15 @@ class ADODB_odbc extends ADOConnection { if (empty($this->_connectionID)) $e = @odbc_error(); else $e = @odbc_error($this->_connectionID); - /* bug in 4.0.6, error number can be corrupted string (should be 6 digits) */ - /* so we check and patch */ + // bug in 4.0.6, error number can be corrupted string (should be 6 digits) + // so we check and patch if (strlen($e)<=2) return 0; return $e; } else return ADOConnection::ErrorNo(); } - /* returns true or false */ + // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; @@ -104,11 +104,11 @@ class ADODB_odbc extends ADOConnection { $this->_connectionID = odbc_connect($argDSN,$argUsername,$argPassword,$this->curmode); $this->_errorMsg = $php_errormsg; - /* if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); */ + //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); return $this->_connectionID != false; } - /* returns true or false */ + // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; @@ -116,7 +116,7 @@ class ADODB_odbc extends ADOConnection { $this->_connectionID = odbc_pconnect($argDSN,$argUsername,$argPassword,$this->curmode); $this->_errorMsg = $php_errormsg; - /* if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); */ + //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); return $this->_connectionID != false; } @@ -157,7 +157,7 @@ class ADODB_odbc extends ADOConnection { $rs->_has_stupid_odbc_fetch_api_change = $this->_has_stupid_odbc_fetch_api_change; - /* print_r($rs); */ + //print_r($rs); $arr = $rs->GetArray(); $rs->Close(); $arr2 = array(); @@ -196,9 +196,9 @@ class ADODB_odbc extends ADOConnection { case 12: case 0: return 'C'; - case -1: /* text */ + case -1: //text return 'X'; - case -4: /* image */ + case -4: //image return 'B'; case 91: @@ -213,9 +213,9 @@ class ADODB_odbc extends ADOConnection { case -6: return 'I'; - case -11: /* uniqidentifier */ + case -11: // uniqidentifier return 'R'; - case -7: /* bit */ + case -7: //bit return 'L'; default: @@ -267,17 +267,17 @@ class ADODB_odbc extends ADOConnection { break; $rs->MoveNext(); } - $rs->Close(); /* -- crashes 4.03pl1 -- why? */ + $rs->Close(); //-- crashes 4.03pl1 -- why? return $retarr; } function Prepare($sql) { - if (! $this->_bindInputArray) return $sql; /* no binding */ + if (! $this->_bindInputArray) return $sql; // no binding $stmt = odbc_prepare($this->_connectionID,$sql); if (!$stmt) { - /* print "Prepare Error for ($sql) ".$this->ErrorMsg()."
"; */ + // print "Prepare Error for ($sql) ".$this->ErrorMsg()."
"; return $sql; } return array($sql,$stmt,false); @@ -334,7 +334,7 @@ class ADODB_odbc extends ADOConnection { return $this->Execute("UPDATE $table SET $column=? WHERE $where",array($val)) != false; } - /* returns true or false */ + // returns true or false function _close() { $ret = @odbc_close($this->_connectionID); @@ -369,10 +369,10 @@ class ADORecordSet_odbc extends ADORecordSet { } - /* returns the field object */ + // returns the field object function &FetchField($fieldOffset = -1) { - $off=$fieldOffset+1; /* offsets begin at 1 */ + $off=$fieldOffset+1; // offsets begin at 1 $o= new ADOFieldObject(); $o->name = @odbc_field_name($this->_queryID,$off); @@ -412,7 +412,7 @@ class ADORecordSet_odbc extends ADORecordSet { return false; } - /* speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated */ + // speed up SelectLimit() by switching to ADODB_FETCH_NUM as ADODB_FETCH_ASSOC is emulated function GetArrayLimit($nrows,$offset=-1) { if ($offset <= 0) return $this->GetArray($nrows); diff --git a/lib/adodb/drivers/adodb-odbc_mssql.inc.php b/lib/adodb/drivers/adodb-odbc_mssql.inc.php index 0fb61a1876..6bc0adffbb 100644 --- a/lib/adodb/drivers/adodb-odbc_mssql.inc.php +++ b/lib/adodb/drivers/adodb-odbc_mssql.inc.php @@ -22,7 +22,7 @@ class ADODB_odbc_mssql extends ADODB_odbc { var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d h:i:sA'"; var $_bindInputArray = true; - var $hasTop = 'top'; /* support mssql/interbase SELECT TOP 10 * FROM TABLE */ + var $hasTop = 'top'; // support mssql/interbase SELECT TOP 10 * FROM TABLE var $sysDate = 'GetDate()'; var $sysTimeStamp = 'GetDate()'; diff --git a/lib/adodb/drivers/adodb-odbc_oracle.inc.php b/lib/adodb/drivers/adodb-odbc_oracle.inc.php index b3a0685c4a..329c2b9f38 100644 --- a/lib/adodb/drivers/adodb-odbc_oracle.inc.php +++ b/lib/adodb/drivers/adodb-odbc_oracle.inc.php @@ -18,7 +18,7 @@ if (!defined('_ADODB_ODBC_LAYER')) { class ADODB_odbc_oracle extends ADODB_odbc { var $databaseType = 'odbc_oracle'; - var $replaceQuote = "''"; /* string to use to replace quotes */ + var $replaceQuote = "''"; // string to use to replace quotes var $concat_operator='||'; var $fmtDate = "'Y-m-d 00:00:00'"; var $fmtTimeStamp = "'Y-m-d h:i:sA'"; @@ -27,7 +27,7 @@ class ADODB_odbc_oracle extends ADODB_odbc { var $sysDate = "TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD')"; var $sysTimeStamp = 'SYSDATE'; - /* var $_bindInputArray = false; */ + //var $_bindInputArray = false; function ADODB_odbc_oracle() { @@ -58,7 +58,7 @@ class ADODB_odbc_oracle extends ADODB_odbc { if ($rs === false) return false; $retarr = array(); - while (!$rs->EOF) { /* print_r($rs->fields); */ + while (!$rs->EOF) { //print_r($rs->fields); $fld = new ADOFieldObject(); $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; @@ -73,7 +73,7 @@ class ADODB_odbc_oracle extends ADODB_odbc { return false; } - /* returns true or false */ + // returns true or false function _connect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; @@ -83,10 +83,10 @@ class ADODB_odbc_oracle extends ADODB_odbc { $this->_errorMsg = $php_errormsg; $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); - /* if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); */ + //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); return $this->_connectionID != false; } - /* returns true or false */ + // returns true or false function _pconnect($argDSN, $argUsername, $argPassword, $argDatabasename) { global $php_errormsg; @@ -95,7 +95,7 @@ class ADODB_odbc_oracle extends ADODB_odbc { $this->_errorMsg = $php_errormsg; $this->Execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"); - /* if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); */ + //if ($this->_connectionID) odbc_autocommit($this->_connectionID,true); return $this->_connectionID != false; } } diff --git a/lib/adodb/drivers/adodb-oracle.inc.php b/lib/adodb/drivers/adodb-oracle.inc.php index f541c28629..cfcbd4e8e5 100644 --- a/lib/adodb/drivers/adodb-oracle.inc.php +++ b/lib/adodb/drivers/adodb-oracle.inc.php @@ -13,14 +13,14 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese */ -/* select table_name from cat -- MetaTables */ -/* */ +// select table_name from cat -- MetaTables +// class ADODB_oracle extends ADOConnection { var $databaseType = "oracle"; - var $replaceQuote = "\'"; /* string to use to replace quotes */ + var $replaceQuote = "\'"; // string to use to replace quotes var $concat_operator='||'; var $_curs; - var $_initdate = true; /* init date to YYYY-MM-DD */ + var $_initdate = true; // init date to YYYY-MM-DD var $metaTablesSQL = 'select table_name from cat'; var $metaColumnsSQL = "select cname,coltype,width from col where tname='%s' order by colno"; var $sysDate = "TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD')"; @@ -30,14 +30,14 @@ class ADODB_oracle extends ADOConnection { { } - /* format and return date string in database date format */ + // format and return date string in database date format function DBDate($d) { if (is_string($d)) $d = ADORecordSet::UnixDate($d); return 'TO_DATE('.date($this->fmtDate,$d).",'YYYY-MM-DD')"; } - /* format and return date string in database timestamp format */ + // format and return date string in database timestamp format function DBTimeStamp($ts) { if (is_string($ts)) $d = ADORecordSet::UnixTimeStamp($ts); @@ -81,12 +81,12 @@ class ADODB_oracle extends ADOConnection { } - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { if ($argHostname) putenv("ORACLE_HOME=$argHostname"); if ($argDatabasename) $argUsername .= "@$argDatabasename"; - /* if ($argHostname) print "

Connect: 1st argument should be left blank for $this->databaseType

"; */ + //if ($argHostname) print "

Connect: 1st argument should be left blank for $this->databaseType

"; $this->_connectionID = ora_logon($argUsername,$argPassword); if ($this->_connectionID === false) return false; if ($this->autoCommit) ora_commiton($this->_connectionID); @@ -94,12 +94,12 @@ class ADODB_oracle extends ADOConnection { return true; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { if ($argHostname) putenv("ORACLE_HOME=$argHostname"); if ($argDatabasename) $argUsername .= "@$argDatabasename"; - /* if ($argHostname) print "

PConnect: 1st argument should be left blank for $this->databaseType

"; */ + //if ($argHostname) print "

PConnect: 1st argument should be left blank for $this->databaseType

"; $this->_connectionID = ora_plogon($argUsername,$argPassword); if ($this->_connectionID === false) return false; if ($this->autoCommit) ora_commiton($this->_connectionID); @@ -108,7 +108,7 @@ class ADODB_oracle extends ADOConnection { return true; } - /* returns query ID if successful, otherwise false */ + // returns query ID if successful, otherwise false function _query($sql,$inputarr) { $curs = ora_open($this->_connectionID); @@ -122,7 +122,7 @@ class ADODB_oracle extends ADOConnection { return false; } - /* returns true or false */ + // returns true or false function _close() { if (!$this->autoCommit) ora_rollback($this->_connectionID); @@ -207,7 +207,7 @@ class ADORecordset_oracle extends ADORecordSet { } function _fetch($ignore_fields=false) { -/* should remove call by reference, but ora_fetch_into requires it in 4.0.3pl1 */ +// should remove call by reference, but ora_fetch_into requires it in 4.0.3pl1 if ($this->fetchMode & ADODB_FETCH_ASSOC) return @ora_fetch_into($this->_queryID,&$this->fields,ORA_FETCHINTO_NULLS|ORA_FETCHINTO_ASSOC); else @@ -242,7 +242,7 @@ class ADORecordset_oracle extends ADORecordSet { case 'DATE': return 'D'; - /* case 'T': return 'T'; */ + //case 'T': return 'T'; case 'BIT': return 'L'; case 'INT': diff --git a/lib/adodb/drivers/adodb-postgres.inc.php b/lib/adodb/drivers/adodb-postgres.inc.php index 956fad521f..a5eb150447 100644 --- a/lib/adodb/drivers/adodb-postgres.inc.php +++ b/lib/adodb/drivers/adodb-postgres.inc.php @@ -15,15 +15,15 @@ include_once(ADODB_DIR."/drivers/adodb-postgres64.inc.php"); class ADODB_postgres extends ADODB_postgres64 { var $databaseType = 'postgres'; - var $hasLimit = true; /* set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 */ + var $hasLimit = true; // set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 function ADODB_postgres() { } - /* the following should be compat with postgresql 7.2, */ - /* which makes obsolete the LIMIT limit,offset syntax */ + // the following should be compat with postgresql 7.2, + // which makes obsolete the LIMIT limit,offset syntax function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$arg3=false,$secs2cache=0) { $offsetStr = ($offset >= 0) ? " OFFSET $offset" : ''; @@ -34,7 +34,7 @@ class ADODB_postgres extends ADODB_postgres64 { $this->Execute($sql."$limitStr$offsetStr",$inputarr,$arg3); } - /* 10% speedup to move MoveNext to child class */ + // 10% speedup to move MoveNext to child class function MoveNext() { if (!$this->EOF) { diff --git a/lib/adodb/drivers/adodb-postgres64.inc.php b/lib/adodb/drivers/adodb-postgres64.inc.php index 5c7aaf307e..e796621bd2 100644 --- a/lib/adodb/drivers/adodb-postgres64.inc.php +++ b/lib/adodb/drivers/adodb-postgres64.inc.php @@ -25,7 +25,7 @@ class ADODB_postgres64 extends ADOConnection{ var $_resultid = false; var $concat_operator='||'; var $metaTablesSQL = "select tablename from pg_tables where tablename not like 'pg_%' order by 1"; - var $isoDates = true; /* accepts dates in ISO format */ + var $isoDates = true; // accepts dates in ISO format var $sysDate = "CURRENT_DATE"; var $sysTimeStamp = "CURRENT_TIMESTAMP"; @@ -39,38 +39,38 @@ UNION SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg_%' ORDER BY 1" */ var $metaColumnsSQL = "SELECT a.attname,t.typname,a.attlen,a.atttypmod,a.attnotnull,a.atthasdef,a.attnum FROM pg_class c, pg_attribute a,pg_type t WHERE relkind = 'r' AND c.relname='%s' AND a.attnum > 0 AND a.atttypid = t.oid AND a.attrelid = c.oid ORDER BY a.attnum"; - /* get primary key etc -- from Freek Dijkstra */ + // get primary key etc -- from Freek Dijkstra var $metaKeySQL = "SELECT ic.relname AS index_name, a.attname AS column_name,i.indisunique AS unique_key, i.indisprimary AS primary_key FROM pg_class bc, pg_class ic, pg_index i, pg_attribute a WHERE bc.oid = i.indrelid AND ic.oid = i.indexrelid AND (i.indkey[0] = a.attnum OR i.indkey[1] = a.attnum OR i.indkey[2] = a.attnum OR i.indkey[3] = a.attnum OR i.indkey[4] = a.attnum OR i.indkey[5] = a.attnum OR i.indkey[6] = a.attnum OR i.indkey[7] = a.attnum) AND a.attrelid = bc.oid AND bc.relname = '%s'"; var $_hastrans = false; var $hasAffectedRows = true; - var $hasLimit = false; /* set to true for pgsql 7 only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 */ - /* below suggested by Freek Dijkstra */ - var $true = 't'; /* string that represents TRUE for a database */ - var $false = 'f'; /* string that represents FALSE for a database */ - var $fmtDate = "'Y-m-d'"; /* used by DBDate() as the default date format used by the database */ - var $fmtTimeStamp = "'Y-m-d G:i:s'"; /* used by DBTimeStamp as the default timestamp fmt. */ + var $hasLimit = false; // set to true for pgsql 7 only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 + // below suggested by Freek Dijkstra + var $true = 't'; // string that represents TRUE for a database + var $false = 'f'; // string that represents FALSE for a database + var $fmtDate = "'Y-m-d'"; // used by DBDate() as the default date format used by the database + var $fmtTimeStamp = "'Y-m-d G:i:s'"; // used by DBTimeStamp as the default timestamp fmt. var $hasMoveFirst = true; var $hasGenID = true; var $_genIDSQL = "SELECT NEXTVAL('%s')"; var $_genSeqSQL = "CREATE SEQUENCE %s START %s"; var $metaDefaultsSQL = "SELECT d.adnum as num, d.adsrc as def from pg_attrdef d, pg_class c where d.adrelid=c.oid and c.relname='%s' order by d.adnum"; - /* The last (fmtTimeStamp is not entirely correct: */ - /* PostgreSQL also has support for time zones, */ - /* and writes these time in this format: "2001-03-01 18:59:26+02". */ - /* There is no code for the "+02" time zone information, so I just left that out. */ - /* I'm not familiar enough with both ADODB as well as Postgres */ - /* to know what the concequences are. The other values are correct (wheren't in 0.94) */ - /* -- Freek Dijkstra */ + // The last (fmtTimeStamp is not entirely correct: + // PostgreSQL also has support for time zones, + // and writes these time in this format: "2001-03-01 18:59:26+02". + // There is no code for the "+02" time zone information, so I just left that out. + // I'm not familiar enough with both ADODB as well as Postgres + // to know what the concequences are. The other values are correct (wheren't in 0.94) + // -- Freek Dijkstra function ADODB_postgres64() { - /* changes the metaColumnsSQL, adds columns: attnum[6] */ + // changes the metaColumnsSQL, adds columns: attnum[6] } - /* get the last id - never tested */ + // get the last id - never tested function pg_insert_id($tablename,$fieldname) { $result=pg_exec($this->_connectionID, "SELECT last_value FROM ${tablename}_${fieldname}_seq"); @@ -91,15 +91,15 @@ a different OID if a database must be reloaded. */ return pg_getlastoid($this->_resultid); } -/* I get this error with PHP before 4.0.6 - jlim */ -/* Warning: This compilation does not support pg_cmdtuples() in d:/inetpub/wwwroot/php/adodb/adodb-postgres.inc.php on line 44 */ +// I get this error with PHP before 4.0.6 - jlim +// Warning: This compilation does not support pg_cmdtuples() in d:/inetpub/wwwroot/php/adodb/adodb-postgres.inc.php on line 44 function _affectedrows() { return pg_cmdtuples($this->_resultid); } - /* returns true/false */ + // returns true/false function BeginTrans() { $this->_hastrans = true; @@ -112,7 +112,7 @@ a different OID if a database must be reloaded. */ return $this->GetOne("select 1 as ignore from $tables where $where for update"); } - /* returns true/false. */ + // returns true/false. function CommitTrans($ok=true) { if (!$ok) return $this->RollbackTrans(); @@ -120,7 +120,7 @@ a different OID if a database must be reloaded. */ return @pg_Exec($this->_connectionID, "commit"); } - /* returns true/false */ + // returns true/false function RollbackTrans() { $this->_hastrans = false; @@ -160,13 +160,13 @@ a different OID if a database must be reloaded. */ } - /* converts table names to lowercase */ + // converts table names to lowercase function &MetaColumns($table) { global $ADODB_FETCH_MODE; if (!empty($this->metaColumnsSQL)) { - /* the following is the only difference -- we lowercase it */ + // the following is the only difference -- we lowercase it $save = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_NUM; @@ -177,15 +177,15 @@ a different OID if a database must be reloaded. */ if ($rs === false) return false; if (!empty($this->metaKeySQL)) { - /* If we want the primary keys, we have to issue a separate query */ - /* Of course, a modified version of the metaColumnsSQL query using a */ - /* LEFT JOIN would have been much more elegant, but postgres does */ - /* not support OUTER JOINS. So here is the clumsy way. */ + // If we want the primary keys, we have to issue a separate query + // Of course, a modified version of the metaColumnsSQL query using a + // LEFT JOIN would have been much more elegant, but postgres does + // not support OUTER JOINS. So here is the clumsy way. $ADODB_FETCH_MODE = ADODB_FETCH_NUM; $rskey = $this->Execute(sprintf($this->metaKeySQL,strtolower($table))); - /* fetch all result in once for performance. */ + // fetch all result in once for performance. $keys = $rskey->GetArray(); $ADODB_FETCH_MODE = $save; @@ -217,7 +217,7 @@ a different OID if a database must be reloaded. */ } $retarr = array(); - while (!$rs->EOF) { /* print_r($rs->fields); */ + while (!$rs->EOF) { //print_r($rs->fields); $fld = new ADOFieldObject(); $fld->name = $rs->fields[0]; $fld->type = $rs->fields[1]; @@ -225,26 +225,26 @@ a different OID if a database must be reloaded. */ if ($fld->max_length <= 0) $fld->max_length = $rs->fields[3]-4; if ($fld->max_length <= 0) $fld->max_length = -1; - /* dannym */ - /* 5 hasdefault; 6 num-of-column */ + // dannym + // 5 hasdefault; 6 num-of-column $fld->has_default = ($rs->fields[5] == 't'); if ($fld->has_default) { $fld->default_value = $rsdefa[$rs->fields[6]]; } - /* Freek */ + //Freek if ($rs->fields[4] == $this->true) { $fld->not_null = true; } - /* Freek */ + // Freek if (is_array($keys)) { reset ($keys); while (list($x,$key) = each($keys)) { if ($fld->name == $key['column_name'] AND $key['primary_key'] == $this->true) $fld->primary_key = true; if ($fld->name == $key['column_name'] AND $key['unique_key'] == $this->true) - $fld->unique = true; /* What name is more compatible? */ + $fld->unique = true; // What name is more compatible? } } @@ -273,11 +273,11 @@ a different OID if a database must be reloaded. */ } - /* returns true or false */ - /* */ - /* examples: */ - /* $db->Connect("host=host1 user=user1 password=secret port=4341"); */ - /* $db->Connect('host1','user1','secret'); */ + // returns true or false + // + // examples: + // $db->Connect("host=host1 user=user1 password=secret port=4341"); + // $db->Connect('host1','user1','secret'); function _connect($str,$user='',$pwd='',$db='') { if ($user || $pwd || $db) { @@ -292,18 +292,18 @@ a different OID if a database must be reloaded. */ if ($db) $str .= " dbname=".$db; } - /* if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432"; */ + //if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432"; $this->_connectionID = pg_connect($str); if ($this->_connectionID === false) return false; $this->Execute("set datestyle='ISO'"); return true; } - /* returns true or false */ - /* */ - /* examples: */ - /* $db->PConnect("host=host1 user=user1 password=secret port=4341"); */ - /* $db->PConnect('host1','user1','secret'); */ + // returns true or false + // + // examples: + // $db->PConnect("host=host1 user=user1 password=secret port=4341"); + // $db->PConnect('host1','user1','secret'); function _pconnect($str,$user='',$pwd='',$db='') { if ($user || $pwd || $db) { @@ -316,14 +316,14 @@ a different OID if a database must be reloaded. */ if ($user) $str .= " user=".$user; if ($pwd) $str .= " password=".$pwd; if ($db) $str .= " dbname=".$db; - }/* print $str; */ + }//print $str; $this->_connectionID = pg_pconnect($str); if ($this->_connectionID === false) return false; $this->Execute("set datestyle='ISO'"); return true; } - /* returns queryID or false */ + // returns queryID or false function _query($sql,$inputarr) { $this->_resultid= pg_Exec($this->_connectionID,$sql); @@ -339,7 +339,7 @@ a different OID if a database must be reloaded. */ return $this->_errorMsg; } - /* returns true or false */ + // returns true or false function _close() { if ($this->_hastrans) $this->RollbackTrans(); @@ -377,7 +377,7 @@ a different OID if a database must be reloaded. */ */ function CharMax() { - return 1000000000; /* should be 1 Gb? */ + return 1000000000; // should be 1 Gb? } /* @@ -385,7 +385,7 @@ a different OID if a database must be reloaded. */ */ function TextMax() { - return 1000000000; /* should be 1 Gb? */ + return 1000000000; // should be 1 Gb? } @@ -445,14 +445,14 @@ class ADORecordSet_postgres64 extends ADORecordSet{ function &FetchField($fieldOffset = 0) { - $off=$fieldOffset; /* offsets begin at 0 */ + $off=$fieldOffset; // offsets begin at 0 $o= new ADOFieldObject(); $o->name = @pg_fieldname($this->_queryID,$off); $o->type = @pg_fieldtype($this->_queryID,$off); $o->max_length = @pg_fieldsize($this->_queryID,$off); - /* print_r($o); */ - /* print "off=$off name=$o->name type=$o->type len=$o->max_length
"; */ + //print_r($o); + //print "off=$off name=$o->name type=$o->type len=$o->max_length
"; return $o; } @@ -461,7 +461,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{ return @pg_fetch_row($this->_queryID,$row); } - /* 10% speedup to move MoveNext to child class */ + // 10% speedup to move MoveNext to child class function MoveNext() { if (!$this->EOF) { @@ -495,9 +495,9 @@ class ADORecordSet_postgres64 extends ADORecordSet{ case 'TEXT': return 'X'; - case 'IMAGE': /* user defined type */ - case 'BLOB': /* user defined type */ - case 'BIT': /* This is a bit string, not a single bit, so don't return 'L' */ + case 'IMAGE': // user defined type + case 'BLOB': // user defined type + case 'BIT': // This is a bit string, not a single bit, so don't return 'L' case 'VARBIT': case 'BYTEA': return 'B'; diff --git a/lib/adodb/drivers/adodb-postgres7.inc.php b/lib/adodb/drivers/adodb-postgres7.inc.php index 25d57cd764..eced3fdb6e 100644 --- a/lib/adodb/drivers/adodb-postgres7.inc.php +++ b/lib/adodb/drivers/adodb-postgres7.inc.php @@ -15,15 +15,15 @@ include_once(ADODB_DIR."/drivers/adodb-postgres64.inc.php"); class ADODB_postgres7 extends ADODB_postgres64 { var $databaseType = 'postgres7'; - var $hasLimit = true; /* set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 */ + var $hasLimit = true; // set to true for pgsql 6.5+ only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 function ADODB_postgres7() { } - /* the following should be compat with postgresql 7.2, */ - /* which makes obsolete the LIMIT limit,offset syntax */ + // the following should be compat with postgresql 7.2, + // which makes obsolete the LIMIT limit,offset syntax function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$arg3=false,$secs2cache=0) { $offsetStr = ($offset >= 0) ? " OFFSET $offset" : ''; @@ -34,7 +34,7 @@ class ADODB_postgres7 extends ADODB_postgres64 { $this->Execute($sql."$limitStr$offsetStr",$inputarr,$arg3); } - /* 10% speedup to move MoveNext to child class */ + // 10% speedup to move MoveNext to child class function MoveNext() { if (!$this->EOF) { diff --git a/lib/adodb/drivers/adodb-proxy.inc.php b/lib/adodb/drivers/adodb-proxy.inc.php index 62636e39ec..ffa1be2516 100644 --- a/lib/adodb/drivers/adodb-proxy.inc.php +++ b/lib/adodb/drivers/adodb-proxy.inc.php @@ -25,6 +25,6 @@ if (! defined("_ADODB_PROXY_LAYER")) { $this->ADORecordset($id); } }; -} /* define */ +} // define ?> \ No newline at end of file diff --git a/lib/adodb/drivers/adodb-sqlanywhere.inc.php b/lib/adodb/drivers/adodb-sqlanywhere.inc.php index 19ecee5112..36654c13c6 100644 --- a/lib/adodb/drivers/adodb-sqlanywhere.inc.php +++ b/lib/adodb/drivers/adodb-sqlanywhere.inc.php @@ -147,7 +147,7 @@ if (!defined('ADODB_SYBASE_SQLANYWHERE')){ $this->drop_blobvar($blobVarName); return true; } - }; /* class */ + }; //class class ADORecordSet_sqlanywhere extends ADORecordSet_odbc { @@ -159,8 +159,8 @@ if (!defined('ADODB_SYBASE_SQLANYWHERE')){ } - }; /* class */ + }; //class -} /* define */ +} //define ?> diff --git a/lib/adodb/drivers/adodb-sybase.inc.php b/lib/adodb/drivers/adodb-sybase.inc.php index 024ee1da82..7ed6fce4d3 100644 --- a/lib/adodb/drivers/adodb-sybase.inc.php +++ b/lib/adodb/drivers/adodb-sybase.inc.php @@ -17,7 +17,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim. All rights reserved. class ADODB_sybase extends ADOConnection { var $databaseType = "sybase"; - var $replaceQuote = "''"; /* string to use to replace quotes */ + var $replaceQuote = "''"; // string to use to replace quotes var $fmtDate = "'Y-m-d'"; var $fmtTimeStamp = "'Y-m-d H:i:s'"; var $hasInsertID = true; @@ -33,12 +33,12 @@ class ADODB_sybase extends ADOConnection { { } - /* might require begintrans -- committrans */ + // might require begintrans -- committrans function _insertid() { return $this->GetOne('select @@identity'); } - /* might require begintrans -- committrans */ + // might require begintrans -- committrans function _affectedrows() { return $this->GetOne('select @@rowcount'); @@ -64,7 +64,7 @@ class ADODB_sybase extends ADOConnection { return true; } - /* http://www.isug.com/Sybase_FAQ/ASE/section6.1.html#6.1.4 */ + // http://www.isug.com/Sybase_FAQ/ASE/section6.1.html#6.1.4 function RowLock($tables,$where) { if (!$this->_hastrans) $this->BeginTrans(); @@ -89,7 +89,7 @@ class ADODB_sybase extends ADOConnection { return $this->_errorMsg; } - /* returns true or false */ + // returns true or false function _connect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = sybase_connect($argHostname,$argUsername,$argPassword); @@ -97,7 +97,7 @@ class ADODB_sybase extends ADOConnection { if ($argDatabasename) return $this->SelectDB($argDatabasename); return true; } - /* returns true or false */ + // returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { $this->_connectionID = sybase_pconnect($argHostname,$argUsername,$argPassword); @@ -106,14 +106,14 @@ class ADODB_sybase extends ADOConnection { return true; } - /* returns query ID if successful, otherwise false */ + // returns query ID if successful, otherwise false function _query($sql,$inputarr) { - /* @sybase_free_result($this->_queryID); */ + //@sybase_free_result($this->_queryID); return sybase_query($sql,$this->_connectionID); } - /* See http://www.isug.com/Sybase_FAQ/ASE/section6.2.html#6.2.12 */ + // See http://www.isug.com/Sybase_FAQ/ASE/section6.2.html#6.2.12 function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$arg3=false,$secs2cache=0) { $cnt = ($nrows > 0) ? $nrows : 0; @@ -126,7 +126,7 @@ class ADODB_sybase extends ADOConnection { return $rs; } - /* returns true or false */ + // returns true or false function _close() { return @sybase_close($this->_connectionID); @@ -155,7 +155,7 @@ class ADORecordset_sybase extends ADORecordSet { var $databaseType = "sybase"; var $canSeek = true; - /* _mths works only in non-localised system */ + // _mths works only in non-localised system var $_mths = array('JAN'=>1,'FEB'=>2,'MAR'=>3,'APR'=>4,'MAY'=>5,'JUN'=>6,'JUL'=>7,'AUG'=>8,'SEP'=>9,'OCT'=>10,'NOV'=>11,'DEC'=>12); function ADORecordset_sybase($id) @@ -179,7 +179,7 @@ class ADORecordset_sybase extends ADORecordSet { else if ($fieldOffset == -1) { /* The $fieldOffset argument is not provided thus its -1 */ $o = @sybase_fetch_field($this->_queryID); } - /* older versions of PHP did not support type, only numeric */ + // older versions of PHP did not support type, only numeric if ($o && !isset($o->type)) $o->type = ($o->numeric) ? 'float' : 'varchar'; return $o; } @@ -209,7 +209,7 @@ class ADORecordset_sybase extends ADORecordSet { return @sybase_free_result($this->_queryID); } - /* sybase/mssql uses a default date like Dec 30 2000 12:00AM */ + // sybase/mssql uses a default date like Dec 30 2000 12:00AM function UnixDate($v) { return ADORecordSet_array_sybase::UnixDate($v); @@ -227,12 +227,12 @@ class ADORecordSet_array_sybase extends ADORecordSet_array { $this->ADORecordSet_array($id); } - /* sybase/mssql uses a default date like Dec 30 2000 12:00AM */ + // sybase/mssql uses a default date like Dec 30 2000 12:00AM function UnixDate($v) { global $ADODB_sybase_mths; - /* Dec 30 2000 12:00AM */ + //Dec 30 2000 12:00AM if (!ereg( "([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})" ,$v, $rr)) return parent::UnixDate($v); @@ -241,15 +241,15 @@ class ADORecordSet_array_sybase extends ADORecordSet_array { $themth = substr(strtoupper($rr[1]),0,3); $themth = $ADODB_sybase_mths[$themth]; if ($themth <= 0) return false; - /* h-m-s-MM-DD-YY */ + // h-m-s-MM-DD-YY return mktime(0,0,0,$themth,$rr[2],$rr[3]); } function UnixTimeStamp($v) { global $ADODB_sybase_mths; - /* 11.02.2001 Toni Tunkkari toni.tunkkari@finebyte.com */ - /* Changed [0-9] to [0-9 ] in day conversion */ + //11.02.2001 Toni Tunkkari toni.tunkkari@finebyte.com + //Changed [0-9] to [0-9 ] in day conversion if (!ereg( "([A-Za-z]{3})[-/\. ]([0-9 ]{1,2})[-/\. ]([0-9]{4}) +([0-9]{1,2}):([0-9]{1,2}) *([apAP]{0,1})" ,$v, $rr)) return parent::UnixTimeStamp($v); if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0; @@ -268,7 +268,7 @@ class ADORecordSet_array_sybase extends ADORecordSet_array { default: break; } - /* h-m-s-MM-DD-YY */ + // h-m-s-MM-DD-YY return mktime($rr[4],$rr[5],0,$themth,$rr[2],$rr[3]); } } diff --git a/lib/adodb/drivers/adodb-vfp.inc.php b/lib/adodb/drivers/adodb-vfp.inc.php index f9a1bc035a..7cdb15192e 100644 --- a/lib/adodb/drivers/adodb-vfp.inc.php +++ b/lib/adodb/drivers/adodb-vfp.inc.php @@ -23,9 +23,9 @@ class ADODB_vfp extends ADODB_odbc { var $replaceQuote = "'+chr(39)+'" ; var $true = '.T.'; var $false = '.F.'; - var $hasTop = 'top'; /* support mssql SELECT TOP 10 * FROM TABLE */ + var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE var $upperCase = 'upper'; - var $_bindInputArray = false; /* strangely enough, setting to true does not work reliably */ + var $_bindInputArray = false; // strangely enough, setting to true does not work reliably var $sysTimeStamp = 'datetime()'; var $sysDate = 'date()'; @@ -36,7 +36,7 @@ class ADODB_vfp extends ADODB_odbc { function BeginTrans() { return false;} - /* quote string to be sent back to database */ + // quote string to be sent back to database function qstr($s,$nofixquotes=false) { if (!$nofixquotes) return "'".str_replace("\r\n","'+chr(13)+'",str_replace("'",$this->replaceQuote,$s))."'"; @@ -44,7 +44,7 @@ class ADODB_vfp extends ADODB_odbc { } - /* TOP requires ORDER BY for VFP */ + // TOP requires ORDER BY for VFP function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$arg3=false,$secs2cache=0) { if (!preg_match('/ORDER[ \t\r\n]+BY/i',$sql)) $sql .= ' ORDER BY 1'; @@ -86,5 +86,5 @@ class ADORecordSet_vfp extends ADORecordSet_odbc { } } -} /* define */ +} //define ?> \ No newline at end of file diff --git a/lib/adodb/readme.htm b/lib/adodb/readme.htm index 26fb5f7549..46aabb13f5 100644 --- a/lib/adodb/readme.htm +++ b/lib/adodb/readme.htm @@ -101,7 +101,7 @@ This means you can use it in proprietary and commercial products.

will contribute drivers to support other databases.

PHP4 supports session variables. You can store your session information using ADOdb for true portability and scalability. See ADOdb-session.php for more information.

-

Also read http://php.weblogs.com/portable_sql */ +

Also read http://php.weblogs.com/portable_sql (also available as tips_portable_sql.htm in the release) for tips on writing portable SQL.

Unique Features of ADOdb

@@ -120,25 +120,25 @@ This means you can use it in proprietary and commercial products.

How People are using ADOdb

Here are some examples of how people are using ADOdb (for a much longer list, -visit http://php.weblogs.com/ADOdb-cool-applications): */ +visit http://php.weblogs.com/ADOdb-cool-applications):
    -
  • PhpLens is a commercial data grid component that allows both cool Web designers and serious unshaved programmers to develop and maintain databases on the Web easily. Developed by the author of ADOdb.

    */ +

  • PhpLens is a commercial data grid component that allows both cool Web designers and serious unshaved programmers to develop and maintain databases on the Web easily. Developed by the author of ADOdb.

    -

  • PHAkt: PHP Extension for DreamWeaver Ultradev allows you to script PHP in the popular Web page editor. Database handling provided by ADOdb.

    */ +

  • PHAkt: PHP Extension for DreamWeaver Ultradev allows you to script PHP in the popular Web page editor. Database handling provided by ADOdb.

    -

  • Analysis Console for Intrusion Databases (ACID): PHP-based analysis engine to search and process a database of security incidents generated by security-related software such as IDSes and firewalls (e.g. Snort, ipchains). By Roman Danyliw.

    */ +

  • Analysis Console for Intrusion Databases (ACID): PHP-based analysis engine to search and process a database of security incidents generated by security-related software such as IDSes and firewalls (e.g. Snort, ipchains). By Roman Danyliw.

    -

  • PostNuke is a very popular free content management */ +
  • PostNuke is a very popular free content management system and weblog system. It offers full CSS support, HTML 4.01 transitional compliance throughout, an advanced blocks system, and is fully multi-lingual enabled.

    -

  • EasyPublish CMS is another free content management system for managing information and integrated modules on your internet, intranet- and extranet-sites. From Norway.

    */ +

  • EasyPublish CMS is another free content management system for managing information and integrated modules on your internet, intranet- and extranet-sites. From Norway.

    -

  • NOLA is a full featured accounting, inventory, and job tracking application. It is licensed under the GPL, and developed by Noguska. */ +
  • NOLA is a full featured accounting, inventory, and job tracking application. It is licensed under the GPL, and developed by Noguska.

Feature Requests and Bug Reports

Feature requests and bug reports can be emailed to jlim#natsoft.com.my - or posted to the ADOdb Help forums at http://phplens.com/lens/lensforum/topics.php?id=4.

*/ + or posted to the ADOdb Help forums at http://phplens.com/lens/lensforum/topics.php?id=4.

Installation Guide

Make sure you are running PHP4.01pl2 or later (it uses require_once and include_once). Unpack all the files into a directory accessible by your webserver.

@@ -224,7 +224,7 @@ You will use $conn->Connect() or
Y/N DB2 CLI/ODBC interface -

Unix and Windows. Unix */ +

Unix and Windows. Unix install hints.

Y/N Mssql client -

Unix and Windows.
*/ +

Unix and Windows.
Unix install howto
.

? depends on database ODBCUnix and Windows. Unix */ + Unix and Windows. Unix hints.
 

Close(); */ + //$db->Close(); } include("testdatabases.inc.php"); diff --git a/lib/adodb/tests/client.php b/lib/adodb/tests/client.php index af9757be9e..eb5e8c92c9 100644 --- a/lib/adodb/tests/client.php +++ b/lib/adodb/tests/client.php @@ -10,7 +10,7 @@ * set tabs to 8 */ - /* documentation on usage is at http://php.weblogs.com/adodb_csv */ + // documentation on usage is at http://php.weblogs.com/adodb_csv include('../adodb.inc.php'); include('../tohtml.inc.php'); @@ -30,7 +30,7 @@ include('../tohtml.inc.php'); } -$serverURL = 'http:/* localhost/php/phplens/adodb/server.php'; */ +$serverURL = 'http://localhost/php/phplens/adodb/server.php'; $testhttp = false; $sql1 = "insertz into products (productname) values ('testprod 1')"; diff --git a/lib/adodb/tests/test.php b/lib/adodb/tests/test.php index faa951de30..bdd14080f6 100644 --- a/lib/adodb/tests/test.php +++ b/lib/adodb/tests/test.php @@ -26,7 +26,7 @@ if (sizeof($HTTP_GET_VARS) == 0) $testmysql = true; This script tests the following databases: Interbase, Oracle, Visual FoxPro, Microsoft Access (ODBC and ADO), MySQL, MSSQL (ODBC, native, ADO). There is also support for Sybase, PostgreSQL.

-For the latest version of ADODB, visit php.weblogs.com.

*/ +For the latest version of ADODB, visit php.weblogs.com.

> Access
@@ -46,7 +46,7 @@ Test GetInsertSQL/GetUpdateSQL   FETCH MODE IS NOT ADODB_FETCH_DEFAULT"; -/* the table creation code is specific to the database, so we allow the user */ -/* to define their own table creation stuff */ +// the table creation code is specific to the database, so we allow the user +// to define their own table creation stuff function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)") { GLOBAL $ADODB_vers,$ADODB_CACHE_DIR,$ADODB_FETCH_MODE, $HTTP_GET_VARS,$ADODB_COUNTRECS; @@ -94,7 +94,7 @@ GLOBAL $ADODB_vers,$ADODB_CACHE_DIR,$ADODB_FETCH_MODE, $HTTP_GET_VARS,$ADODB_COU print "
ts3 (1970-1-2 +/- timezone) = ".$db->DBTimeStamp(24*3600); $dd = $db->UnixDate('1999-02-20'); print "
unixdate 1999-02-20 = ".date('Y-m-d',$dd)."

"; - /* mssql too slow in failing bad connection */ + // mssql too slow in failing bad connection if ($db->databaseType != 'mssql') { print "

Testing bad connection. Ignore following error msgs:
"; $db2 = ADONewConnection(); @@ -105,16 +105,16 @@ GLOBAL $ADODB_vers,$ADODB_CACHE_DIR,$ADODB_FETCH_MODE, $HTTP_GET_VARS,$ADODB_COU } error_reporting($e); - /* $ADODB_COUNTRECS=false; */ + //$ADODB_COUNTRECS=false; $rs=$db->Execute('select * from adoxyz order by id'); - /* print_r($rs); */ - /* OCIFetchStatement($rs->_queryID,$rez,0,-1);//,OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); */ - /* print_r($rez); */ - /* die(); */ + //print_r($rs); + //OCIFetchStatement($rs->_queryID,$rez,0,-1);//,OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW); + //print_r($rez); + //die(); if($rs === false) $create = true; else $rs->Close(); - /* if ($db->databaseType !='vfp') $db->Execute("drop table ADOXYZ"); */ + //if ($db->databaseType !='vfp') $db->Execute("drop table ADOXYZ"); if ($create) { if ($db->databaseType == 'ibase') { @@ -128,7 +128,7 @@ GLOBAL $ADODB_vers,$ADODB_CACHE_DIR,$ADODB_FETCH_MODE, $HTTP_GET_VARS,$ADODB_COU } } - $rs = &$db->Execute("delete from ADOXYZ"); /* some ODBC drivers will fail the drop so we delete */ + $rs = &$db->Execute("delete from ADOXYZ"); // some ODBC drivers will fail the drop so we delete if ($rs) { if(! $rs->EOF)print "Error: RecordSet returned by Execute('delete...') should show EOF

"; $rs->Close(); @@ -140,7 +140,7 @@ GLOBAL $ADODB_vers,$ADODB_CACHE_DIR,$ADODB_FETCH_MODE, $HTTP_GET_VARS,$ADODB_COU if ($rs) $rs->Close(); - /* $db->debug=true; */ + //$db->debug=true; print "

Testing Commit: "; $time = $db->DBDate(time()); if (!$db->BeginTrans()) print 'Transactions not supported

'; @@ -311,7 +311,7 @@ GO $db->debug = false; $ADODB_FETCH_MODE = ADODB_FETCH_BOTH; - /* //////////////////////////////////////////////////////////////////////////////////////// */ + ////////////////////////////////////////////////////////////////////////////////////////// $rs = &$db->Execute("select id,firstname as TheFirstName,lastname,created from ADOXYZ order by id"); if ($rs) { @@ -342,7 +342,7 @@ GO $rs = &$db->Execute('select * from ADOXYZ'); if (empty($rs->connection)) print "Connection object missing from recordset
"; - while ($o = $rs->FetchNextObject()) { /* calls FetchObject internally */ + while ($o = $rs->FetchNextObject()) { // calls FetchObject internally if (!is_string($o->FIRSTNAME) || !is_string($o->LASTNAME)) { print_r($o); print "

Firstname is not string

"; @@ -355,7 +355,7 @@ GO $rs = &$db->Execute('select * from ADOXYZ'); if (empty($rs->connection)) print "Connection object missing from recordset
"; - while ($o = $rs->FetchNextObject()) { /* calls FetchObject internally */ + while ($o = $rs->FetchNextObject()) { // calls FetchObject internally if (!is_string($o->FIRSTNAME) || !is_string($o->LASTNAME)) { print_r($o); print "

Firstname is not string

"; @@ -420,7 +420,7 @@ GO if (trim($arr['firstname']) != 'Caroline') {print "Error 2
"; print_r($arr);}; } - /* $db->debug = true; */ + //$db->debug = true; print "

SelectLimit Test 1: Should see Caroline, John and Mary

"; $rs = &$db->SelectLimit('select distinct * from ADOXYZ order by id',3); if ($rs && !$rs->EOF) { @@ -431,7 +431,7 @@ GO if (trim($rs->fields[1]) != 'Mary') print "Error 3
"; $rs->MoveNext(); if (! $rs->EOF) print "Not EOF
"; - /* rs2html($rs); */ + //rs2html($rs); } else "

Failed SelectLimit Test 1

"; print "

SelectLimit Test 2: Should see Mary, George and Mr. Alan

"; @@ -444,7 +444,7 @@ GO if (trim($rs->fields[1]) != 'Mr. Alan') print "Error 3
"; $rs->MoveNext(); if (! $rs->EOF) print "Not EOF
"; - /* rs2html($rs); */ + // rs2html($rs); } else "

Failed SelectLimit Test 2

"; @@ -457,7 +457,7 @@ GO if (trim($rs->fields[1]) != 'Steven') print "Error 2
"; $rs->MoveNext(); if (! $rs->EOF) print "Not EOF
"; - /* rs2html($rs); */ + //rs2html($rs); } else "

Failed SelectLimit Test 3

"; $db->debug = false; @@ -476,7 +476,7 @@ GO } else print "MoveFirst() OK
"; - /* Move(3) tests error handling -- MoveFirst should not move cursor */ + // Move(3) tests error handling -- MoveFirst should not move cursor $rs->Move(3); if (trim($rs->Fields("firstname")) != 'George') { print '

'.$rs->Fields("id")."$db->databaseType: Move(3) failed

"; @@ -497,7 +497,7 @@ GO } } - /* $db->debug=true; */ + // $db->debug=true; print "

Testing ADODB_FETCH_ASSOC and concat: concat firstname and lastname

"; $save = $ADODB_FETCH_MODE; @@ -589,7 +589,7 @@ GO if ($val == 0) echo "

GenID not supported"; echo "

"; - if (substr($db->dataProvider,0,3) != 'notused') { /* used to crash ado */ + if (substr($db->dataProvider,0,3) != 'notused') { // used to crash ado $sql = "select firstnames from adoxyz"; print "

Testing execution of illegal statement: $sql

"; if ($db->Execute($sql) === false) { @@ -665,7 +665,7 @@ GO } else { print "

\$db->sysDate not defined

"; } - /* PEAR TESTS BELOW */ + // PEAR TESTS BELOW $ADODB_FETCH_MODE = ADODB_FETCH_NUM; $pear = true; $rs = $db->query('select * from adoxyz order by id'); @@ -674,7 +674,7 @@ GO if ($rs && !$rs->EOF) { while ($arr = $rs->fetchRow()) { $i++; - /* print "$i "; */ + //print "$i "; if ($arr[0] != $i) { print "

PEAR DB emulation error 1.

"; $pear = false; @@ -716,7 +716,7 @@ GO if ($ret != 1) print "Replace failed: "; print "test B return value=$ret (1 expected)

"; - /* /////////////////////////////////////////////////////////// */ + ///////////////////////////////////////////////////////////// @@ -733,8 +733,8 @@ GO while (!is_object($rs->fetchInto($arr))) { $i2++; - /* print_r($arr); */ - /* print "$i ";print_r($arr); */ + // print_r($arr); + // print "$i ";print_r($arr); if ($arr[0] != $i2) { print "

PEAR DB emulation error 2.

"; $pear = false; diff --git a/lib/adodb/tests/test2.php b/lib/adodb/tests/test2.php index 3f4d3480ba..8056bf5d3f 100644 --- a/lib/adodb/tests/test2.php +++ b/lib/adodb/tests/test2.php @@ -1,4 +1,4 @@ - */ + diff --git a/lib/adodb/tests/test4.php b/lib/adodb/tests/test4.php index 7e8799c92a..66cb9d6b4d 100644 --- a/lib/adodb/tests/test4.php +++ b/lib/adodb/tests/test4.php @@ -20,54 +20,54 @@ function testsql() include('../adodb.inc.php'); include('../tohtml.inc.php'); -/* ========================== */ -/* This code tests an insert */ +//========================== +// This code tests an insert $sql = "SELECT * FROM ADOXYZ WHERE id = -1"; -/* Select an empty record from the database */ +// Select an empty record from the database -$conn = &ADONewConnection("mysql"); /* create a connection */ +$conn = &ADONewConnection("mysql"); // create a connection $conn->debug=1; -$conn->PConnect("localhost", "root", "", "test"); /* connect to MySQL, testdb */ +$conn->PConnect("localhost", "root", "", "test"); // connect to MySQL, testdb $conn->Execute("delete from adoxyz where lastname like 'Smith%'"); -$rs = $conn->Execute($sql); /* Execute the query and get the empty recordset */ -$record = array(); /* Initialize an array to hold the record data to insert */ +$rs = $conn->Execute($sql); // Execute the query and get the empty recordset +$record = array(); // Initialize an array to hold the record data to insert -/* Set the values for the fields in the record */ +// Set the values for the fields in the record $record["firstname"] = "Bob"; -$record["lastname"] = "Smith\$@/* "; */ +$record["lastname"] = "Smith\$@//"; $record["created"] = time(); -/* Pass the empty recordset and the array containing the data to insert */ -/* into the GetInsertSQL function. The function will process the data and return */ -/* a fully formatted insert sql statement. */ +// Pass the empty recordset and the array containing the data to insert +// into the GetInsertSQL function. The function will process the data and return +// a fully formatted insert sql statement. $insertSQL = $conn->GetInsertSQL($rs, $record); -$conn->Execute($insertSQL); /* Insert the record into the database */ +$conn->Execute($insertSQL); // Insert the record into the database -/* ========================== */ -/* This code tests an update */ +//========================== +// This code tests an update $sql = "SELECT * FROM ADOXYZ WHERE lastname=".$conn->qstr($record['lastname']); -/* Select a record to update */ +// Select a record to update -$rs = $conn->Execute($sql); /* Execute the query and get the existing record to update */ +$rs = $conn->Execute($sql); // Execute the query and get the existing record to update if (!$rs) print "

No record found!

"; -$record = array(); /* Initialize an array to hold the record data to update */ +$record = array(); // Initialize an array to hold the record data to update -/* Set the values for the fields in the record */ +// Set the values for the fields in the record $record["firstname"] = "Caroline".rand(); -$record["lastname"] = "Smithy"; /* Update Caroline's lastname from Miranda to Smith */ +$record["lastname"] = "Smithy"; // Update Caroline's lastname from Miranda to Smith $record["created"] = '2002-12-'.(rand()%30+1); -/* Pass the single record recordset and the array containing the data to update */ -/* into the GetUpdateSQL function. The function will process the data and return */ -/* a fully formatted update sql statement. */ -/* If the data has not changed, no recordset is returned */ +// Pass the single record recordset and the array containing the data to update +// into the GetUpdateSQL function. The function will process the data and return +// a fully formatted update sql statement. +// If the data has not changed, no recordset is returned $updateSQL = $conn->GetUpdateSQL($rs, $record); -$conn->Execute($updateSQL); /* Update the record in the database */ +$conn->Execute($updateSQL); // Update the record in the database print "

Rows Affected=".$conn->Affected_Rows()."

"; rs2html($conn->Execute("select * from adoxyz where lastname like 'Smith%'")); diff --git a/lib/adodb/tests/test5.php b/lib/adodb/tests/test5.php index 5d89e70c51..b4c1f3291f 100644 --- a/lib/adodb/tests/test5.php +++ b/lib/adodb/tests/test5.php @@ -10,7 +10,7 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese */ -/* Select an empty record from the database */ +// Select an empty record from the database include('../adodb.inc.php'); include('../tohtml.inc.php'); @@ -23,16 +23,16 @@ if (0) { } if (0) { - $conn = &ADONewConnection("oci8"); /* create a connection */ + $conn = &ADONewConnection("oci8"); // create a connection $conn->debug=1; - $conn->PConnect("falcon", "scott", "tiger", "juris8.ecosystem.natsoft.com.my"); /* connect to MySQL, testdb */ + $conn->PConnect("falcon", "scott", "tiger", "juris8.ecosystem.natsoft.com.my"); // connect to MySQL, testdb print $conn->databaseType.':'.$conn->GenID(); } if (0) { - $conn = &ADONewConnection("ibase"); /* create a connection */ + $conn = &ADONewConnection("ibase"); // create a connection $conn->debug=1; - $conn->Connect("localhost:c:\\Interbase\\Examples\\Database\\employee.gdb", "sysdba", "masterkey", ""); /* connect to MySQL, testdb */ + $conn->Connect("localhost:c:\\Interbase\\Examples\\Database\\employee.gdb", "sysdba", "masterkey", ""); // connect to MySQL, testdb print $conn->databaseType.':'.$conn->GenID().'
'; } diff --git a/lib/adodb/tests/testdatabases.inc.php b/lib/adodb/tests/testdatabases.inc.php index dcccbabe42..2e0745ecf3 100644 --- a/lib/adodb/tests/testdatabases.inc.php +++ b/lib/adodb/tests/testdatabases.inc.php @@ -9,8 +9,8 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese /* this file is used by the ADODB test program: test.php */ -/* cannot test databases below, but we include them anyway to check */ -/* if they parse ok... */ +// cannot test databases below, but we include them anyway to check +// if they parse ok... ADOLoadCode("sybase"); ADOLoadCode("postgres"); ADOLoadCode("postgres7"); @@ -20,7 +20,7 @@ ADOLoadCode("informix"); ADOLoadCode("sqlanywhere"); if (!empty($testpostgres)) { - /* ADOLoadCode("postgres"); */ + //ADOLoadCode("postgres"); $db = &ADONewConnection('postgres64'); print "

Connecting $db->databaseType...

"; if (@$db->PConnect("susetikus","tester","test","test")) { @@ -38,7 +38,7 @@ if (!empty($testibase)) { } -/* REQUIRES ODBC DSN CALLED nwind */ +// REQUIRES ODBC DSN CALLED nwind if (!empty($testaccess)) { $db = &ADONewConnection('access'); @@ -50,7 +50,7 @@ if (!empty($testaccess)) { } -if (!empty($testaccess) && !empty($testado)) { /* ADO ACCESS */ +if (!empty($testaccess) && !empty($testado)) { // ADO ACCESS $db = &ADONewConnection("ado_access"); print "

Connecting $db->databaseType...

"; @@ -58,7 +58,7 @@ if (!empty($testaccess) && !empty($testado)) { /* ADO ACCESS */ $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;' . 'DATA SOURCE=' . $access . ';'; - /* . 'USER ID=;PASSWORD=;'; */ + //. 'USER ID=;PASSWORD=;'; if (@$db->PConnect($myDSN, "", "", "")) { print "ADO version=".$db->_connectionID->version."
"; @@ -67,7 +67,7 @@ if (!empty($testaccess) && !empty($testado)) { /* ADO ACCESS */ } -if (!empty($testvfp)) { /* ODBC */ +if (!empty($testvfp)) { // ODBC $db = &ADONewConnection('vfp'); @@ -79,8 +79,8 @@ if (!empty($testvfp)) { /* ODBC */ } -/* REQUIRES MySQL server at localhost with database 'test' */ -if (!empty($testmysql)) { /* MYSQL */ +// REQUIRES MySQL server at localhost with database 'test' +if (!empty($testmysql)) { // MYSQL $db = &ADONewConnection('maxsql'); print "

Connecting $db->databaseType...

"; @@ -95,7 +95,7 @@ if (!empty($testmysql)) { /* MYSQL */ print "

Connecting $db->databaseType...

"; if ($HTTP_SERVER_VARS['HTTP_HOST'] == 'localhost') $server = 'localhost'; - if ($db->PConnect('http:/* localhost/php/phplens/adodb/server.php')) */ + if ($db->PConnect('http://localhost/php/phplens/adodb/server.php')) testdb($db, "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); @@ -109,12 +109,12 @@ if (!empty($testoracle)) { $db = ADONewConnection('oci8po'); print "

Connecting $db->databaseType...

"; if ($db->Connect('', "scott", "tiger",'natsoft.ecosystem.natsoft.com.my')) - /* if ($db->PConnect("", "scott", "tiger", "juris.ecosystem.natsoft.com.my")) */ + //if ($db->PConnect("", "scott", "tiger", "juris.ecosystem.natsoft.com.my")) testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); else print "ERROR: Oracle test requires an Oracle server setup with scott/tiger".'
'.$db->ErrorMsg(); } -ADOLoadCode("oracle"); /* no longer supported */ +ADOLoadCode("oracle"); // no longer supported if (false && !empty($testoracle)) { $db = ADONewConnection(); @@ -127,7 +127,7 @@ if (false && !empty($testoracle)) { ADOLoadCode("odbc_mssql"); -if (!empty($testmssql) && false) { /* MS SQL Server via ODBC */ +if (!empty($testmssql) && false) { // MS SQL Server via ODBC $db = ADONewConnection(); @@ -140,7 +140,7 @@ if (!empty($testmssql) && false) { /* MS SQL Server via ODBC */ ADOLoadCode("ado_mssql"); -if (!empty($testmssql) && !empty($testado) ) { /* ADO ACCESS MSSQL -- thru ODBC -- DSN-less */ +if (!empty($testmssql) && !empty($testado) ) { // ADO ACCESS MSSQL -- thru ODBC -- DSN-less $db = &ADONewConnection("ado_mssql"); $db->debug=1; @@ -158,7 +158,7 @@ if (!empty($testmssql) && !empty($testado) ) { /* ADO ACCESS MSSQL -- thru ODBC ADOLoadCode("mssql"); -if (!empty($testmssql)) { /* MS SQL Server -- the extension is buggy -- probably better to use ODBC */ +if (!empty($testmssql)) { // MS SQL Server -- the extension is buggy -- probably better to use ODBC $db = ADONewConnection(); $db->debug=1; print "

Connecting $db->databaseType...

"; @@ -172,13 +172,13 @@ if (!empty($testmssql)) { /* MS SQL Server -- the extension is buggy -- probabl } -if (!empty($testmssql) && !empty($testado)) { /* ADO ACCESS MSSQL with OLEDB provider */ +if (!empty($testmssql) && !empty($testado)) { // ADO ACCESS MSSQL with OLEDB provider $db = &ADONewConnection("ado_mssql"); print "

Connecting DSN-less OLEDB Provider $db->databaseType...

"; $db->debug=1; $myDSN="SERVER=mangrove;DATABASE=ai;"; - /* $myDSN='SERVER=(local)\NetSDK;DATABASE=northwind;'; */ + //$myDSN='SERVER=(local)\NetSDK;DATABASE=northwind;'; if ($db->PConnect($myDSN, "sa", "natsoft", 'SQLOLEDB')) testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='mangrove', userid='sa', password='', database='ai'"; diff --git a/lib/adodb/tests/testgenid.php b/lib/adodb/tests/testgenid.php index 2906bcf8ab..5112e4b0c7 100644 --- a/lib/adodb/tests/testgenid.php +++ b/lib/adodb/tests/testgenid.php @@ -14,7 +14,7 @@ function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname char(24) $table = 'adodbseq'; $db->Execute("drop table $table"); - /* $db->debug=true; */ + //$db->debug=true; $ctr = 5000; $lastnum = 0; diff --git a/lib/adodb/tests/testmssql.php b/lib/adodb/tests/testmssql.php index 547211391f..10050a085a 100644 --- a/lib/adodb/tests/testmssql.php +++ b/lib/adodb/tests/testmssql.php @@ -19,18 +19,18 @@ error_reporting(E_ALL); include('../adodb.inc.php'); include('../tohtml.inc.php'); -/* ========================== */ -/* This code tests an insert */ +//========================== +// This code tests an insert -$conn = &ADONewConnection("odbc_mssql"); /* create a connection */ +$conn = &ADONewConnection("odbc_mssql"); // create a connection $conn->Connect('sqlserver','sa','natsoft'); -/* $conn = &ADONewConnection("mssql"); */ -/* $conn->Connect('mangrove','sa','natsoft','ai'); */ +//$conn = &ADONewConnection("mssql"); +//$conn->Connect('mangrove','sa','natsoft','ai'); -/* $conn->Connect('mangrove','sa','natsoft','ai'); */ +//$conn->Connect('mangrove','sa','natsoft','ai'); $conn->debug=1; $conn->Execute('delete from blobtest'); @@ -44,7 +44,7 @@ $fd = fopen($output, "wb"); fwrite($fd, $rs->fields[0]); fclose($fd); -print " View Image"; */ -/* $rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest'); */ -/* rs2html($rs); */ +print " View Image"; +//$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest'); +//rs2html($rs); ?> \ No newline at end of file diff --git a/lib/adodb/tests/testoci8.php b/lib/adodb/tests/testoci8.php index 7e54729100..f6519161b2 100644 --- a/lib/adodb/tests/testoci8.php +++ b/lib/adodb/tests/testoci8.php @@ -22,7 +22,7 @@ if (1) { if (!empty($testblob)) { $varHoldingBlob = 'ABC DEF GEF John TEST'; $num = time()%10240; - /* create table atable (id integer, ablob blob); */ + // create table atable (id integer, ablob blob); $db->Execute('insert into ATABLE (id,ablob) values('.$num.',empty_blob())'); $db->UpdateBlob('ATABLE', 'ablob', $varHoldingBlob, 'id='.$num, 'BLOB'); @@ -51,8 +51,8 @@ if (1) { print $db->Affected_Rows().'
'; $stmt = &$db->Prepare('insert into emp (empno, ename) values (:empno, :ename)'); $rs = $db->Execute($stmt,array('empno'=>4321,'ename'=>'John')); - /* prepare not quite ready for prime time */ - /* $rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John')); */ + // prepare not quite ready for prime time + //$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John')); if (!$rs) die("Empty RS"); } diff --git a/lib/adodb/tests/testpaging.php b/lib/adodb/tests/testpaging.php index 44b144f203..c04d38eb75 100644 --- a/lib/adodb/tests/testpaging.php +++ b/lib/adodb/tests/testpaging.php @@ -47,11 +47,11 @@ if (empty($driver) or $driver == 'mysql') { $db->Connect('localhost','root','','xphplens'); } -/* $db->pageExecuteCountRows = false; */ +//$db->pageExecuteCountRows = false; $db->debug = true; $pager = new ADODB_Pager($db,$sql); -/* $pager->cache = 60; */ +//$pager->cache = 60; $pager->Render($rows=7); ?> \ No newline at end of file diff --git a/lib/adodb/tests/testpear.php b/lib/adodb/tests/testpear.php index d33364c330..7665f4c365 100644 --- a/lib/adodb/tests/testpear.php +++ b/lib/adodb/tests/testpear.php @@ -18,7 +18,7 @@ $hostname = 'localhost'; $databasename = 'xphplens'; $driver = 'mysql'; -$dsn = "$driver:/* $username:$password@$hostname/$databasename"; */ +$dsn = "$driver://$username:$password@$hostname/$databasename"; $db = DB::Connect($dsn); $db->setFetchMode(ADODB_FETCH_ASSOC); diff --git a/lib/adodb/tips_portable_sql.htm b/lib/adodb/tips_portable_sql.htm index d3500f874b..d58d3a337e 100644 --- a/lib/adodb/tips_portable_sql.htm +++ b/lib/adodb/tips_portable_sql.htm @@ -1,4 +1,4 @@ - */ + @@ -15,7 +15,7 @@ Dimension in my Mac days, to the databases I currently use, which are: Oracle, FoxPro, Access, MS SQL Server and MySQL. Although most of the advice here applies to using SQL with Perl, Python and other programming languages, I will focus on PHP and how - the ADOdb database abstraction library */ + the ADOdb database abstraction library offers some solutions.

Most database vendors practice product lock-in. The best or fastest way to do things is often implemented using proprietary extensions to SQL. This makes @@ -257,8 +257,8 @@ $rs = $db->Execute(sprintf($sqlSearchKeyWord,$db->qstr($word))); sound principles. Learn the theory of normalization and entity-relationship diagrams and model your data carefully. Understand how joins and indexes work and how they are used to tune performance.

Visit the following page for more references on database theory and vendors: - http://php.weblogs.com/sql_tutorial. */ - Also read this article on Optimizing PHP. */ + http://php.weblogs.com/sql_tutorial. + Also read this article on Optimizing PHP.

(c) 2002 John Lim. diff --git a/lib/adodb/toexport.inc.php b/lib/adodb/toexport.inc.php index a11d219ccc..e1ff267396 100644 --- a/lib/adodb/toexport.inc.php +++ b/lib/adodb/toexport.inc.php @@ -21,22 +21,22 @@ * rscsvout($rs); */ -/* returns a recordset as a csv string */ +// returns a recordset as a csv string function rs2csv(&$rs,$addtitles=true) { return _adodb_export($rs,',',',',false,$addtitles); } -/* writes recordset to csv file */ +// writes recordset to csv file function rs2csvfile(&$rs,$fp,$addtitles=true) { _adodb_export($rs,',',',',$fp,$addtitles); } -/* write recordset as csv string to stdout */ +// write recordset as csv string to stdout function rs2csvout(&$rs,$addtitles=true) { - $fp = fopen('php:/* stdout','wb'); */ + $fp = fopen('php://stdout','wb'); _adodb_export($rs,',',',',true,$addtitles); fclose($fp); } @@ -46,16 +46,16 @@ function tab2csv(&$rs,$addtitles=true) return _adodb_export($rs,"\t",',',false,$addtitles); } -/* to file pointer */ +// to file pointer function tab2csvfile(&$rs,$fp,$addtitles=true) { _adodb_export($rs,"\t",',',$fp,$addtitles); } -/* to stdout */ +// to stdout function tab2csvout(&$rs,$addtitles=true) { - $fp = fopen('php:/* stdout','wb'); */ + $fp = fopen('php://stdout','wb'); _adodb_export($rs,"\t",' ',true,$addtitles); fclose($fp); } @@ -63,8 +63,8 @@ function tab2csvout(&$rs,$addtitles=true) function _adodb_export(&$rs,$sep,$sepreplace,$fp=false,$addtitles=true,$quote = '"',$escquote = '"',$replaceNewLine = ' ') { if (!$rs) return ''; - /* ---------- */ - /* CONSTANTS */ + //---------- + // CONSTANTS $NEWLINE = "\r\n"; $BUFLINES = 100; $escquotequote = $escquote.$quote; @@ -100,7 +100,7 @@ function _adodb_export(&$rs,$sep,$sepreplace,$fp=false,$addtitles=true,$quote = if (strpos($v,$sep) || strpos($v,$quote))$elements[] = "$quote$v$quote"; else $elements[] = $v; } - } else { /* ASSOCIATIVE ARRAY */ + } else { // ASSOCIATIVE ARRAY foreach($rs->fields as $v) { if ($escquote) $v = str_replace($quote,$escquotequote,$v); $v = strip_tags(str_replace("\n",$replaceNewLine,str_replace($sep,$sepreplace,$v))); diff --git a/lib/adodb/tohtml.inc.php b/lib/adodb/tohtml.inc.php index bd722fbc1b..2cbaf44c24 100644 --- a/lib/adodb/tohtml.inc.php +++ b/lib/adodb/tohtml.inc.php @@ -8,33 +8,33 @@ V2.12 12 June 2002 (c) 2000-2002 John Lim (jlim@natsoft.com.my). All rights rese Some pretty-printing by Chris Oxenreider */ -/* specific code for tohtml */ +// specific code for tohtml GLOBAL $gSQLMaxRows,$gSQLBlockRows; -$gSQLMaxRows = 1000; /* max no of rows to download */ -$gSQLBlockRows=20; /* max no of rows per table block */ +$gSQLMaxRows = 1000; // max no of rows to download +$gSQLBlockRows=20; // max no of rows per table block -/* RecordSet to HTML Table */ -/* ------------------------------------------------------------ */ -/* Convert a recordset to a html table. Multiple tables are generated */ -/* if the number of rows is > $gSQLBlockRows. This is because */ -/* web browsers normally require the whole table to be downloaded */ -/* before it can be rendered, so we break the output into several */ -/* smaller faster rendering tables. */ -/* */ -/* $rs: the recordset */ -/* $ztabhtml: the table tag attributes (optional) */ -/* $zheaderarray: contains the replacement strings for the headers (optional) */ -/* */ -/* USAGE: */ -/* include('adodb.inc.php'); */ -/* $db = ADONewConnection('mysql'); */ -/* $db->Connect('mysql','userid','password','database'); */ -/* $rs = $db->Execute('select col1,col2,col3 from table'); */ -/* rs2html($rs, 'BORDER=2', array('Title1', 'Title2', 'Title3')); */ -/* $rs->Close(); */ -/* */ -/* RETURNS: number of rows displayed */ +// RecordSet to HTML Table +//------------------------------------------------------------ +// Convert a recordset to a html table. Multiple tables are generated +// if the number of rows is > $gSQLBlockRows. This is because +// web browsers normally require the whole table to be downloaded +// before it can be rendered, so we break the output into several +// smaller faster rendering tables. +// +// $rs: the recordset +// $ztabhtml: the table tag attributes (optional) +// $zheaderarray: contains the replacement strings for the headers (optional) +// +// USAGE: +// include('adodb.inc.php'); +// $db = ADONewConnection('mysql'); +// $db->Connect('mysql','userid','password','database'); +// $rs = $db->Execute('select col1,col2,col3 from table'); +// rs2html($rs, 'BORDER=2', array('Title1', 'Title2', 'Title3')); +// $rs->Close(); +// +// RETURNS: number of rows displayed function rs2html(&$rs,$ztabhtml='',$zheaderarray="") { $s ='';$rows=0;$docnt = false; @@ -46,7 +46,7 @@ GLOBAL $gSQLMaxRows,$gSQLBlockRows; } if (! $ztabhtml) $ztabhtml = "BORDER='1' WIDTH='98%'"; - /* else $docnt = true; */ + //else $docnt = true; $typearr = array(); $ncols = $rs->FieldCount(); $hdr = "\n\n"; @@ -55,7 +55,7 @@ GLOBAL $gSQLMaxRows,$gSQLBlockRows; if ($zheaderarray) $fname = $zheaderarray[$i]; else $fname = htmlspecialchars($field->name); $typearr[$i] = $rs->MetaType($field->type,$field->max_length); - /* print " $field->name $field->type $typearr[$i] "; */ + //print " $field->name $field->type $typearr[$i] "; if (empty($fname)) $fname = ' '; $hdr .= ""; @@ -63,7 +63,7 @@ GLOBAL $gSQLMaxRows,$gSQLBlockRows; print $hdr."\n\n"; - /* smart algorithm - handles ADODB_FETCH_MODE's correctly! */ + // smart algorithm - handles ADODB_FETCH_MODE's correctly! $numoffset = isset($rs->fields[0]); while (!$rs->EOF) { $s .= "\n"; @@ -91,25 +91,25 @@ GLOBAL $gSQLMaxRows,$gSQLBlockRows; $s = stripslashes($s); $s = urldecode($s); } - } /* for */ + } // for $s .= "\n\n"; $rows += 1; if ($rows >= $gSQLMaxRows) { $rows = "

Truncated at $gSQLMaxRows

"; break; - } /* switch */ + } // switch $rs->MoveNext(); - /* additional EOF check to prevent a widow header */ + // additional EOF check to prevent a widow header if (!$rs->EOF && $rows % $gSQLBlockRows == 0) { - /* if (connection_aborted()) break;// not needed as PHP aborts script, unlike ASP */ + //if (connection_aborted()) break;// not needed as PHP aborts script, unlike ASP print $s . "
$fname
\n\n"; $s = $hdr; } - } /* while */ + } // while print $s."\n\n"; @@ -123,7 +123,7 @@ function arr2html(&$arr,$ztabhtml='',$zheaderarray='') { if (!$ztabhtml) $ztabhtml = 'BORDER=1'; - $s = "";/* ';print_r($arr); */ + $s = "
";//';print_r($arr); if ($zheaderarray) { $s .= ''; diff --git a/lib/adodb/tute.htm b/lib/adodb/tute.htm index b84cc9ee8c..4fba780afd 100644 --- a/lib/adodb/tute.htm +++ b/lib/adodb/tute.htm @@ -1,4 +1,4 @@ - */ + @@ -41,7 +41,7 @@

ADODB stands for Active Data Objects DataBase (sorry computer guys are sometimes not very original). ADODB currently supports MySQL, PostgreSQL, Oracle, Interbase, Microsoft SQL Server, Access, FoxPro, Sybase, ODBC and ADO. You can download - ADODB from http://php.weblogs.com/adodb. */ + ADODB from http://php.weblogs.com/adodb.

MySQL Example

The most common database used with PHP is MySQL, so I guess you should be familiar with the following code. It connects to a MySQL server at localhost, @@ -133,8 +133,8 @@ $db->Connect("localhost", "root", "password&q $rs1 = $db->Execute('select * from table'); $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $rs2 = $db->Execute('select * from table'); - print_r($rs1->fields); /* shows array([0]=>'v0',[1] =>'v1') */ - print_r($rs2->fields); /* shows array(['col1']=>'v0',['col2'] =>'v1') */ + print_r($rs1->fields); // shows array([0]=>'v0',[1] =>'v1') + print_r($rs2->fields); // shows array(['col1']=>'v0',['col2'] =>'v1')

As you can see in the above example, both recordsets store and use different fetch modes @@ -160,7 +160,7 @@ based on the $ADODB_FETCH_MODE setting when the recordset was created by Execute $conn->PConnect('localhost','userid','password','database'); $rs = $conn->Execute('select * from table'); rs2html($rs); /* recordset to html table */ -

There are many other helper functions that are listed in the documentation available at http://php.weblogs.com/adodb_manual. */ +

There are many other helper functions that are listed in the documentation available at http://php.weblogs.com/adodb_manual.

Advanced Material

Inserts and Updates

Let's say you want to insert the following data into a database. @@ -228,7 +228,7 @@ $connection->CacheSelectLimit($secs2cache,$sql,$nrows,$offset).

PHP4 Session Handler Support

ADODB also supports PHP4 session handlers. You can store your session variables in a database for true scalability using ADODB. For further information, visit - http://php.weblogs.com/adodb-sessions */ + http://php.weblogs.com/adodb-sessions

Commercial Use Encouraged

If you plan to write commercial PHP applications that you want to resell, you should consider ADODB. It has been released using the lesser GPL, which means you can legally include it in commercial applications, while keeping your code proprietary. Commercial use of ADODB is strongly encouraged! We are using it internally for this reason.