linpha-cvs Mailing List for LinPHA PHP Photo Gallery (Page 4)
Status: Inactive
Brought to you by:
bzrudi
You can subscribe to this list here.
2006 |
Jan
|
Feb
(143) |
Mar
(104) |
Apr
(127) |
May
(20) |
Jun
(10) |
Jul
(28) |
Aug
(48) |
Sep
(55) |
Oct
(85) |
Nov
(57) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(16) |
Feb
(41) |
Mar
(56) |
Apr
(8) |
May
(1) |
Jun
(9) |
Jul
(54) |
Aug
(24) |
Sep
(2) |
Oct
(14) |
Nov
(30) |
Dec
(7) |
2008 |
Jan
(48) |
Feb
(52) |
Mar
(18) |
Apr
(30) |
May
(4) |
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <fan...@us...> - 2008-02-17 22:50:19
|
Revision: 4880 http://linpha.svn.sourceforge.net/linpha/?rev=4880&view=rev Author: fangehrn Date: 2008-02-17 14:50:14 -0800 (Sun, 17 Feb 2008) Log Message: ----------- 2008-02-17 flo * implemented adodb datadict - mysql works - sqlite works - fixed plugin tables creation - fixed reset_database.php * changed mysql to utf8 - database creation - table creation - database connection Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_db.php trunk/linpha2/admin/settings_plugins.php trunk/linpha2/install/footer.php trunk/linpha2/install/header_html.php trunk/linpha2/install/manual_install.php trunk/linpha2/install/step4_selectdirectories.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step8_testing.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/include/sql/sql.tables.php trunk/linpha2/lib/plugins/example/sql/sql.data.php trunk/linpha2/lib/plugins/maps/sql/sql.data.php trunk/linpha2/reset_database.php Added Paths: ----------- trunk/linpha2/lib/adodb/datadict/datadict-sqlite.inc.php trunk/linpha2/lib/include/sql/sql.tablesconfig.php Removed Paths: ------------- trunk/linpha2/lib/include/sql/sql.info.txt trunk/linpha2/lib/include/sql/sql.mysql.php trunk/linpha2/lib/include/sql/sql.oci8po.php trunk/linpha2/lib/include/sql/sql.postgres.php trunk/linpha2/lib/include/sql/sql.sqlite.php trunk/linpha2/lib/plugins/example/sql/sql.mysql.php trunk/linpha2/lib/plugins/example/sql/sql.oci8po.php trunk/linpha2/lib/plugins/example/sql/sql.postgres.php trunk/linpha2/lib/plugins/example/sql/sql.sqlite.php trunk/linpha2/lib/plugins/maps/sql/sql.mysql.php trunk/linpha2/lib/plugins/maps/sql/sql.oci8po.php trunk/linpha2/lib/plugins/maps/sql/sql.postgres.php trunk/linpha2/lib/plugins/maps/sql/sql.sqlite.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/ChangeLog 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,4 +1,16 @@ +2008-02-17 flo + * implemented adodb datadict + - mysql works + - sqlite works + - fixed plugin tables creation + - fixed reset_database.php + + * changed mysql to utf8 + - database creation + - table creation + - database connection + 2008-02-13 flo * moved not needed files to the misc folder * updated adodb to version 504 Modified: trunk/linpha2/admin/maintenance_db.php =================================================================== --- trunk/linpha2/admin/maintenance_db.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/admin/maintenance_db.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -323,7 +323,7 @@ else { echo '<font color="red">'.i18n("failed").'</font><br />'; - echo i18n("Please check the database, these entry is missing!").'<br />'; + echo i18n("Please check the database, this entry is missing!").'<br />'; } echo '<br />'; } Modified: trunk/linpha2/admin/settings_plugins.php =================================================================== --- trunk/linpha2/admin/settings_plugins.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/admin/settings_plugins.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -11,77 +11,90 @@ /** * save settings before showing menu */ - if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') - { - foreach($arrPlugins as $value) - { - $arrPluginsFullName[] = 'plugins_'.$value.'_enable'; - } - - /** - * create database tables and insert config data if necessary - */ - foreach($arrPlugins as $value) // go through all plugins - { - // only if we enabled the plugin now and it didn't existed before - if( isset($_POST['plugins_'.$value.'_enable']) - && $_POST['plugins_'.$value.'_enable']=='1' - && !isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) ) - { - $str1 = i18n("Enabling plugin \"%s\""); - linSysLog( sprintf($str1,$LinAdmin->description_array['plugins_'.$value]) ); - - /** - * create database tables - */ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.'.LIN_DB_TYPE.'.php'; - if( file_exists($includeFile) ) - { - $sql_tables = array(); - include($includeFile); + if($cat3=='enable' && isset($_POST['cmd']) && $_POST['cmd']=='saveconfig') + { + $GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'] = true; + + foreach($arrPlugins as $value) + { + $arrPluginsFullName[] = 'plugins_'.$value.'_enable'; + } + + /** + * create database tables and insert config data if necessary + */ + foreach($arrPlugins as $value) // go through all plugins + { + // only if we enabled the plugin now and it didn't existed before + if( isset($_POST['plugins_'.$value.'_enable']) + && $_POST['plugins_'.$value.'_enable']=='1' + && !isset($LinAdmin->option_value_system['plugins_'.$value.'_enable']) ) + { + $str1 = i18n("Enabling plugin \"%s\""); + linSysLog( sprintf($str1,$LinAdmin->description_array['plugins_'.$value]) ); + + + $taboptarray = array(); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tablesconfig.php'); + + $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.data.php'; + if( file_exists($includeFile) ) // this file always exists (it wouldnt be a plugin otherwise) + { + $sql_queries = array(); + $linpha_tables = array(); + include_once($includeFile); + + /** + * create database tables + */ + if (LIN_DB_TYPE=='sqlite') { + $dict = &NewDataDictionary($linpha->db,'sqlite'); // force use of sqlite datadict file + } else { + $dict = &NewDataDictionary($linpha->db); + } + //$dict->debug = true; + + foreach($linpha_tables as $table_name => $table_flds) + { + $sqlarray = $dict->CreateTableSQL($table_name, $table_flds, $taboptarray); + + /** + * if the table already exists, we get automatically a nice message like + * "Table 'linpha2_plugins_maps_markers' already exists" + */ + if ($dict->ExecuteSQLArray($sqlarray, $continue_on_error = false) != 2) { + /** + * RETURNS: 0 if failed, 1 if executed all but with errors, 2 if executed successfully + * $sqlarray: an array of strings with sql code (no semicolon at the end of string) + * $contOnError: if true, then continue executing even if error occurs + */ + + linSysLog($linpha->db->ErrorMsg()); + } + } + + /** + * insert config data + */ + linSysLog(i18n("Insert config data")); + foreach($sql_queries as $sqlStr) + { + $result = $linpha->db->Execute($sqlStr); + + if(!$result) { + linSysLog($linpha->db->ErrorMsg()); + } + } + + } + } + } + unset($GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT']); + + // set plugins_*_enable to '1' + $LinAdmin->saveConfig($arrPluginsFullName); + } - linSysLog(i18n("Creating tables")); - foreach($sql_tables as $sqlStr) - { - $result = $linpha->db->Execute($sqlStr); - - // it the table already exists, we get automatically a nice message like - // "Table 'linpha2_plugins_maps_markers' already exists" - if(!$result) { - linSysLog($linpha->db->ErrorMsg()); - } - } - } - - /** - * insert config data - */ - $includeFile = LINPHA_DIR.'/lib/plugins/'.$value.'/sql/sql.data.php'; - if( file_exists($includeFile) ) // this file always exists (it wouldnt be a plugin otherwise) - { - $sql_queries = array(); - include($includeFile); - - linSysLog(i18n("Insert config data")); - foreach($sql_queries as $sqlStr) - { - $result = $linpha->db->Execute($sqlStr); - - // it the table already exists, we get automatically a nice message like - // "Table 'linpha2_plugins_maps_markers' already exists" - if(!$result) { - linSysLog($linpha->db->ErrorMsg()); - } - } - } - - } - } - - // set plugins_*_enable to '1' - $LinAdmin->saveConfig($arrPluginsFullName); - } - /** * show menu */ Modified: trunk/linpha2/install/footer.php =================================================================== --- trunk/linpha2/install/footer.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/footer.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -31,12 +31,19 @@ </div> </form> +<script language="JavaScript" type='text/javascript'> +<!-- <?php -if(isset($do_javascript_disable_button)) +if (isset($do_javascript_disable_backbutton)) { + ?> + document.back_form.submit_button.disabled = true; + <?php +} + +if (isset($do_javascript_disable_button)) +{ ?> -<script language="JavaScript" type='text/javascript'> -<!-- document.install_form.next_button.disabled = true; function checkForm() @@ -81,11 +88,13 @@ // run at startup to enable text fields if values are preentered checkForm(); -//--> -</script> <?php } ?> +//--> +</script> + + </div> </div> </body> Modified: trunk/linpha2/install/header_html.php =================================================================== --- trunk/linpha2/install/header_html.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/header_html.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -77,7 +77,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> -<title><?php echo i18n_install("LinPHA2 Install Wizzard"); ?></title> +<title><?php echo i18n_install("LinPHA 2 Installation Wizzard"); ?></title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="stylesheet" type="text/css" href="layout.css" /> @@ -91,7 +91,7 @@ <img class='header_icons' src='./graphics/start.png' /> </div> <div class="header_right"> - <h1 class="header_title"><?php echo i18n_install("Linpha 2 Installation Wizzard"); ?></h1> + <h1 class="header_title"><?php echo i18n_install("LinPHA 2 Installation Wizzard"); ?></h1> <p class='header_subinfo'><?php echo $strStep; ?></p> </div> </div> Modified: trunk/linpha2/install/manual_install.php =================================================================== --- trunk/linpha2/install/manual_install.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/manual_install.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -39,7 +39,7 @@ 'sql_prefix' => 'linpha_' ); - foreach($array AS $key=>$value) + foreach($array as $key=>$value) { if(isset($_POST[$key])) { @@ -54,19 +54,40 @@ /** * define variables manually */ - $_SESSION['sql_hostname'] = "localhost"; - $_SESSION['sql_username'] = "root"; - $_SESSION['sql_password'] = ""; - $_SESSION['sql_dbname'] = "linpha"; - $_SESSION['sql_dbport'] = "3306"; - $_SESSION['hash_secret'] = ""; - - define('LIN_PREFIX', $_SESSION['sql_prefix']); define('LIN_DB_TYPE', $_SESSION['sql_dbtype']); + $_SESSION['sql_hostname'] = "localhost"; + $_SESSION['sql_username'] = "root"; + $_SESSION['sql_password'] = ""; + $_SESSION['sql_dbname'] = "linpha"; + $_SESSION['hash_secret'] = ""; + switch(LIN_DB_TYPE) + { + case 'mysql': + $_SESSION['sql_dbport'] = "3306"; + break; + case 'sqlite': + $_SESSION['sql_hostname'] = ""; + $_SESSION['sql_username'] = ""; + $_SESSION['sql_password'] = ""; + $_SESSION['sql_dbname'] = "sqlite.db"; + $_SESSION['sql_dbport'] = ""; + break; + case 'postgres': + $_SESSION['sql_dbport'] = "5432"; + break; + case 'oci8po': + $_SESSION['sql_dbport'] = "1521"; + break; + default: + $_SESSION['sql_dbport'] = ""; + break; + } + + echo "<h2>".i18n_install("LinPHA Manual Install")."</h2>"; ?> <br /> @@ -82,29 +103,26 @@ /** * create tables */ - /** - * get table names and add prefix - */ - include_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); - foreach($linpha_tables AS $key=>$value) - { - $linpha_tables[$key] = LIN_PREFIX.$value; - } - - /** - * include sql strings - */ - include_once(LINPHA_DIR."/lib/include/sql/sql.".LIN_DB_TYPE.".php"); - - /** - * finally create tables - */ - $str_query = ""; - while( list($key,$query) = each($sql_tables) ) - { - $str_query .= $query.";\n"; - } + require_once(LINPHA_DIR.'/lib/adodb/adodb.inc.php'); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); + + $taboptarray = array(); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tablesconfig.php'); + + $db = ADONewConnection(LIN_DB_TYPE); + $dict = NewDataDictionary($db,LIN_DB_TYPE); + + $str_query = ""; + foreach($linpha_tables as $table_name => $table_flds) + { + $sqlarray = $dict->CreateTableSQL($table_name, $table_flds, $taboptarray); + foreach($sqlarray as $query) + { + $str_query .= $query.";\n"; + } + } + /** * insert data */ @@ -155,11 +173,11 @@ * sql config file */ $comment[1] = $donotchange; -$comment[2] = $changeme; $comment[3] = $changeme; $comment[4] = $changeme; $comment[5] = $changeme; -$comment[6] = $donotchange; -$comment[7] = $changeme; +$comment[2] = $changeme; $comment[3] = $changeme; $comment[4] = $changeme; $comment[5] = $changeme; $comment[6] = $changeme; +$comment[7] = $donotchange; $comment[8] = $changeme; +$str = ''; include_once(LINPHA_DIR.'/lib/include/sql/config.sql.php'); ?> <br /><br /> @@ -169,6 +187,8 @@ <br /><br /> +<b><?php echo i18n_install("Please make sure all these database, databases tables, folders and files exist before continuing."); ?></b> + <form method="POST" action="<?php echo $next_file; ?>"> <?php include_once(LINPHA_DIR.'/install/footer.php'); Modified: trunk/linpha2/install/step4_selectdirectories.php =================================================================== --- trunk/linpha2/install/step4_selectdirectories.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step4_selectdirectories.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -51,23 +51,7 @@ $_SESSION['install_mode'] = $_POST['install_mode']; } -/** - * sqlite doesn't know anyhting about username, password, hostname and - * databasename -> skip the following pages - */ - if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == "sqlite") - { - $_SESSION['sql_username'] = ''; - $_SESSION['sql_password'] = ''; - $_SESSION['sql_hostname'] = ''; - $_SESSION['sql_dbname'] = 'database.sqlite'; - $_SESSION['sql_prefix'] = 'linpha_'; - - $next_file = "step7_selectprefix.php"; - } - - include_once(LINPHA_DIR.'/install/header_html.php'); echo i18n_install("For security reasons folders were named random.").' '; Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step5_getlogin.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -64,9 +64,12 @@ header("Location: manual_install.php"); exit(); } - } +if ($_SESSION['sql_dbtype']=='sqlite') +{ + $next_file = 'step7_selectprefix.php'; +} include_once(LINPHA_DIR.'/install/header_html.php'); if(isset($_POST['cmd_step4'])) @@ -81,72 +84,82 @@ exit(); } } -?> - -<h1><?php echo $title_str[$key]; ?></h1> -<hr /> -<br /> -<?php -if($_SESSION['sql_dbtype'] == 'mysql') -{ - echo i18n_install("NOTE: If you have setup a root Password for your MySQL Database please login using your root account."); - echo "<br /><br />"; - $_SESSION['sql_dbport'] = '3306'; -} -elseif($_SESSION['sql_dbtype'] == 'postgres') +elseif ($_SESSION['sql_dbtype']=='sqlite') { - echo i18n_install("NOTE: There is currently now way to let LinPHA create the required Database, so you have to create a new Database using \"createdb\" from commandline before you proceed."); - echo "<br /><br />"; - $_SESSION['sql_dbport'] = '5432'; + // show at least one message + echo i18n_install("Directories already created."); } -elseif($_SESSION['sql_dbtype'] == 'oci8po') + +if ($_SESSION['sql_dbtype'] != 'sqlite') { - echo i18n_install("NOTE: Oracle support is only testet on XE the \"Free\" Edition. If you get things running using a \"real\" Oracle Database please drop us a note!"); - echo "<br /><br />"; - $_SESSION['sql_dbport'] = '1521'; + ?> + + <h1><?php echo $title_str[$key]; ?></h1> + <hr /> + <br /> + <?php + + if($_SESSION['sql_dbtype'] == 'mysql') + { + echo i18n_install("NOTE: If you have setup a root Password for your MySQL Database please login using your root account."); + echo "<br /><br />"; + $_SESSION['sql_dbport'] = '3306'; + } + elseif($_SESSION['sql_dbtype'] == 'postgres') + { + echo i18n_install("NOTE: There is currently now way to let LinPHA create the required Database, so you have to create a new Database using \"createdb\" from commandline before you proceed."); + echo "<br /><br />"; + $_SESSION['sql_dbport'] = '5432'; + } + elseif($_SESSION['sql_dbtype'] == 'oci8po') + { + echo i18n_install("NOTE: Oracle support is only testet on XE the \"Free\" Edition. If you get things running using a \"real\" Oracle Database please drop us a note!"); + echo "<br /><br />"; + $_SESSION['sql_dbport'] = '1521'; + } + ?> + + <div class="boxalign"> + <?php echo i18n_install("Username").":"; ?> + <input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" + name="sql_username" value="<?php echo isset($_SESSION['sql_username']) ? $_SESSION['sql_username'] : 'root' ; ?>"> + <br /> + </div> + + <div class="boxalign"> + <?php echo i18n_install("Password").":"; ?> + <input class="boxalignelement" type="password" id="check02" + onKeyup="checkForm()" name="sql_password"> + <br /> + </div> + + <div class="boxalign"> + <?php echo i18n_install("Hostname").":"; ?> + <input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" + name="sql_hostname" value="<?php echo isset($_SESSION['sql_hostname']) ? + $_SESSION['sql_hostname'] : 'localhost' ; ?>"> + </div> + + <div class="boxalign"> + <?php echo i18n_install("Port").":"; ?> + <input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" + name="sql_dbport" value="<?php echo isset($_SESSION['sql_dbport']) ? + $_SESSION['sql_dbport'] : '3306' ; ?>"> + </div> + + + <?php + + $array_check = array( + 'check01' => 'text', + //'check02' => 'text', + 'check03' => 'text', + 'check04' => 'text' + ); + + $do_javascript_disable_button = true; } -?> - -<div class="boxalign"> -<?php echo i18n_install("Username").":"; ?> -<input class="boxalignelement" type="text" id="check01" onKeyup="checkForm()" - name="sql_username" value="<?php echo isset($_SESSION['sql_username']) ? $_SESSION['sql_username'] : 'root' ; ?>"> -<br /> -</div> - -<div class="boxalign"> -<?php echo i18n_install("Password").":"; ?> -<input class="boxalignelement" type="password" id="check02" - onKeyup="checkForm()" name="sql_password"> -<br /> -</div> - -<div class="boxalign"> -<?php echo i18n_install("Hostname").":"; ?> -<input class="boxalignelement" type="text" id="check03" onKeyup="checkForm()" - name="sql_hostname" value="<?php echo isset($_SESSION['sql_hostname']) ? - $_SESSION['sql_hostname'] : 'localhost' ; ?>"> -</div> - -<div class="boxalign"> -<?php echo i18n_install("Port").":"; ?> -<input class="boxalignelement" type="text" id="check04" onKeyup="checkForm()" - name="sql_dbport" value="<?php echo isset($_SESSION['sql_dbport']) ? - $_SESSION['sql_dbport'] : '3306' ; ?>"> -</div> - - -<?php - -$array_check = array( - 'check01' => 'text', - //'check02' => 'text', - 'check03' => 'text', - 'check04' => 'text' -); - -$do_javascript_disable_button = true; include_once(LINPHA_DIR.'/install/footer.php'); /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step7_selectprefix.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -28,11 +28,17 @@ /** - * sqlite go back stuff + * sqlite go back and validation stuff */ if(isset($_SESSION['sql_dbtype']) && $_SESSION['sql_dbtype'] == "sqlite") { - $back_file = "step4_selectdirectories.php"; + $back_file = "step5_getlogin.php"; + + $_SESSION['sql_username'] = ''; + $_SESSION['sql_password'] = ''; + $_SESSION['sql_hostname'] = ''; + $_SESSION['sql_dbname'] = 'database.sqlite'; + $_SESSION['sql_prefix'] = 'linpha_'; } include_once(LINPHA_DIR.'/install/header_html.php'); @@ -130,24 +136,6 @@ break; case "sqlite": - /** - * checking album, sql, cache and tmp directory - */ - if(isset($_POST['cmd_step4'])) - { - /** - * checking album, sql, cache and tmp directory - */ - $dirs = initSessionValues(); - if(initInitialDirectories($dirs) != true) - { - $show_next_button = false; - include_once(LINPHA_DIR.'/install/footer.php'); - exit(); - } - } - - if (isset($_SESSION['sqlite_db_created']) && $_SESSION['sqlite_db_created']==$_SESSION['sql_dir']) { echo i18n_install("Sqlite database already created, please continue to next step."); Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step8_testing.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -72,8 +72,6 @@ echo success_msg(); - - echo '<br />'; /** @@ -81,29 +79,24 @@ */ if($_SESSION['sql_dbtype'] != "sqlite") { - ?> - <?php echo i18n_install("Checking For Existing Tables...").' '; ?> - <?php - $array_tables = $linpha->db->MetaTables(); + echo i18n_install("Checking For Existing Tables...").' '; + + $array_tables = $linpha->db->MetaTables(); - if (! isset($array_tables) OR ! is_array($array_tables)) + if (!isset($array_tables) OR !is_array($array_tables)) { echo failed_msg(); - echo "<br />".i18n_install("Cannot Read Tables").": ".mysql_error(); + echo "<br />".i18n_install("Error: Cannot read tables from database."); + echo $linpha->db->ErrorMsg().'<br />'; + $error_nr = 2; } else { - include_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); + $linpha_tables = array(); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); + $linpha_tables = array_keys($linpha_tables); - /** - * add prefix - */ - foreach($linpha_tables as $key=>$value) - { - $linpha_tables[$key] = $_SESSION['sql_prefix'].$value; - } - $result = array_intersect ($linpha_tables, $array_tables); if(isset($result) && is_array($result) && (count($result) > 0) ) @@ -127,7 +120,7 @@ * try to create a new db user */ $n_runs = 1; -if($_SESSION['sql_dbtype'] == "mysql") +if ( $_SESSION['sql_dbtype'] == "mysql" && !isset($_SESSION['no_create_new_user']) ) // no_create_new_user is set later when we are already successfully running the new user (and of course have no permission to create another one) { echo i18n_install("Trying To Create New LinPHA Database User...").' '; $random_pass = installRandomString(10); @@ -292,22 +285,19 @@ } } -/** - * new user failed, use old connection - */ - if(isset($use_other_conn)) - { - echo "<br /><br /><b>".i18n_install("New User Tests Failed, Falling Back...")."</b>"; - $linpha->db = $orig_conn; // @TODO flo: i don't think that this makes any sense... - } - elseif($n_runs == 2) - { - $_SESSION['sql_username'] = $random_user; - $_SESSION['sql_password'] = $random_pass; - } +if(isset($use_other_conn)) +{ + echo "<br /><br /><b>".i18n_install("New User Tests Failed, Falling Back...")."</b>"; +} +elseif($n_runs == 2) +{ + $_SESSION['sql_username'] = $random_user; + $_SESSION['sql_password'] = $random_pass; + $_SESSION['no_create_new_user'] = true; // set this variable to prevent create another user if we later press the back button +} echo '<br /><br />'; include_once(LINPHA_DIR.'/install/footer.php'); /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/install/step9_createtables.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -23,106 +23,56 @@ * linpha installer * @package Installation */ -include_once(LINPHA_DIR.'/lib/include/common.php'); -include_once(LINPHA_DIR.'/install/header.php'); +require_once(LINPHA_DIR.'/lib/include/common.php'); +require_once(LINPHA_DIR.'/install/header.php'); +require_once(LINPHA_DIR.'/install/header_html.php'); +require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); -/** - * now, it is too late to go back... - */ -$show_back_button = false; - -include_once(LINPHA_DIR.'/install/header_html.php'); -include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - $linpha = new Linpha(); $linpha->sql->dbConnect(); /** * create tables */ - /** - * get table names and add prefix - */ - include_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); - - // append LIN_PREFIX before each table - // but we also could do this directly in the sql.mysql.php file!? - foreach($linpha_tables as $key=>$value) - { - $linpha_tables[$key] = LIN_PREFIX.$value; - } - - /** - * include sql strings - */ - include_once(LINPHA_DIR.'/lib/include/sql/sql.'.LIN_DB_TYPE.'.php'); - - /** - * finally create tables - */ - echo i18n_install("Creating Tables...").' '; - - $translation_array = array_keys($linpha_tables); // only used in error case - while( list($key,$query) = each($sql_tables) ) - { - $result = $linpha->db->Execute($query); - if(!$result) - { - echo LIN_PREFIX.$translation_array[$key].' '; - echo failed_msg(); - echo ' '.$linpha->db->ErrorMsg().'<br />'; - $error_nr = 1; - } - } - /** - * take care of oracle sequences and triggers - */ - if($_SESSION['sql_dbtype'] == 'oci8po') - { - echo i18n_install("Creating Sequences...")."<br /> "; - - /** - * create sequences - */ - while( list($key, $query) = each($sql_sequence) ) - { - $result = $linpha->db->Execute($query); - if(!$result) - { - echo failed_msg(); - echo sprintf( i18n_install("Failed To Create Sequence for [%s]",$key) ); - echo ' '.$linpha->db->ErrorMsg().'<br />'; - $error_nr = 1; - } - } - - /** - * create triggers - */ - echo i18n_install("Creating Triggers...")."<br /> "; - while( list($key, $query) = each($sql_trigger) ) - { - $result = $linpha->db->Execute($query); - if(!$result) - { - echo failed_msg(); - echo sprintf( i18n_install("Failed To Create Trigger for [%s]",$key) ); - echo ' '.$linpha->db->ErrorMsg().'<br />'; - $error_nr = 1; - } - } - } + echo i18n_install("Creating Tables...").' '; + + require_once(LINPHA_DIR.'/lib/include/sql/sql.tables.php'); + + $taboptarray = array(); + require_once(LINPHA_DIR.'/lib/include/sql/sql.tablesconfig.php'); + + if (LIN_DB_TYPE=='sqlite') { + $dict = &NewDataDictionary($linpha->db,'sqlite'); // force use of sqlite datadict file + } else { + $dict = &NewDataDictionary($linpha->db); + } + //$dict->debug = true; + + foreach($linpha_tables as $table_name => $table_flds) + { + $sqlarray = $dict->CreateTableSQL($table_name, $table_flds, $taboptarray); + + if ($dict->ExecuteSQLArray($sqlarray, $continue_on_error = false) != 2) { + /** + * RETURNS: 0 if failed, 1 if executed all but with errors, 2 if executed successfully + * $sqlarray: an array of strings with sql code (no semicolon at the end of string) + * $contOnError: if true, then continue executing even if error occurs + */ + $error_nr = 1; + } + } - if(!isset($error_nr)) - { - echo success_msg(); - } - else - { - $show_next_button = false; - include_once(LINPHA_DIR.'/install/footer.php'); - exit(1); - } + if(!isset($error_nr)) + { + echo success_msg(); + } + else + { + echo failed_msg(); + $show_next_button = false; + include_once(LINPHA_DIR.'/install/footer.php'); + exit(1); + } /** * insert data @@ -158,8 +108,8 @@ * create cache directories */ echo "<br />".i18n_install("Creating Cache Directories...").' '; - mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/img', 0700); - mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/thumb', 0700); + @mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/img', 0700); + @mkdir(installGetFullPath( $_SESSION['cache_dir'] ).'/thumb', 0700); echo success_msg(); @@ -237,7 +187,8 @@ exit(1); } +$do_javascript_disable_backbutton = true; include_once(LINPHA_DIR.'/install/footer.php'); /* vi: set ts=4 sw=4 sts=4 */ -?> +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-sqlite.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-sqlite.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-sqlite.inc.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -0,0 +1,82 @@ +<?php + +/** + V4.64 20 June 2005 (c) 2000-2005 John Lim (jl...@na...). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_sqlite extends ADODB_DataDict { + + var $databaseType = 'sqlite'; + var $seqField = false; + + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + switch (strtoupper($t)) { + case 'TEXT': + return 'X'; + case 'FLOAT': + case 'DOUBLE': + return 'F'; + } + return parent::MetaType($t,$len,$fieldobj); + } + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': return 'TEXT'; + case 'X': return 'TEXT'; + + case 'C2': return 'VARCHAR'; + case 'X2': return 'TEXT'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'DATE'; + + case 'L': return 'BOOLEAN'; + case 'I': return 'INTEGER'; + case 'I1': return 'INTEGER'; + case 'I2': return 'INTEGER'; + case 'I4': return 'INTEGER'; + case 'I8': return 'INTEGER'; + + case 'F': return 'FLOAT'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } +} + +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -83,7 +83,10 @@ * -> no need anymore for : * if(!$create) { echo $GLOBALS['db']->ErrorMsg().'<br />'; } */ - echo $s.'<br />'; + if (!isset($GLOBALS['LINPHA_DISABLE_ERROR_DIRECT_OUTPUT'])) + { + linSysLog($s.'<br />'); + } linLog(LOG_TYPE_DB, LOG_ERR, 'adodb', $s); } ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -43,10 +43,11 @@ */ function dbConnect() { - + error_reporting(E_ALL); // | E_STRICT error_reporting is turned off by make_release.sh + include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); + if(isset($_SESSION['installmode1'])) { - include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); $db_type = $_SESSION['sql_dbtype']; $db_hostname = $_SESSION['sql_hostname']; $db_username = $_SESSION['sql_username']; @@ -57,8 +58,6 @@ } else { - error_reporting(E_ALL); // | E_STRICT error_reporting is turned off by make_release.sh - include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); /** * if we can keep the "_once" at those include files it would be @@ -130,6 +129,13 @@ break; case "mysql": $GLOBALS['linpha']->db->Connect("$db_hostname:$db_port", $db_username, $db_password, $db_name); + $GLOBALS['linpha']->db->Execute('SET NAMES "UTF8"'); + $GLOBALS['linpha']->db->Execute("SET collation_connection='utf8_general_ci'"); + $GLOBALS['linpha']->db->Execute("SET collation_server='utf8_general_ci'"); + $GLOBALS['linpha']->db->Execute("SET character_set_client='utf8'"); + $GLOBALS['linpha']->db->Execute("SET character_set_connection='utf8'"); + $GLOBALS['linpha']->db->Execute("SET character_set_results='utf8'"); + $GLOBALS['linpha']->db->Execute("SET character_set_server='utf8'"); break; case "postgres": if(isset($db_password)) Deleted: trunk/linpha2/lib/include/sql/sql.info.txt =================================================================== --- trunk/linpha2/lib/include/sql/sql.info.txt 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.info.txt 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,7 +0,0 @@ - - - -- only use lower case table and column names - -missing: utf8 explanations -missing: sample table for each database driver \ No newline at end of file Deleted: trunk/linpha2/lib/include/sql/sql.mysql.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.mysql.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.mysql.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,150 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * linpha installer - */ - -$sql_tables = array( - "CREATE TABLE ".$linpha_tables['config']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "option_name VARCHAR(255) NOT NULL default '', " . - "option_value VARCHAR(255) NOT NULL default '', " . - "user_id INT default '0', " . - "override SMALLINT default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['users']." ( ". - "id INT NOT NULL AUTO_INCREMENT , " . - "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(255) NOT NULL default '' , " . - "user_email VARCHAR(255) NOT NULL default '' , " . - "display_name VARCHAR(255) NOT NULL default '' , " . - "stats_downloads INT default '0', " . - "stats_downloads_size INT default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['groups']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "group_name VARCHAR(255) NOT NULL default '', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['user_group']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "group_id INT NOT NULL default '0', " . - "user_id INT NOT NULL default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['permissions']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "photos_id INT NOT NULL default '0', " . - "perm_type VARCHAR(255) NOT NULL default '0', " . - "permission VARCHAR(255) NOT NULL default '', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['photos']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "parent_id INT NOT NULL default '0', " . - "img_type INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL default '', " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "width INT NOT NULL default '0', " . - "height INT NOT NULL default '0', " . - "filesize INT NOT NULL default '0', " . - "time_add INT NOT NULL default '0', " . - "time_mod INT NOT NULL default '0', " . - "time_exif INT NOT NULL default '0', " . - "rotate INT NOT NULL default '0', " . - "stats_numbers INT NOT NULL default '0', " . - "stats_views INT NOT NULL default '0', " . - "stats_downloads INT NOT NULL default '0', " . - "geodata INT(1) default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "photo_id INT NOT NULL default '0', " . - "img_width SMALLINT NOT NULL default '0', " . - "img_height SMALLINT NOT NULL default '0', " . - "img_quality SMALLINT NOT NULL default '0', " . - "img_size INT NOT NULL default '0', " . - "is_rotated SMALLINT NOT NULL default '0', " . - "has_watermark SMALLINT NOT NULL default '0', " . - "time_add INT NOT NULL default '0', " . - "time_use INT NOT NULL default '0', " . - "time_creating INT NOT NULL default '0', " . - "hits INT NOT NULL default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "name VARCHAR(255) NOT NULL default '', " . - "field_type SMALLINT NOT NULL default '0', " . - "flags SMALLINT NOT NULL default '0', " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_category']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "field_id INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL default '', " . - "isprivate SMALLINT default NULL, " . - "PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". - "md5sum VARCHAR(32) NOT NULL default '', " . - "datetimeoriginal VARCHAR(255) default NULL, " . - "make VARCHAR(255) default NULL, " . - "model VARCHAR(255) default NULL, " . - "artist VARCHAR(255) default NULL, " . - "copyright VARCHAR(255) default NULL, " . - "aperturevalue VARCHAR(255) default NULL, " . - "shutterspeedvalue VARCHAR(255) default NULL, " . - "exposuretime VARCHAR(255) default NULL, " . -// "isospeedratings VARCHAR(255) default NULL, " . - "flash VARCHAR(255) default NULL, " . - "focallength VARCHAR(255) default NULL, " . - "fnumber VARCHAR(255) default NULL, " . -// "jpegcomment VARCHAR(255) default NULL, " . - "PRIMARY KEY (md5sum) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum VARCHAR(32) NOT NULL default '', " . - "PRIMARY KEY (md5sum) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_xmp']." ( ". - "md5sum VARCHAR(32) NOT NULL default '', " . - "PRIMARY KEY (md5sum) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "meta_time INT NOT NULL default '0', " . - "meta_author VARCHAR(255) NOT NULL default '', " . - "meta_comment text NOT NULL, " . - " PRIMARY KEY (id) " . - ")", - "CREATE TABLE ".$linpha_tables['meta_data']." ( ". - "id INT NOT NULL AUTO_INCREMENT, " . - "field_id INT NOT NULL default '0', " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "meta_data VARCHAR(255) NOT NULL default '', " . - "PRIMARY KEY (id) " . - ")", -); -?> Deleted: trunk/linpha2/lib/include/sql/sql.oci8po.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.oci8po.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,248 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * linpha installer - */ - -$sql_tables = array( - "CREATE TABLE ".$linpha_tables['config']." ( ". - "id NUMBER PRIMARY KEY, " . - "option_name VARCHAR2(255) NOT NULL, " . - "option_value VARCHAR2(255), " . - "user_id NUMBER(10) DEFAULT '0', " . - "override NUMBER(6) DEFAULT '0'" . - ")", - "CREATE TABLE ".$linpha_tables['users']." ( ". - "id NUMBER PRIMARY KEY, " . - "username VARCHAR2(255) NOT NULL, " . - "password VARCHAR2(255) NOT NULL, " . - "user_email VARCHAR2(255) NOT NULL, " . - "display_name VARCHAR2(255), " . - "stats_downloads NUMBER(10) DEFAULT '0', " . - "stats_downloads_size NUMBER(10) DEFAULT '0' " . - ")", - "CREATE TABLE ".$linpha_tables['groups']." ( ". - "id NUMBER PRIMARY KEY, " . - "group_name VARCHAR2(255) NOT NULL " . - ")", - "CREATE TABLE ".$linpha_tables['user_group']." ( ". - "id NUMBER PRIMARY KEY, " . - "group_id NUMBER(10), " . - "user_id NUMBER(10)" . - ")", - "CREATE TABLE ".$linpha_tables['permissions']." ( ". - "id NUMBER PRIMARY KEY, " . - "photos_id NUMBER DEFAULT '0', " . - "perm_type VARCHAR2(255), " . - "permission VARCHAR2(255)" . - ")", - "CREATE TABLE ".$linpha_tables['photos']." ( ". - "id NUMBER PRIMARY KEY, " . - "parent_id NUMBER DEFAULT '0', " . - "img_type NUMBER(10) DEFAULT '0', " . - "name VARCHAR2(255) NOT NULL, " . - "md5sum VARCHAR2(32), " . - "width NUMBER(10) default '0', " . - "height NUMBER(10) default '0', " . - "filesize NUMBER(10) default '0', " . - "time_add NUMBER(12) DEFAULT '0', " . - "time_mod NUMBER(12) DEFAULT '0', " . - "time_exif NUMBER(12) DEFAULT '0', " . - "rotate NUMBER(12) DEFAULT '0', " . - "stats_numbers NUMBER(10) DEFAULT '0', " . - "stats_views NUMBER(10) DEFAULT '0', " . - "stats_downloads NUMBER(10) DEFAULT '0'" . - "geodata NUMBER(1) default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". - "id NUMBER PRIMARY KEY, " . - "photo_id NUMBER DEFAULT '0', " . - "img_width NUMBER(6) DEFAULT '0', " . - "img_height NUMBER(6) DEFAULT '0', " . - "img_quality NUMBER(6) DEFAULT '0', " . - "img_size NUMBER(10) DEFAULT '0', " . - "is_rotated NUMBER(2) DEFAULT '0', " . - "has_watermark NUMBER(2) DEFAULT '0', " . - "time_add NUMBER(12) DEFAULT '0', " . - "time_use NUMBER(12) DEFAULT '0', " . - "time_creating NUMBER(12) DEFAULT '0', " . - "hits NUMBER(10) DEFAULT '0'" . - ")", - "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". - "id NUMBER PRIMARY KEY, " . - "name VARCHAR2(255) NOT NULL, " . - "field_type NUMBER(12) DEFAULT '0', " . - "flags NUMBER(6) DEFAULT '0' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_category']." ( ". - "id NUMBER PRIMARY KEY, " . - "field_id NUMBER(12) DEFAULT '0', " . - "name VARCHAR2(255), " . - "isprivate NUMBER(6) DEFAULT '0' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". - "md5sum VARCHAR2(32) NOT NULL, " . - "datetimeoriginal VARCHAR2(255) DEFAULT NULL, " . - "make VARCHAR2(255) DEFAULT NULL, " . - "model VARCHAR2(255) DEFAULT NULL, " . - "artist VARCHAR2(255) DEFAULT NULL, " . - "copyright VARCHAR2(255) DEFAULT NULL, " . - "aperturevalue VARCHAR2(255) DEFAULT NULL, " . - "shutterspeedvalue VARCHAR2(255) DEFAULT NULL, " . - "exposuretime VARCHAR2(255) DEFAULT NULL, " . -// "isospeedratings VARCHAR2(255) DEFAULT NULL, " . - "flash VARCHAR2(255) DEFAULT NULL, " . - "focallength VARCHAR2(255) DEFAULT NULL, " . - "fnumber VARCHAR2(255) DEFAULT NULL " . -// "jpegcomment VARCHAR2(255) DEFAULT NULL " . - ")", - "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum VARCHAR2(32) NOT NULL" . - ")", - "CREATE TABLE ".$linpha_tables['meta_xmp']." ( ". - "md5sum VARCHAR2(32) NOT NULL" . - ")", - "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". - "id NUMBER PRIMARY KEY, " . - "md5sum VARCHAR2(32) NOT NULL, " . - "meta_time NUMBER(12) DEFAULT '0', " . - "meta_author VARCHAR2(255), " . - "meta_comment CLOB " . - ")", - "CREATE TABLE ".$linpha_tables['meta_data']." ( ". - "id NUMBER PRIMARY KEY, " . - "field_id NUMBER DEFAULT '0', " . - "md5sum VARCHAR2(32) NOT NULL, " . - "meta_data VARCHAR2(255)" . - ")" -); - -/** - * autoincrement the oracle way ;-) - */ -$sql_sequence[] = "CREATE SEQUENCE config_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE users_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE groups_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE user_group_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE permissions_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE photos_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE photos_cache_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE meta_fields_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE meta_category_seq START WITH 1"; -//$sql_sequence[] = "CREATE SEQUENCE meta_exif_seq START WITH 1"; -//$sql_sequence[] = "CREATE SEQUENCE meta_iptc_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE meta_comments_seq START WITH 1"; -$sql_sequence[] = "CREATE SEQUENCE meta_data_seq START WITH 1"; - -$sql_trigger[] = "CREATE OR REPLACE TRIGGER config_trig " . - "BEFORE INSERT ON ".$linpha_tables['config']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT config_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER users_trig " . - "BEFORE INSERT ON ".$linpha_tables['users']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT users_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER groups_trig " . - "BEFORE INSERT ON ".$linpha_tables['groups']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT groups_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER user_group_trig " . - "BEFORE INSERT ON ".$linpha_tables['user_group']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT user_group_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER permissions_trig " . - "BEFORE INSERT ON ".$linpha_tables['permissions']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT permissions_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER photos_trig " . - "BEFORE INSERT ON ".$linpha_tables['photos']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT photos_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER photos_cache_trig " . - "BEFORE INSERT ON ".$linpha_tables['photos_cache']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT photos_cache_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_fields_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_fields']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_fields_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_category_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_category']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_category_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -/*$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_exif_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_exif']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_exif_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; - -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_iptc_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_iptc']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_iptc_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -*/ -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_comments_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_comments']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_comments_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -$sql_trigger[] = "CREATE OR REPLACE TRIGGER meta_data_trig " . - "BEFORE INSERT ON ".$linpha_tables['meta_data']." " . - "REFERENCING NEW AS NEW " . - "FOR EACH ROW " . - "BEGIN " . - "SELECT meta_data_seq.nextval INTO :new.id FROM DUAL; " . - "END; "; -?> - \ No newline at end of file Deleted: trunk/linpha2/lib/include/sql/sql.postgres.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.postgres.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.postgres.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,153 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * linpha installer - */ - -$sql_tables = array( - "CREATE TABLE ".$linpha_tables['config']." ( ". - "id SERIAL PRIMARY KEY, " . - "option_name VARCHAR(255) NOT NULL default '', " . - "option_value VARCHAR(255) NOT NULL default '', " . - "user_id INT default '0', " . - "override SMALLINT default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['users']." ( ". - "id SERIAL PRIMARY KEY, " . - "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(255) NOT NULL default '' , " . - "user_email VARCHAR(255) NOT NULL default '' , " . - "display_name VARCHAR(255) NOT NULL default '' , " . - "stats_downloads INT NOT NULL default 0 , " . - "stats_downloads_size INT NOT NULL default 0 " . - ")", - "CREATE TABLE ".$linpha_tables['groups']." ( ". - "id SERIAL PRIMARY KEY, " . - "group_name VARCHAR(255) NOT NULL default '' " . - ")", - "CREATE TABLE ".$linpha_tables['user_group']." ( ". - "id SERIAL PRIMARY KEY, " . - "group_id INT NOT NULL default 0, " . - "user_id INT NOT NULL default 0" . - ")", - "CREATE TABLE ".$linpha_tables['permissions']." ( ". - "id SERIAL PRIMARY KEY, " . - "photos_id INT NOT NULL default '0', " . - "perm_type VARCHAR(255) NOT NULL default '0', " . - "permission VARCHAR(255) NOT NULL default '' " . - ")", - "CREATE TABLE ".$linpha_tables['photos']." ( ". - "id SERIAL PRIMARY KEY, " . - "parent_id INT NOT NULL default '0', " . - "img_type INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL, " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "width INT NOT NULL default '0', " . - "height INT NOT NULL default '0', " . - "filesize INT NOT NULL default '0', " . - "time_add INT NOT NULL default '0', " . - "time_mod INT NOT NULL default '0', " . - "time_exif INT NOT NULL default '0', " . - "rotate INT NOT NULL default '0', " . - "stats_numbers INT NOT NULL default '0', " . - "stats_views INT NOT NULL default '0', " . - "stats_downloads INT NOT NULL default '0', " . - "geodata INT default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['photos_cache']." ( ". - "id SERIAL PRIMARY KEY, " . - "photo_id INT NOT NULL default '0', " . - "img_width SMALLINT NOT NULL default '0', " . - "img_height SMALLINT NOT NULL default '0', " . - "img_quality SMALLINT NOT NULL default '0', " . - "img_size INT NOT NULL default '0', " . - "is_rotated SMALLINT NOT NULL default '0', " . - "has_watermark SMALLINT NOT NULL default '0', " . - "time_add INT NOT NULL default '0', " . - "time_use INT NOT NULL default '0', " . - "time_creating INT NOT NULL default '0', " . - "hits INT NOT NULL default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_fields']." ( ". - "id SERIAL PRIMARY KEY, " . - "name VARCHAR(255) NOT NULL default '', " . - "field_type SMALLINT NOT NULL default '0', " . - "flags SMALLINT NOT NULL default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_category']." ( ". - "id SERIAL PRIMARY KEY, " . - "field_id INT NOT NULL default '0', " . - "name VARCHAR(255) NOT NULL default '', " . - "isprivate SMALLINT default NULL " . - ")", - "CREATE TABLE ".$linpha_tables['meta_exif']." ( ". - "md5sum VARCHAR(32) NOT NULL default '', " . - "datetimeoriginal VARCHAR(255) default NULL, " . - "make VARCHAR(255) default NULL, " . - "model VARCHAR(255) default NULL, " . - "artist VARCHAR(255) default NULL, " . - "copyright VARCHAR(255) default NULL, " . - "aperturevalue VARCHAR(255) default NULL, " . - "shutterspeedvalue VARCHAR(255) default NULL, " . - "exposuretime VARCHAR(255) default NULL, " . -// "isospeedratings VARCHAR(255) default NULL, " . - "flash VARCHAR(255) default NULL, " . - "focallength VARCHAR(255) default NULL, " . - "fnumber VARCHAR(255) default NULL " . -// "jpegcomment VARCHAR(255) default NULL " . - ")", - "CREATE TABLE ".$linpha_tables['meta_iptc']." ( ". - "md5sum VARCHAR(32) NOT NULL default '' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_xmp']." ( ". - "md5sum VARCHAR(32) NOT NULL default '' " . - ")", - "CREATE TABLE ".$linpha_tables['meta_comments']." ( ". - "id SERIAL PRIMARY KEY, " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "meta_time INT NOT NULL default '0', " . - "meta_author VARCHAR(255) NOT NULL default '', " . - "meta_comment TEXT NOT NULL " . - ")", - "CREATE TABLE ".$linpha_tables['meta_data']." ( ". - "id SERIAL PRIMARY KEY, " . - "field_id INT NOT NULL default '0', " . - "md5sum VARCHAR(32) NOT NULL default '', " . - "meta_data VARCHAR(255) NOT NULL default '' " . - ")" -); - -/** - * make md5sum UNIQUE in postgres DB (linpha_meta_iptc and linpha_meta_exif) - * + add important indexes - * @todo - add required indexes! -$sql_tables[] = "CREATE UNIQUE INDEX md5index_iptc ON ".$linpha_tables['meta_iptc']." USING btree (md5sum)"; -$sql_tables[] = "CREATE UNIQUE INDEX md5index_exif ON ".$linpha_tables['meta_exif']." USING btree (md5sum)"; - -$sql_tables[] = "CREATE INDEX prev_path ON ".$linpha_tables['photos']." USING btree (prev_path)"; -$sql_tables[] = "CREATE INDEX date ON ".$linpha_tables['photos']." USING btree (date)"; -$sql_tables[] = "CREATE INDEX name ON ".$linpha_tables['photos']." USING btree (name)"; -$sql_tables[] = "CREATE INDEX filename ON ".$linpha_tables['photos']." USING btree (filename)"; -$sql_tables[] = "CREATE INDEX md5sum ON ".$linpha_tables['photos']." USING btree (md5sum)"; - -$sql_tables[] = "CREATE INDEX filename_cache ON ".$linpha_tables['photo_cache']." USING btree (filename)"; -*/ -?> - \ No newline at end of file Deleted: trunk/linpha2/lib/include/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-02-13 22:02:33 UTC (rev 4879) +++ trunk/linpha2/lib/include/sql/sql.sqlite.php 2008-02-17 22:50:14 UTC (rev 4880) @@ -1,136 +0,0 @@ -<?php -/* -* Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/** - * linpha installer - */ - -$sql_tables = array( - "CREATE TABLE ".$linpha_tables['config']." ( ". - "id INTEGER PRIMARY KEY, " . - "option_name VARCHAR(255) NOT NULL default '', " . - "option_value VARCHAR(255) NOT NULL default '', " . - "user_id INTEGER default '0', " . - "override SMALLINT default '0' " . - ")", - "CREATE TABLE ".$linpha_tables['users']." ( ". - "id INTEGER PRIMARY KEY, " . - "username VARCHAR(255) NOT NULL default '' , " . - "password VARCHAR(255) NOT NULL default '' , " . - "user_email VARCHAR(255) NOT NULL default '' , " . - "display_name VARCHAR(255) NOT NULL default '' , " . - "stats_downloads INTEGER NOT NULL default '0' , " . - "stats_downloads_size INTE... [truncated message content] |
From: <fan...@us...> - 2008-02-13 22:02:34
|
Revision: 4879 http://linpha.svn.sourceforge.net/linpha/?rev=4879&view=rev Author: fangehrn Date: 2008-02-13 14:02:33 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/linpha2/install/step7_selectprefix.php Added Paths: ----------- trunk/linpha2/lib/adodb/datadict/ trunk/linpha2/lib/adodb/datadict/datadict-access.inc.php trunk/linpha2/lib/adodb/datadict/datadict-db2.inc.php trunk/linpha2/lib/adodb/datadict/datadict-firebird.inc.php trunk/linpha2/lib/adodb/datadict/datadict-generic.inc.php trunk/linpha2/lib/adodb/datadict/datadict-ibase.inc.php trunk/linpha2/lib/adodb/datadict/datadict-informix.inc.php trunk/linpha2/lib/adodb/datadict/datadict-mssql.inc.php trunk/linpha2/lib/adodb/datadict/datadict-mysql.inc.php trunk/linpha2/lib/adodb/datadict/datadict-oci8.inc.php trunk/linpha2/lib/adodb/datadict/datadict-postgres.inc.php trunk/linpha2/lib/adodb/datadict/datadict-sapdb.inc.php trunk/linpha2/lib/adodb/datadict/datadict-sybase.inc.php Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2008-02-13 22:01:25 UTC (rev 4878) +++ trunk/linpha2/install/step7_selectprefix.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -76,7 +76,7 @@ if(isset($_POST['create_database']) && $_POST['create_database'] == "create") { echo i18n_install("Creating Database...").' '; - $result = @mysql_query("CREATE database ".$_SESSION['sql_dbname']); + $result = @mysql_query("CREATE database ".$_SESSION['sql_dbname']." DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci"); if($result) { Added: trunk/linpha2/lib/adodb/datadict/datadict-access.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-access.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-access.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,95 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_access extends ADODB_DataDict { + + var $databaseType = 'access'; + var $seqField = false; + + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'TEXT'; + case 'XL': + case 'X': return 'MEMO'; + + case 'C2': return 'TEXT'; // up to 32K + case 'X2': return 'MEMO'; + + case 'B': return 'BINARY'; + + case 'D': return 'DATETIME'; + case 'T': return 'DATETIME'; + + case 'L': return 'BYTE'; + case 'I': return 'INTEGER'; + case 'I1': return 'BYTE'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'INTEGER'; + + case 'F': return 'DOUBLE'; + case 'N': return 'NUMERIC'; + default: + return $meta; + } + } + + // return string must begin with space + function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint) + { + if ($fautoinc) { + $ftype = 'COUNTER'; + return ''; + } + if (substr($ftype,0,7) == 'DECIMAL') $ftype = 'DECIMAL'; + $suffix = ''; + if (strlen($fdefault)) { + //$suffix .= " DEFAULT $fdefault"; + if ($this->debug) ADOConnection::outp("Warning: Access does not supported DEFAULT values (field $fname)"); + } + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + function CreateDatabase($dbname,$options=false) + { + return array(); + } + + + function SetSchema($schema) + { + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + +} + + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-db2.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-db2.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-db2.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,143 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_db2 extends ADODB_DataDict { + + var $databaseType = 'db2'; + var $seqField = false; + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': return 'CLOB'; + case 'X': return 'VARCHAR(3600)'; + + case 'C2': return 'VARCHAR'; // up to 32K + case 'X2': return 'VARCHAR(3600)'; // up to 32000, but default page size too small + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'BIGINT'; + + case 'F': return 'DOUBLE'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint) + { + $suffix = ''; + if ($fautoinc) return ' GENERATED ALWAYS AS IDENTITY'; # as identity start with + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + + + function ChangeTableSQL($tablename, $flds, $tableoptions = false) + { + + /** + Allow basic table changes to DB2 databases + DB2 will fatally reject changes to non character columns + + */ + + $validTypes = array("CHAR","VARC"); + $invalidTypes = array("BIGI","BLOB","CLOB","DATE", "DECI","DOUB", "INTE", "REAL","SMAL", "TIME"); + // check table exists + $cols = $this->MetaColumns($tablename); + if ( empty($cols)) { + return $this->CreateTableSQL($tablename, $flds, $tableoptions); + } + + // already exists, alter table instead + list($lines,$pkey) = $this->_GenFields($flds); + $alter = 'ALTER TABLE ' . $this->TableName($tablename); + $sql = array(); + + foreach ( $lines as $id => $v ) { + if ( isset($cols[$id]) && is_object($cols[$id]) ) { + /** + If the first field of $v is the fieldname, and + the second is the field type/size, we assume its an + attempt to modify the column size, so check that it is allowed + $v can have an indeterminate number of blanks between the + fields, so account for that too + */ + $vargs = explode(' ' , $v); + // assume that $vargs[0] is the field name. + $i=0; + // Find the next non-blank value; + for ($i=1;$i<sizeof($vargs);$i++) + if ($vargs[$i] != '') + break; + + // if $vargs[$i] is one of the following, we are trying to change the + // size of the field, if not allowed, simply ignore the request. + if (in_array(substr($vargs[$i],0,4),$invalidTypes)) + continue; + // insert the appropriate DB2 syntax + if (in_array(substr($vargs[$i],0,4),$validTypes)) { + array_splice($vargs,$i,0,array('SET','DATA','TYPE')); + } + + // Now Look for the NOT NULL statement as this is not allowed in + // the ALTER table statement. If it is in there, remove it + if (in_array('NOT',$vargs) && in_array('NULL',$vargs)) { + for ($i=1;$i<sizeof($vargs);$i++) + if ($vargs[$i] == 'NOT') + break; + array_splice($vargs,$i,2,''); + } + $v = implode(' ',$vargs); + $sql[] = $alter . $this->alterCol . ' ' . $v; + } else { + $sql[] = $alter . $this->addCol . ' ' . $v; + } + } + + return $sql; + } + +} + + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-firebird.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-firebird.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-firebird.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,151 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +class ADODB2_firebird extends ADODB_DataDict { + + var $databaseType = 'firebird'; + var $seqField = false; + var $seqPrefix = 'gen_'; + var $blobSize = 40000; + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': return 'VARCHAR(32000)'; + case 'X': return 'VARCHAR(4000)'; + + case 'C2': return 'VARCHAR'; // up to 32K + case 'X2': return 'VARCHAR(4000)'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'INTEGER'; + + case 'F': return 'DOUBLE PRECISION'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function NameQuote($name = NULL) + { + if (!is_string($name)) { + return FALSE; + } + + $name = trim($name); + + if ( !is_object($this->connection) ) { + return $name; + } + + $quote = $this->connection->nameQuote; + + // if name is of the form `name`, quote it + if ( preg_match('/^`(.+)`$/', $name, $matches) ) { + return $quote . $matches[1] . $quote; + } + + // if name contains special characters, quote it + if ( !preg_match('/^[' . $this->nameRegex . ']+$/', $name) ) { + return $quote . $name . $quote; + } + + return $quote . $name . $quote; + } + + function CreateDatabase($dbname, $options=false) + { + $options = $this->_Options($options); + $sql = array(); + + $sql[] = "DECLARE EXTERNAL FUNCTION LOWER CSTRING(80) RETURNS CSTRING(80) FREE_IT ENTRY_POINT 'IB_UDF_lower' MODULE_NAME 'ib_udf'"; + + return $sql; + } + + function _DropAutoIncrement($t) + { + if (strpos($t,'.') !== false) { + $tarr = explode('.',$t); + return 'DROP GENERATOR '.$tarr[0].'."gen_'.$tarr[1].'"'; + } + return 'DROP GENERATOR "GEN_'.$t; + } + + + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fautoinc) $this->seqField = $fname; + if ($fconstraint) $suffix .= ' '.$fconstraint; + + return $suffix; + } + +/* +CREATE or replace TRIGGER jaddress_insert +before insert on jaddress +for each row +begin +IF ( NEW."seqField" IS NULL OR NEW."seqField" = 0 ) THEN + NEW."seqField" = GEN_ID("GEN_tabname", 1); +end; +*/ + function _Triggers($tabname,$tableoptions) + { + if (!$this->seqField) return array(); + + $tab1 = preg_replace( '/"/', '', $tabname ); + if ($this->schema) { + $t = strpos($tab1,'.'); + if ($t !== false) $tab = substr($tab1,$t+1); + else $tab = $tab1; + $seqField = $this->seqField; + $seqname = $this->schema.'.'.$this->seqPrefix.$tab; + $trigname = $this->schema.'.trig_'.$this->seqPrefix.$tab; + } else { + $seqField = $this->seqField; + $seqname = $this->seqPrefix.$tab1; + $trigname = 'trig_'.$seqname; + } + if (isset($tableoptions['REPLACE'])) + { $sql[] = "DROP GENERATOR \"$seqname\""; + $sql[] = "CREATE GENERATOR \"$seqname\""; + $sql[] = "ALTER TRIGGER \"$trigname\" BEFORE INSERT OR UPDATE AS BEGIN IF ( NEW.$seqField IS NULL OR NEW.$seqField = 0 ) THEN NEW.$seqField = GEN_ID(\"$seqname\", 1); END"; + } + else + { $sql[] = "CREATE GENERATOR \"$seqname\""; + $sql[] = "CREATE TRIGGER \"$trigname\" FOR $tabname BEFORE INSERT OR UPDATE AS BEGIN IF ( NEW.$seqField IS NULL OR NEW.$seqField = 0 ) THEN NEW.$seqField = GEN_ID(\"$seqname\", 1); END"; + } + + $this->seqField = false; + return $sql; + } + +} + + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-generic.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-generic.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-generic.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,125 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_generic extends ADODB_DataDict { + + var $databaseType = 'generic'; + var $seqField = false; + + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': + case 'X': return 'VARCHAR(250)'; + + case 'C2': return 'VARCHAR'; + case 'X2': return 'VARCHAR(250)'; + + case 'B': return 'VARCHAR'; + + case 'D': return 'DATE'; + case 'T': return 'DATE'; + + case 'L': return 'DECIMAL(1)'; + case 'I': return 'DECIMAL(10)'; + case 'I1': return 'DECIMAL(3)'; + case 'I2': return 'DECIMAL(5)'; + case 'I4': return 'DECIMAL(10)'; + case 'I8': return 'DECIMAL(20)'; + + case 'F': return 'DECIMAL(32,8)'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + +} + +/* +//db2 + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'X': return 'VARCHAR'; + + case 'C2': return 'VARCHAR'; // up to 32K + case 'X2': return 'VARCHAR'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'BIGINT'; + + case 'F': return 'DOUBLE'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + +// ifx +function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR';// 255 + case 'X': return 'TEXT'; + + case 'C2': return 'NVARCHAR'; + case 'X2': return 'TEXT'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'DATETIME'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'DECIMAL(20)'; + + case 'F': return 'FLOAT'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } +*/ +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-ibase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-ibase.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-ibase.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,67 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_ibase extends ADODB_DataDict { + + var $databaseType = 'ibase'; + var $seqField = false; + + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': + case 'X': return 'VARCHAR(4000)'; + + case 'C2': return 'VARCHAR'; // up to 32K + case 'X2': return 'VARCHAR(4000)'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'INTEGER'; + + case 'F': return 'DOUBLE PRECISION'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + +} + + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-informix.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-informix.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-informix.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,80 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_informix extends ADODB_DataDict { + + var $databaseType = 'informix'; + var $seqField = false; + + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR';// 255 + case 'XL': + case 'X': return 'TEXT'; + + case 'C2': return 'NVARCHAR'; + case 'X2': return 'TEXT'; + + case 'B': return 'BLOB'; + + case 'D': return 'DATE'; + case 'T': return 'DATETIME YEAR TO SECOND'; + + case 'L': return 'SMALLINT'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'DECIMAL(20)'; + + case 'F': return 'FLOAT'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function AlterColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("AlterColumnSQL not supported"); + return array(); + } + + + function DropColumnSQL($tabname, $flds) + { + if ($this->debug) ADOConnection::outp("DropColumnSQL not supported"); + return array(); + } + + // return string must begin with space + function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint) + { + if ($fautoinc) { + $ftype = 'SERIAL'; + return ''; + } + $suffix = ''; + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + +} + +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-mssql.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-mssql.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,282 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +/* +In ADOdb, named quotes for MS SQL Server use ". From the MSSQL Docs: + + Note Delimiters are for identifiers only. Delimiters cannot be used for keywords, + whether or not they are marked as reserved in SQL Server. + + Quoted identifiers are delimited by double quotation marks ("): + SELECT * FROM "Blanks in Table Name" + + Bracketed identifiers are delimited by brackets ([ ]): + SELECT * FROM [Blanks In Table Name] + + Quoted identifiers are valid only when the QUOTED_IDENTIFIER option is set to ON. By default, + the Microsoft OLE DB Provider for SQL Server and SQL Server ODBC driver set QUOTED_IDENTIFIER ON + when they connect. + + In Transact-SQL, the option can be set at various levels using SET QUOTED_IDENTIFIER, + the quoted identifier option of sp_dboption, or the user options option of sp_configure. + + When SET ANSI_DEFAULTS is ON, SET QUOTED_IDENTIFIER is enabled. + + Syntax + + SET QUOTED_IDENTIFIER { ON | OFF } + + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_mssql extends ADODB_DataDict { + var $databaseType = 'mssql'; + var $dropIndex = 'DROP INDEX %2$s.%1$s'; + var $renameTable = "EXEC sp_rename '%s','%s'"; + var $renameColumn = "EXEC sp_rename '%s.%s','%s'"; + + var $typeX = 'TEXT'; ## Alternatively, set it to VARCHAR(4000) + var $typeXL = 'TEXT'; + + //var $alterCol = ' ALTER COLUMN '; + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + + $len = -1; // mysql max_length is not accurate + switch (strtoupper($t)) { + case 'R': + case 'INT': + case 'INTEGER': return 'I'; + case 'BIT': + case 'TINYINT': return 'I1'; + case 'SMALLINT': return 'I2'; + case 'BIGINT': return 'I8'; + + case 'REAL': + case 'FLOAT': return 'F'; + default: return parent::MetaType($t,$len,$fieldobj); + } + } + + function ActualType($meta) + { + switch(strtoupper($meta)) { + + case 'C': return 'VARCHAR'; + case 'XL': return (isset($this)) ? $this->typeXL : 'TEXT'; + case 'X': return (isset($this)) ? $this->typeX : 'TEXT'; ## could be varchar(8000), but we want compat with oracle + case 'C2': return 'NVARCHAR'; + case 'X2': return 'NTEXT'; + + case 'B': return 'IMAGE'; + + case 'D': return 'DATETIME'; + case 'T': return 'DATETIME'; + case 'L': return 'BIT'; + + case 'R': + case 'I': return 'INT'; + case 'I1': return 'TINYINT'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INT'; + case 'I8': return 'BIGINT'; + + case 'F': return 'REAL'; + case 'N': return 'NUMERIC'; + default: + return $meta; + } + } + + + function AddColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $f = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $s = "ALTER TABLE $tabname $this->addCol"; + foreach($lines as $v) { + $f[] = "\n $v"; + } + $s .= implode(', ',$f); + $sql[] = $s; + return $sql; + } + + /* + function AlterColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + foreach($lines as $v) { + $sql[] = "ALTER TABLE $tabname $this->alterCol $v"; + } + + return $sql; + } + */ + + function DropColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + if (!is_array($flds)) + $flds = explode(',',$flds); + $f = array(); + $s = 'ALTER TABLE ' . $tabname; + foreach($flds as $v) { + $f[] = "\n$this->dropCol ".$this->NameQuote($v); + } + $s .= implode(', ',$f); + $sql[] = $s; + return $sql; + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint) + { + $suffix = ''; + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fautoinc) $suffix .= ' IDENTITY(1,1)'; + if ($fnotnull) $suffix .= ' NOT NULL'; + else if ($suffix == '') $suffix .= ' NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + /* +CREATE TABLE + [ database_name.[ owner ] . | owner. ] table_name + ( { < column_definition > + | column_name AS computed_column_expression + | < table_constraint > ::= [ CONSTRAINT constraint_name ] } + + | [ { PRIMARY KEY | UNIQUE } [ ,...n ] + ) + +[ ON { filegroup | DEFAULT } ] +[ TEXTIMAGE_ON { filegroup | DEFAULT } ] + +< column_definition > ::= { column_name data_type } + [ COLLATE < collation_name > ] + [ [ DEFAULT constant_expression ] + | [ IDENTITY [ ( seed , increment ) [ NOT FOR REPLICATION ] ] ] + ] + [ ROWGUIDCOL] + [ < column_constraint > ] [ ...n ] + +< column_constraint > ::= [ CONSTRAINT constraint_name ] + { [ NULL | NOT NULL ] + | [ { PRIMARY KEY | UNIQUE } + [ CLUSTERED | NONCLUSTERED ] + [ WITH FILLFACTOR = fillfactor ] + [ON {filegroup | DEFAULT} ] ] + ] + | [ [ FOREIGN KEY ] + REFERENCES ref_table [ ( ref_column ) ] + [ ON DELETE { CASCADE | NO ACTION } ] + [ ON UPDATE { CASCADE | NO ACTION } ] + [ NOT FOR REPLICATION ] + ] + | CHECK [ NOT FOR REPLICATION ] + ( logical_expression ) + } + +< table_constraint > ::= [ CONSTRAINT constraint_name ] + { [ { PRIMARY KEY | UNIQUE } + [ CLUSTERED | NONCLUSTERED ] + { ( column [ ASC | DESC ] [ ,...n ] ) } + [ WITH FILLFACTOR = fillfactor ] + [ ON { filegroup | DEFAULT } ] + ] + | FOREIGN KEY + [ ( column [ ,...n ] ) ] + REFERENCES ref_table [ ( ref_column [ ,...n ] ) ] + [ ON DELETE { CASCADE | NO ACTION } ] + [ ON UPDATE { CASCADE | NO ACTION } ] + [ NOT FOR REPLICATION ] + | CHECK [ NOT FOR REPLICATION ] + ( search_conditions ) + } + + + */ + + /* + CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name + ON { table | view } ( column [ ASC | DESC ] [ ,...n ] ) + [ WITH < index_option > [ ,...n] ] + [ ON filegroup ] + < index_option > :: = + { PAD_INDEX | + FILLFACTOR = fillfactor | + IGNORE_DUP_KEY | + DROP_EXISTING | + STATISTICS_NORECOMPUTE | + SORT_IN_TEMPDB + } +*/ + function _IndexSQL($idxname, $tabname, $flds, $idxoptions) + { + $sql = array(); + + if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { + $sql[] = sprintf ($this->dropIndex, $idxname, $tabname); + if ( isset($idxoptions['DROP']) ) + return $sql; + } + + if ( empty ($flds) ) { + return $sql; + } + + $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : ''; + $clustered = isset($idxoptions['CLUSTERED']) ? ' CLUSTERED' : ''; + + if ( is_array($flds) ) + $flds = implode(', ',$flds); + $s = 'CREATE' . $unique . $clustered . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')'; + + if ( isset($idxoptions[$this->upperName]) ) + $s .= $idxoptions[$this->upperName]; + + + $sql[] = $s; + + return $sql; + } + + + function _GetSize($ftype, $ty, $fsize, $fprec) + { + switch ($ftype) { + case 'INT': + case 'SMALLINT': + case 'TINYINT': + case 'BIGINT': + return $ftype; + } + if ($ty == 'T') return $ftype; + return parent::_GetSize($ftype, $ty, $fsize, $fprec); + + } +} +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-mysql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-mysql.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-mysql.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,181 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_mysql extends ADODB_DataDict { + var $databaseType = 'mysql'; + var $alterCol = ' MODIFY COLUMN'; + var $alterTableAddIndex = true; + var $dropTable = 'DROP TABLE IF EXISTS %s'; // requires mysql 3.22 or later + + var $dropIndex = 'DROP INDEX %s ON %s'; + var $renameColumn = 'ALTER TABLE %s CHANGE COLUMN %s %s %s'; // needs column-definition! + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + $is_serial = is_object($fieldobj) && $fieldobj->primary_key && $fieldobj->auto_increment; + + $len = -1; // mysql max_length is not accurate + switch (strtoupper($t)) { + case 'STRING': + case 'CHAR': + case 'VARCHAR': + case 'TINYBLOB': + case 'TINYTEXT': + case 'ENUM': + case 'SET': + if ($len <= $this->blobSize) return 'C'; + + case 'TEXT': + case 'LONGTEXT': + case 'MEDIUMTEXT': + return 'X'; + + // php_mysql extension always returns 'blob' even if 'text' + // so we have to check whether binary... + case 'IMAGE': + case 'LONGBLOB': + case 'BLOB': + case 'MEDIUMBLOB': + return !empty($fieldobj->binary) ? 'B' : 'X'; + + case 'YEAR': + case 'DATE': return 'D'; + + case 'TIME': + case 'DATETIME': + case 'TIMESTAMP': return 'T'; + + case 'FLOAT': + case 'DOUBLE': + return 'F'; + + case 'INT': + case 'INTEGER': return $is_serial ? 'R' : 'I'; + case 'TINYINT': return $is_serial ? 'R' : 'I1'; + case 'SMALLINT': return $is_serial ? 'R' : 'I2'; + case 'MEDIUMINT': return $is_serial ? 'R' : 'I4'; + case 'BIGINT': return $is_serial ? 'R' : 'I8'; + default: return 'N'; + } + } + + function ActualType($meta) + { + switch(strtoupper($meta)) { + case 'C': return 'VARCHAR'; + case 'XL':return 'LONGTEXT'; + case 'X': return 'TEXT'; + + case 'C2': return 'VARCHAR'; + case 'X2': return 'LONGTEXT'; + + case 'B': return 'LONGBLOB'; + + case 'D': return 'DATE'; + case 'T': return 'DATETIME'; + case 'L': return 'TINYINT'; + + case 'R': + case 'I4': + case 'I': return 'INTEGER'; + case 'I1': return 'TINYINT'; + case 'I2': return 'SMALLINT'; + case 'I8': return 'BIGINT'; + + case 'F': return 'DOUBLE'; + case 'N': return 'NUMERIC'; + default: + return $meta; + } + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + if ($funsigned) $suffix .= ' UNSIGNED'; + if ($fnotnull) $suffix .= ' NOT NULL'; + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fautoinc) $suffix .= ' AUTO_INCREMENT'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + /* + CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] + [table_options] [select_statement] + create_definition: + col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] + [PRIMARY KEY] [reference_definition] + or PRIMARY KEY (index_col_name,...) + or KEY [index_name] (index_col_name,...) + or INDEX [index_name] (index_col_name,...) + or UNIQUE [INDEX] [index_name] (index_col_name,...) + or FULLTEXT [INDEX] [index_name] (index_col_name,...) + or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...) + [reference_definition] + or CHECK (expr) + */ + + /* + CREATE [UNIQUE|FULLTEXT] INDEX index_name + ON tbl_name (col_name[(length)],... ) + */ + + function _IndexSQL($idxname, $tabname, $flds, $idxoptions) + { + $sql = array(); + + if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { + if ($this->alterTableAddIndex) $sql[] = "ALTER TABLE $tabname DROP INDEX $idxname"; + else $sql[] = sprintf($this->dropIndex, $idxname, $tabname); + + if ( isset($idxoptions['DROP']) ) + return $sql; + } + + if ( empty ($flds) ) { + return $sql; + } + + if (isset($idxoptions['FULLTEXT'])) { + $unique = ' FULLTEXT'; + } elseif (isset($idxoptions['UNIQUE'])) { + $unique = ' UNIQUE'; + } else { + $unique = ''; + } + + if ( is_array($flds) ) $flds = implode(', ',$flds); + + if ($this->alterTableAddIndex) $s = "ALTER TABLE $tabname ADD $unique INDEX $idxname "; + else $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname; + + $s .= ' (' . $flds . ')'; + + if ( isset($idxoptions[$this->upperName]) ) + $s .= $idxoptions[$this->upperName]; + + $sql[] = $s; + + return $sql; + } +} +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-oci8.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-oci8.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-oci8.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,290 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_oci8 extends ADODB_DataDict { + + var $databaseType = 'oci8'; + var $seqField = false; + var $seqPrefix = 'SEQ_'; + var $dropTable = "DROP TABLE %s CASCADE CONSTRAINTS"; + var $trigPrefix = 'TRIG_'; + var $alterCol = ' MODIFY '; + var $typeX = 'VARCHAR(4000)'; + var $typeXL = 'CLOB'; + + function MetaType($t,$len=-1) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + switch (strtoupper($t)) { + case 'VARCHAR': + case 'VARCHAR2': + case 'CHAR': + case 'VARBINARY': + case 'BINARY': + if (isset($this) && $len <= $this->blobSize) return 'C'; + return 'X'; + + case 'NCHAR': + case 'NVARCHAR2': + case 'NVARCHAR': + if (isset($this) && $len <= $this->blobSize) return 'C2'; + return 'X2'; + + case 'NCLOB': + case 'CLOB': + return 'XL'; + + case 'LONG RAW': + case 'LONG VARBINARY': + case 'BLOB': + return 'B'; + + case 'DATE': + return 'T'; + + case 'INT': + case 'SMALLINT': + case 'INTEGER': + return 'I'; + + default: + return 'N'; + } + } + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'X': return $this->typeX; + case 'XL': return $this->typeXL; + + case 'C2': return 'NVARCHAR2'; + case 'X2': return 'NVARCHAR2(4000)'; + + case 'B': return 'BLOB'; + + case 'D': + case 'T': return 'DATE'; + case 'L': return 'DECIMAL(1)'; + case 'I1': return 'DECIMAL(3)'; + case 'I2': return 'DECIMAL(5)'; + case 'I': + case 'I4': return 'DECIMAL(10)'; + + case 'I8': return 'DECIMAL(20)'; + case 'F': return 'DECIMAL'; + case 'N': return 'DECIMAL'; + default: + return $meta; + } + } + + function CreateDatabase($dbname, $options=false) + { + $options = $this->_Options($options); + $password = isset($options['PASSWORD']) ? $options['PASSWORD'] : 'tiger'; + $tablespace = isset($options["TABLESPACE"]) ? " DEFAULT TABLESPACE ".$options["TABLESPACE"] : ''; + $sql[] = "CREATE USER ".$dbname." IDENTIFIED BY ".$password.$tablespace; + $sql[] = "GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO $dbname"; + + return $sql; + } + + function AddColumnSQL($tabname, $flds) + { + $f = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $s = "ALTER TABLE $tabname ADD ("; + foreach($lines as $v) { + $f[] = "\n $v"; + } + + $s .= implode(', ',$f).')'; + $sql[] = $s; + return $sql; + } + + function AlterColumnSQL($tabname, $flds) + { + $f = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $s = "ALTER TABLE $tabname MODIFY("; + foreach($lines as $v) { + $f[] = "\n $v"; + } + $s .= implode(', ',$f).')'; + $sql[] = $s; + return $sql; + } + + function DropColumnSQL($tabname, $flds) + { + if (!is_array($flds)) $flds = explode(',',$flds); + foreach ($flds as $k => $v) $flds[$k] = $this->NameQuote($v); + + $sql = array(); + $s = "ALTER TABLE $tabname DROP("; + $s .= implode(', ',$flds).') CASCADE CONSTRAINTS'; + $sql[] = $s; + return $sql; + } + + function _DropAutoIncrement($t) + { + if (strpos($t,'.') !== false) { + $tarr = explode('.',$t); + return "drop sequence ".$tarr[0].".seq_".$tarr[1]; + } + return "drop sequence seq_".$t; + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + + if ($fdefault == "''" && $fnotnull) {// this is null in oracle + $fnotnull = false; + if ($this->debug) ADOConnection::outp("NOT NULL and DEFAULT='' illegal in Oracle"); + } + + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + + if ($fautoinc) $this->seqField = $fname; + if ($fconstraint) $suffix .= ' '.$fconstraint; + + return $suffix; + } + +/* +CREATE or replace TRIGGER jaddress_insert +before insert on jaddress +for each row +begin +select seqaddress.nextval into :new.A_ID from dual; +end; +*/ + function _Triggers($tabname,$tableoptions) + { + if (!$this->seqField) return array(); + + if ($this->schema) { + $t = strpos($tabname,'.'); + if ($t !== false) $tab = substr($tabname,$t+1); + else $tab = $tabname; + $seqname = $this->schema.'.'.$this->seqPrefix.$tab; + $trigname = $this->schema.'.'.$this->trigPrefix.$this->seqPrefix.$tab; + } else { + $seqname = $this->seqPrefix.$tabname; + $trigname = $this->trigPrefix.$seqname; + } + + if (strlen($seqname) > 30) { + $seqname = $this->seqPrefix.uniqid(''); + } // end if + if (strlen($trigname) > 30) { + $trigname = $this->trigPrefix.uniqid(''); + } // end if + + if (isset($tableoptions['REPLACE'])) $sql[] = "DROP SEQUENCE $seqname"; + $seqCache = ''; + if (isset($tableoptions['SEQUENCE_CACHE'])){$seqCache = $tableoptions['SEQUENCE_CACHE'];} + $seqIncr = ''; + if (isset($tableoptions['SEQUENCE_INCREMENT'])){$seqIncr = ' INCREMENT BY '.$tableoptions['SEQUENCE_INCREMENT'];} + $seqStart = ''; + if (isset($tableoptions['SEQUENCE_START'])){$seqIncr = ' START WITH '.$tableoptions['SEQUENCE_START'];} + $sql[] = "CREATE SEQUENCE $seqname $seqStart $seqIncr $seqCache"; + $sql[] = "CREATE OR REPLACE TRIGGER $trigname BEFORE insert ON $tabname FOR EACH ROW WHEN (NEW.$this->seqField IS NULL OR NEW.$this->seqField = 0) BEGIN select $seqname.nextval into :new.$this->seqField from dual; END;"; + + $this->seqField = false; + return $sql; + } + + /* + CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] + [table_options] [select_statement] + create_definition: + col_name type [NOT NULL | NULL] [DEFAULT default_value] [AUTO_INCREMENT] + [PRIMARY KEY] [reference_definition] + or PRIMARY KEY (index_col_name,...) + or KEY [index_name] (index_col_name,...) + or INDEX [index_name] (index_col_name,...) + or UNIQUE [INDEX] [index_name] (index_col_name,...) + or FULLTEXT [INDEX] [index_name] (index_col_name,...) + or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...) + [reference_definition] + or CHECK (expr) + */ + + + + function _IndexSQL($idxname, $tabname, $flds,$idxoptions) + { + $sql = array(); + + if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { + $sql[] = sprintf ($this->dropIndex, $idxname, $tabname); + if ( isset($idxoptions['DROP']) ) + return $sql; + } + + if ( empty ($flds) ) { + return $sql; + } + + if (isset($idxoptions['BITMAP'])) { + $unique = ' BITMAP'; + } elseif (isset($idxoptions['UNIQUE'])) { + $unique = ' UNIQUE'; + } else { + $unique = ''; + } + + if ( is_array($flds) ) + $flds = implode(', ',$flds); + $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' (' . $flds . ')'; + + if ( isset($idxoptions[$this->upperName]) ) + $s .= $idxoptions[$this->upperName]; + + if (isset($idxoptions['oci8'])) + $s .= $idxoptions['oci8']; + + + $sql[] = $s; + + return $sql; + } + + function GetCommentSQL($table,$col) + { + $table = $this->connection->qstr($table); + $col = $this->connection->qstr($col); + return "select comments from USER_COL_COMMENTS where TABLE_NAME=$table and COLUMN_NAME=$col"; + } + + function SetCommentSQL($table,$col,$cmt) + { + $cmt = $this->connection->qstr($cmt); + return "COMMENT ON COLUMN $table.$col IS $cmt"; + } +} +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-postgres.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-postgres.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-postgres.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,447 @@ +<?php + +/** + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_postgres extends ADODB_DataDict { + + var $databaseType = 'postgres'; + var $seqField = false; + var $seqPrefix = 'SEQ_'; + var $addCol = ' ADD COLUMN'; + var $quote = '"'; + var $renameTable = 'ALTER TABLE %s RENAME TO %s'; // at least since 7.1 + var $dropTable = 'DROP TABLE %s CASCADE'; + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + $is_serial = is_object($fieldobj) && $fieldobj->primary_key && $fieldobj->unique && + $fieldobj->has_default && substr($fieldobj->default_value,0,8) == 'nextval('; + + switch (strtoupper($t)) { + case 'INTERVAL': + case 'CHAR': + case 'CHARACTER': + case 'VARCHAR': + case 'NAME': + case 'BPCHAR': + if ($len <= $this->blobSize) return 'C'; + + 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 'VARBIT': + case 'BYTEA': + return 'B'; + + case 'BOOL': + case 'BOOLEAN': + return 'L'; + + case 'DATE': + return 'D'; + + case 'TIME': + case 'DATETIME': + case 'TIMESTAMP': + case 'TIMESTAMPTZ': + return 'T'; + + case 'INTEGER': return !$is_serial ? 'I' : 'R'; + case 'SMALLINT': + case 'INT2': return !$is_serial ? 'I2' : 'R'; + case 'INT4': return !$is_serial ? 'I4' : 'R'; + case 'BIGINT': + case 'INT8': return !$is_serial ? 'I8' : 'R'; + + case 'OID': + case 'SERIAL': + return 'R'; + + case 'FLOAT4': + case 'FLOAT8': + case 'DOUBLE PRECISION': + case 'REAL': + return 'F'; + + default: + return 'N'; + } + } + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': + case 'X': return 'TEXT'; + + case 'C2': return 'VARCHAR'; + case 'X2': return 'TEXT'; + + case 'B': return 'BYTEA'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'BOOLEAN'; + case 'I': return 'INTEGER'; + case 'I1': return 'SMALLINT'; + case 'I2': return 'INT2'; + case 'I4': return 'INT4'; + case 'I8': return 'INT8'; + + case 'F': return 'FLOAT8'; + case 'N': return 'NUMERIC'; + default: + return $meta; + } + } + + /** + * Adding a new Column + * + * reimplementation of the default function as postgres does NOT allow to set the default in the same statement + * + * @param string $tabname table-name + * @param string $flds column-names and types for the changed columns + * @return array with SQL strings + */ + function AddColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' '; + foreach($lines as $v) { + if (($not_null = preg_match('/NOT NULL/i',$v))) { + $v = preg_replace('/NOT NULL/i','',$v); + } + if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) { + list(,$colname,$default) = $matches; + $sql[] = $alter . str_replace('DEFAULT '.$default,'',$v); + $sql[] = 'UPDATE '.$tabname.' SET '.$colname.'='.$default; + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default; + } else { + $sql[] = $alter . $v; + } + if ($not_null) { + list($colname) = explode(' ',$v); + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL'; + } + } + return $sql; + } + + + function DropIndexSQL ($idxname, $tabname = NULL) + { + return array(sprintf($this->dropIndex, $this->TableName($idxname), $this->TableName($tabname))); + } + + /** + * Change the definition of one column + * + * Postgres can't do that on it's own, you need to supply the complete defintion of the new table, + * to allow, recreating the table and copying the content over to the new table + * @param string $tabname table-name + * @param string $flds column-name and type for the changed column + * @param string $tableflds complete defintion of the new table, eg. for postgres, default '' + * @param array/ $tableoptions options for the new table see CreateTableSQL, default '' + * @return array with SQL strings + */ + /* + function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + if (!$tableflds) { + if ($this->debug) ADOConnection::outp("AlterColumnSQL needs a complete table-definiton for PostgreSQL"); + return array(); + } + return $this->_recreate_copy_table($tabname,False,$tableflds,$tableoptions); + }*/ + + function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + // Check if alter single column datatype available - works with 8.0+ + $has_alter_column = 8.0 <= (float) @$this->serverInfo['version']; + + if ($has_alter_column) { + $tabname = $this->TableName($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' '; + foreach($lines as $v) { + if ($not_null = preg_match('/NOT NULL/i',$v)) { + $v = preg_replace('/NOT NULL/i','',$v); + } + // this next block doesn't work - there is no way that I can see to + // explicitly ask a column to be null using $flds + else if ($set_null = preg_match('/NULL/i',$v)) { + // if they didn't specify not null, see if they explicitely asked for null + $v = preg_replace('/\sNULL/i','',$v); + } + + if (preg_match('/^([^ ]+) .*DEFAULT ([^ ]+)/',$v,$matches)) { + list(,$colname,$default) = $matches; + $v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v); + $sql[] = $alter . $colname . ' TYPE ' . str_replace('DEFAULT '.$default,'',$v); + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET DEFAULT ' . $default; + } + else { + // drop default? + preg_match ('/^\s*(\S+)\s+(.*)$/',$v,$matches); + list (,$colname,$rest) = $matches; + $sql[] = $alter . $colname . ' TYPE ' . $rest; + } + + list($colname) = explode(' ',$v); + if ($not_null) { + // this does not error out if the column is already not null + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL'; + } + if ($set_null) { + // this does not error out if the column is already null + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' DROP NOT NULL'; + } + } + return $sql; + } + + // does not have alter column + if (!$tableflds) { + if ($this->debug) ADOConnection::outp("AlterColumnSQL needs a complete table-definiton for PostgreSQL"); + return array(); + } + return $this->_recreate_copy_table($tabname,False,$tableflds,$tableoptions); + } + + /** + * Drop one column + * + * Postgres < 7.3 can't do that on it's own, you need to supply the complete defintion of the new table, + * to allow, recreating the table and copying the content over to the new table + * @param string $tabname table-name + * @param string $flds column-name and type for the changed column + * @param string $tableflds complete defintion of the new table, eg. for postgres, default '' + * @param array/ $tableoptions options for the new table see CreateTableSQL, default '' + * @return array with SQL strings + */ + function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') + { + $has_drop_column = 7.3 <= (float) @$this->serverInfo['version']; + if (!$has_drop_column && !$tableflds) { + if ($this->debug) ADOConnection::outp("DropColumnSQL needs complete table-definiton for PostgreSQL < 7.3"); + return array(); + } + if ($has_drop_column) { + return ADODB_DataDict::DropColumnSQL($tabname, $flds); + } + return $this->_recreate_copy_table($tabname,$flds,$tableflds,$tableoptions); + } + + /** + * Save the content into a temp. table, drop and recreate the original table and copy the content back in + * + * We also take care to set the values of the sequenz and recreate the indexes. + * All this is done in a transaction, to not loose the content of the table, if something went wrong! + * @internal + * @param string $tabname table-name + * @param string $dropflds column-names to drop + * @param string $tableflds complete defintion of the new table, eg. for postgres + * @param array/string $tableoptions options for the new table see CreateTableSQL, default '' + * @return array with SQL strings + */ + function _recreate_copy_table($tabname,$dropflds,$tableflds,$tableoptions='') + { + if ($dropflds && !is_array($dropflds)) $dropflds = explode(',',$dropflds); + $copyflds = array(); + foreach($this->MetaColumns($tabname) as $fld) { + if (!$dropflds || !in_array($fld->name,$dropflds)) { + // we need to explicit convert varchar to a number to be able to do an AlterColumn of a char column to a nummeric one + if (preg_match('/'.$fld->name.' (I|I2|I4|I8|N|F)/i',$tableflds,$matches) && + in_array($fld->type,array('varchar','char','text','bytea'))) { + $copyflds[] = "to_number($fld->name,'S9999999999999D99')"; + } else { + $copyflds[] = $fld->name; + } + // identify the sequence name and the fld its on + if ($fld->primary_key && $fld->has_default && + preg_match("/nextval\('([^']+)'::text\)/",$fld->default_value,$matches)) { + $seq_name = $matches[1]; + $seq_fld = $fld->name; + } + } + } + $copyflds = implode(', ',$copyflds); + + $tempname = $tabname.'_tmp'; + $aSql[] = 'BEGIN'; // we use a transaction, to make sure not to loose the content of the table + $aSql[] = "SELECT * INTO TEMPORARY TABLE $tempname FROM $tabname"; + $aSql = array_merge($aSql,$this->DropTableSQL($tabname)); + $aSql = array_merge($aSql,$this->CreateTableSQL($tabname,$tableflds,$tableoptions)); + $aSql[] = "INSERT INTO $tabname SELECT $copyflds FROM $tempname"; + if ($seq_name && $seq_fld) { // if we have a sequence we need to set it again + $seq_name = $tabname.'_'.$seq_fld.'_seq'; // has to be the name of the new implicit sequence + $aSql[] = "SELECT setval('$seq_name',MAX($seq_fld)) FROM $tabname"; + } + $aSql[] = "DROP TABLE $tempname"; + // recreate the indexes, if they not contain one of the droped columns + foreach($this->MetaIndexes($tabname) as $idx_name => $idx_data) + { + if (substr($idx_name,-5) != '_pkey' && (!$dropflds || !count(array_intersect($dropflds,$idx_data['columns'])))) { + $aSql = array_merge($aSql,$this->CreateIndexSQL($idx_name,$tabname,$idx_data['columns'], + $idx_data['unique'] ? array('UNIQUE') : False)); + } + } + $aSql[] = 'COMMIT'; + return $aSql; + } + + function DropTableSQL($tabname) + { + $sql = ADODB_DataDict::DropTableSQL($tabname); + + $drop_seq = $this->_DropAutoIncrement($tabname); + if ($drop_seq) $sql[] = $drop_seq; + + return $sql; + } + + // return string must begin with space + function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint) + { + if ($fautoinc) { + $ftype = 'SERIAL'; + return ''; + } + $suffix = ''; + if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + // search for a sequece for the given table (asumes the seqence-name contains the table-name!) + // if yes return sql to drop it + // this is still necessary if postgres < 7.3 or the SERIAL was created on an earlier version!!! + function _DropAutoIncrement($tabname) + { + $tabname = $this->connection->quote('%'.$tabname.'%'); + + $seq = $this->connection->GetOne("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relname LIKE $tabname AND relkind='S'"); + + // check if a tables depends on the sequenz and it therefor cant and dont need to be droped separatly + if (!$seq || $this->connection->GetOne("SELECT relname FROM pg_class JOIN pg_depend ON pg_class.relfilenode=pg_depend.objid WHERE relname='$seq' AND relkind='S' AND deptype='i'")) { + return False; + } + return "DROP SEQUENCE ".$seq; + } + + function RenameTableSQL($tabname,$newname) + { + if (!empty($this->schema)) { + $rename_from = $this->TableName($tabname); + $schema_save = $this->schema; + $this->schema = false; + $rename_to = $this->TableName($newname); + $this->schema = $schema_save; + return array (sprintf($this->renameTable, $rename_from, $rename_to)); + } + + return array (sprintf($this->renameTable, $this->TableName($tabname),$this->TableName($newname))); + } + + /* + CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( + { column_name data_type [ DEFAULT default_expr ] [ column_constraint [, ... ] ] + | table_constraint } [, ... ] + ) + [ INHERITS ( parent_table [, ... ] ) ] + [ WITH OIDS | WITHOUT OIDS ] + where column_constraint is: + [ CONSTRAINT constraint_name ] + { NOT NULL | NULL | UNIQUE | PRIMARY KEY | + CHECK (expression) | + REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL ] + [ ON DELETE action ] [ ON UPDATE action ] } + [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] + and table_constraint is: + [ CONSTRAINT constraint_name ] + { UNIQUE ( column_name [, ... ] ) | + PRIMARY KEY ( column_name [, ... ] ) | + CHECK ( expression ) | + FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ] + [ MATCH FULL | MATCH PARTIAL ] [ ON DELETE action ] [ ON UPDATE action ] } + [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] + */ + + + /* + CREATE [ UNIQUE ] INDEX index_name ON table +[ USING acc_method ] ( column [ ops_name ] [, ...] ) +[ WHERE predicate ] +CREATE [ UNIQUE ] INDEX index_name ON table +[ USING acc_method ] ( func_name( column [, ... ]) [ ops_name ] ) +[ WHERE predicate ] + */ + function _IndexSQL($idxname, $tabname, $flds, $idxoptions) + { + $sql = array(); + + if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { + $sql[] = sprintf ($this->dropIndex, $idxname, $tabname); + if ( isset($idxoptions['DROP']) ) + return $sql; + } + + if ( empty ($flds) ) { + return $sql; + } + + $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : ''; + + $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' '; + + if (isset($idxoptions['HASH'])) + $s .= 'USING HASH '; + + if ( isset($idxoptions[$this->upperName]) ) + $s .= $idxoptions[$this->upperName]; + + if ( is_array($flds) ) + $flds = implode(', ',$flds); + $s .= '(' . $flds . ')'; + $sql[] = $s; + + return $sql; + } + + function _GetSize($ftype, $ty, $fsize, $fprec) + { + if (strlen($fsize) && $ty != 'X' && $ty != 'B' && $ty != 'I' && strpos($ftype,'(') === false) { + $ftype .= "(".$fsize; + if (strlen($fprec)) $ftype .= ",".$fprec; + $ftype .= ')'; + } + return $ftype; + } +} +?> \ No newline at end of file Added: trunk/linpha2/lib/adodb/datadict/datadict-sapdb.inc.php =================================================================== --- trunk/linpha2/lib/adodb/datadict/datadict-sapdb.inc.php (rev 0) +++ trunk/linpha2/lib/adodb/datadict/datadict-sapdb.inc.php 2008-02-13 22:02:33 UTC (rev 4879) @@ -0,0 +1,121 @@ +<?php + +/** + V4.50 6 July 2004 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + Released under both BSD license and Lesser GPL library license. + Whenever there is any discrepancy between the two licenses, + the BSD license will take precedence. + + Set tabs to 4 for best viewing. + + Modified from datadict-generic.inc.php for sapdb by RalfBecker-AT-outdoor-training.de +*/ + +// security - hide paths +if (!defined('ADODB_DIR')) die(); + +class ADODB2_sapdb extends ADODB_DataDict { + + var $databaseType = 'sapdb'; + var $seqField = false; + var $renameColumn = 'RENAME COLUMN %s.%s TO %s'; + + function ActualType($meta) + { + switch($meta) { + case 'C': return 'VARCHAR'; + case 'XL': + case 'X': return 'LONG'; + + case 'C2': return 'VARCHAR UNICODE'; + case 'X2': return 'LONG UNICODE'; + + case 'B': return 'LONG'; + + case 'D': return 'DATE'; + case 'T': return 'TIMESTAMP'; + + case 'L': return 'BOOLEAN'; + case 'I': return 'INTEGER'; + case 'I1': return 'FIXED(3)'; + case 'I2': return 'SMALLINT'; + case 'I4': return 'INTEGER'; + case 'I8': return 'FIXED(20)'; + + case 'F': return 'FLOAT(38)'; + case 'N': return 'FIXED'; + default: + return $meta; + } + } + + function MetaType($t,$len=-1,$fieldobj=false) + { + if (is_object($t)) { + $fieldobj = $t; + $t = $fieldobj->type; + $len = $fieldobj->max_length; + } + static $maxdb_type2adodb = array( + 'VARCHAR' => 'C', + 'CHARACTER' => 'C', + 'LONG' => 'X', // no way to differ between 'X' and 'B' :-( + 'DATE' => 'D', + 'TIMESTAMP' => 'T', + 'BOOLEAN' => 'L', + 'INTEGER' => 'I4', + 'SMALLINT' => 'I2', + 'FLOAT' => 'F', + 'FIXED' => 'N', + ); + $type = isset($maxdb_type2adodb[$t]) ? $maxdb_type2adodb[$t] : 'C'; + + // convert integer-types simulated with fixed back to integer + if ($t == 'FIXED' && !$fieldobj->scale && ($len == 20 || $len == 3)) { + $type = $len == 20 ? 'I8' : 'I1'; + } + if ($fieldobj->auto_increment) $type = 'R'; + + return $type; + } + + // return string must begin with space + function _CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + $suffix = ''; + if ($funsigned) $suffix .= ' UNSIGNED'; + if ($fnotnull) $suffix .= ' NOT NULL'; + if ($fautoinc) $suffix .= ' DEFAULT SERIAL'; + elseif (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; + if ($fconstraint) $suffix .= ' '.$fconstraint; + return $suffix; + } + + function AddColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + return array( 'ALTER TABLE ' . $tabname . ' ADD (' . implode(', ',$lines) . ')' ); + } + + function AlterColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + $sql = array(); + list($lines,$pkey) = $this->_GenFields($flds); + return array( 'ALTER TABLE ' . $tabname . ' MODIFY (' . implode(', ',$lines) . ')' ); + } + + function DropColumnSQL($tabname, $flds) + { + $tabname = $this->TableName ($tabname); + if (!is_array($flds)) $flds = explode(',',$flds); + foreach($flds as $k => $v) { + $flds[$k] = $this->NameQuote($v); + } + return array( 'ALTER TABLE ' . $tabname . ' DROP ... [truncated message content] |
From: <fan...@us...> - 2008-02-13 22:01:30
|
Revision: 4878 http://linpha.svn.sourceforge.net/linpha/?rev=4878&view=rev Author: fangehrn Date: 2008-02-13 14:01:25 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Property Changed: ---------------- trunk/misc/datadict/ Property changes on: trunk/misc/datadict ___________________________________________________________________ Name: svn:ignore + sqlite.db This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-13 22:00:31
|
Revision: 4877 http://linpha.svn.sourceforge.net/linpha/?rev=4877&view=rev Author: fangehrn Date: 2008-02-13 14:00:22 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/misc/benchmark/benchmark.php Added Paths: ----------- trunk/misc/datadict/ trunk/misc/datadict/info.txt trunk/misc/datadict/linpha_schema.xml trunk/misc/datadict/test_datadict.php trunk/misc/datadict/test_xml.php trunk/misc/datadict/test_xmldb.xml Modified: trunk/misc/benchmark/benchmark.php =================================================================== --- trunk/misc/benchmark/benchmark.php 2008-02-13 19:01:14 UTC (rev 4876) +++ trunk/misc/benchmark/benchmark.php 2008-02-13 22:00:22 UTC (rev 4877) @@ -1,5 +1,18 @@ <?php +define('LINPHA_DIR','../../linpha2'); +include_once(LINPHA_DIR.'/lib/include/common.php'); + +/** + * some init stuff + */ + require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + global $linpha; + $linpha = new Linpha(); + $linpha->sql->startSession(); + + + function callbackBenchmark() { benchmarkConfigTable(); Added: trunk/misc/datadict/info.txt =================================================================== --- trunk/misc/datadict/info.txt (rev 0) +++ trunk/misc/datadict/info.txt 2008-02-13 22:00:22 UTC (rev 4877) @@ -0,0 +1,7 @@ + + +some sqlite datadict files (untested): + +http://trac.akelos.org/browser/branches/kaste/framework/vendor/adodb/datadict/datadict-sqlite.inc.php?rev=459 +http://trac.phpdoctrine.org/browser/classes/adodb-hack/drivers/sqlite/sqlite_datadict.inc?rev=1 +http://www.xaraya.com/documentation/phpxref/nav.html?xaradodb/datadict/datadict-sqlite.inc.php.source.html \ No newline at end of file Added: trunk/misc/datadict/linpha_schema.xml =================================================================== --- trunk/misc/datadict/linpha_schema.xml (rev 0) +++ trunk/misc/datadict/linpha_schema.xml 2008-02-13 22:00:22 UTC (rev 4877) @@ -0,0 +1,332 @@ +<?xml version="1.0"?> +<schema version="0.3"> + <table name="linpha2_config"> + <field name="id" type="I" size="11"> + <KEY/> + <AUTOINCREMENT/> + + </field> + <field name="option_name" type="C" size="255"> + <NOTNULL/> + </field> + <field name="option_value" type="C" size="255"> + <NOTNULL/> + </field> + <field name="user_id" type="I" size="11"> + <DEFAULT value="0"/> + + </field> + <field name="override" type="I" size="6"> + <DEFAULT value="0"/> + </field> + <field name="override2" type="I" size="6"> + <DEFAULT value="1"/> + </field> + </table> + <table name="linpha2_groups"> + <field name="id" type="I" size="11"> + <KEY/> + <AUTOINCREMENT/> + + </field> + <field name="group_name" type="C" size="255"> + <NOTNULL/> + </field> + </table> + <table name="linpha2_meta_category"> + <field name="id" type="I" size="11"> + <KEY/> + <AUTOINCREMENT/> + + </field> + <field name="field_id" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="name" type="C" size="255"> + <NOTNULL/> + </field> + <field name="isprivate" type="I" size="6"/> + + </table> + <table name="linpha2_meta_comments"> + <field name="id" type="I" size="11"> + <KEY/> + <AUTOINCREMENT/> + </field> + <field name="md5sum" type="C" size="32"> + <NOTNULL/> + </field> + + <field name="meta_time" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="meta_author" type="C" size="255"> + <NOTNULL/> + </field> + <field name="meta_comment" type="X"> + <NOTNULL/> + + </field> + </table> + <table name="linpha2_meta_data"> + <field name="id" type="I" size="11"> + <KEY/> + <AUTOINCREMENT/> + </field> + <field name="field_id" type="I" size="11"> + <NOTNULL/> + + <DEFAULT value="0"/> + </field> + <field name="md5sum" type="C" size="32"> + <NOTNULL/> + </field> + <field name="meta_data" type="C" size="255"> + <NOTNULL/> + </field> + </table> + + <table name="linpha2_meta_exif"> + <field name="md5sum" type="C" size="32"> + <KEY/> + </field> + <field name="datetimeoriginal" type="C" size="255"/> + <field name="make" type="C" size="255"/> + <field name="model" type="C" size="255"/> + <field name="artist" type="C" size="255"/> + <field name="copyright" type="C" size="255"/> + + <field name="aperturevalue" type="C" size="255"/> + <field name="shutterspeedvalue" type="C" size="255"/> + <field name="exposuretime" type="C" size="255"/> + <field name="flash" type="C" size="255"/> + <field name="focallength" type="C" size="255"/> + <field name="fnumber" type="C" size="255"/> + </table> + <table name="linpha2_meta_fields"> + <field name="id" type="I" size="11"> + + <KEY/> + <AUTOINCREMENT/> + </field> + <field name="name" type="C" size="255"> + <NOTNULL/> + </field> + <field name="field_type" type="I" size="6"> + <NOTNULL/> + <DEFAULT value="0"/> + + </field> + <field name="flags" type="I" size="6"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + </table> + <table name="linpha2_meta_iptc"> + <field name="md5sum" type="C" size="32"> + <KEY/> + + </field> + </table> + <table name="linpha2_meta_xmp"> + <field name="md5sum" type="C" size="32"> + <KEY/> + </field> + </table> + <table name="linpha2_permissions"> + <field name="id" type="I" size="11"> + + <KEY/> + <AUTOINCREMENT/> + </field> + <field name="photos_id" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="perm_type" type="C" size="255"> + <NOTNULL/> + + <DEFAULT value="0"/> + </field> + <field name="permission" type="C" size="255"> + <NOTNULL/> + </field> + </table> + <table name="linpha2_photos"> + <field name="id" type="I" size="11"> + <KEY/> + + <AUTOINCREMENT/> + </field> + <field name="parent_id" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="img_type" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + + </field> + <field name="name" type="C" size="255"> + <NOTNULL/> + </field> + <field name="md5sum" type="C" size="32"> + <NOTNULL/> + </field> + <field name="width" type="I" size="11"> + <NOTNULL/> + + <DEFAULT value="0"/> + </field> + <field name="height" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="filesize" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + + </field> + <field name="time_add" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="time_mod" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + + <field name="time_exif" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="rotate" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="stats_numbers" type="I" size="11"> + + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="stats_views" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="stats_downloads" type="I" size="11"> + <NOTNULL/> + + <DEFAULT value="0"/> + </field> + <field name="geodata" type="I" size="1"> + <DEFAULT value="0"/> + </field> + </table> + <table name="linpha2_photos_cache"> + <field name="id" type="I" size="11"> + <KEY/> + + <AUTOINCREMENT/> + </field> + <field name="photo_id" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="img_width" type="I" size="6"> + <NOTNULL/> + <DEFAULT value="0"/> + + </field> + <field name="img_height" type="I" size="6"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="img_quality" type="I" size="6"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + + <field name="img_size" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="is_rotated" type="I" size="6"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="has_watermark" type="I" size="6"> + + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="time_add" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="time_use" type="I" size="11"> + <NOTNULL/> + + <DEFAULT value="0"/> + </field> + <field name="time_creating" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + <field name="hits" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + + </field> + </table> + <table name="linpha2_user_group"> + <field name="id" type="I" size="11"> + <KEY/> + <AUTOINCREMENT/> + </field> + <field name="group_id" type="I" size="11"> + <NOTNULL/> + + <DEFAULT value="0"/> + </field> + <field name="user_id" type="I" size="11"> + <NOTNULL/> + <DEFAULT value="0"/> + </field> + </table> + <table name="linpha2_users"> + <field name="id" type="I" size="11"> + + <KEY/> + <AUTOINCREMENT/> + </field> + <field name="username" type="C" size="255"> + <NOTNULL/> + </field> + <field name="password" type="C" size="255"> + <NOTNULL/> + </field> + + <field name="user_email" type="C" size="255"> + <NOTNULL/> + </field> + <field name="display_name" type="C" size="255"> + <NOTNULL/> + </field> + <field name="stats_downloads" type="I" size="11"> + <DEFAULT value="0"/> + </field> + + <field name="stats_downloads_size" type="I" size="11"> + <DEFAULT value="0"/> + </field> + </table> + + <sql> + <descr>Insert some data into the users table.</descr> + <query>insert into linpha2_config (option_name, option_value) values ( 'admin', 'true' )</query> + <query>insert into linpha2_config (option_name, option_value) values ( 'admin2', 'false' )</query> + </sql> + +</schema> \ No newline at end of file Added: trunk/misc/datadict/test_datadict.php =================================================================== --- trunk/misc/datadict/test_datadict.php (rev 0) +++ trunk/misc/datadict/test_datadict.php 2008-02-13 22:00:22 UTC (rev 4877) @@ -0,0 +1,72 @@ +<?php +define('LINPHA_DIR','../../linpha2'); + +error_reporting(E_ALL); +include_once(LINPHA_DIR.'/lib/adodb/adodb.inc.php'); + +//$db = &NewADOConnection("mysql://root:test@localhost/linpha2"); +//$db = &NewADOConnection("pgsql://root:test@localhost/linpha2"); +$db = &NewADOConnection("sqlite://sqlite.db"); + +$db->debug = true; + +/*$db->Execute('SET NAMES "UTF8"'); +$db->Execute("SET collation_connection='utf8_general_ci'"); +$db->Execute("SET collation_server='utf8_general_ci'"); +$db->Execute("SET character_set_client='utf8'"); +$db->Execute("SET character_set_connection='utf8'"); +$db->Execute("SET character_set_results='utf8'"); +$db->Execute("SET character_set_server='utf8'");*/ + + +# First create a normal connection +//$db = NewADOConnection('mysql'); +//$db->Connect(...); + +# Then create a data dictionary object, using this connection +$dict = &NewDataDictionary($db); + +# We have a portable declarative data dictionary format in ADOdb, similar to SQL. +# Field types use 1 character codes, and fields are separated by commas. +# The following example creates three fields: "col1", "col2" and "col3": +$flds = " + event_id I(11) NOTNULL AUTOINCREMENT PRIMARY, + event_type I(4) NOTNULL INDEX idx_evt, + event_start_date T DEFAULT NULL INDEX id_esd, + event_end_date T DEFAULT '0000-00-00 00:00:00' INDEX id_eted, + event_parent I(11) UNSIGNED NOTNULL DEFAULT 0 INDEX id_evp, + event_owner I(11) DEFAULT 0 INDEX idx_ev1, + event_project I(11) DEFAULT 0 INDEX idx_ev1, + event_times_recuring I(11) UNSIGNED NOTNULL DEFAULT 0, + event_icon C(20) DEFAULT 'obj/event', + event_description X +"; + +# We demonstrate creating tables and indexes +$tabname = "datadict_test"; +$idxname = "datadict_indexes"; +$taboptarray = array( + 'mysql' => 'ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci', + /*'oci8' => 'tablespace users',*/ + 'REPLACE' +); + +$sqlarray = $dict->CreateTableSQL($tabname, $flds, $taboptarray); +$dict->ExecuteSQLArray($sqlarray); + +/*echo '<pre>'; +print_r($sqlarray); +echo '</pre>';*/ + +$col_orig = "event_project"; +$col_ren = "event_project_ren"; + +$sqlarray = $dict->RenameColumnSQL($tabname,$col_orig,$col_ren,"event_project_ren I(11) DEFAULT 0 INDEX idx_ev1"); +$dict->ExecuteSQLArray($sqlarray); + +/*echo '<pre>'; +print_r($sqlarray); +echo '</pre>';*/ + + +?> \ No newline at end of file Added: trunk/misc/datadict/test_xml.php =================================================================== --- trunk/misc/datadict/test_xml.php (rev 0) +++ trunk/misc/datadict/test_xml.php 2008-02-13 22:00:22 UTC (rev 4877) @@ -0,0 +1,36 @@ +<?php +define('LINPHA_DIR','../../linpha2'); + +error_reporting(E_ALL); +include_once(LINPHA_DIR.'/lib/adodb/adodb.inc.php'); + +$db = &NewADOConnection("mysql://root:test@localhost/linpha2"); +//$db = &NewADOConnection("pgsql://root:test@localhost/linpha2"); +//$db = &NewADOConnection("sqlite://sqlite.db"); + +$db->debug = false; + +/*$db->Execute('SET NAMES "UTF8"'); +$db->Execute("SET collation_connection='utf8_general_ci'"); +$db->Execute("SET collation_server='utf8_general_ci'"); +$db->Execute("SET character_set_client='utf8'"); +$db->Execute("SET character_set_connection='utf8'"); +$db->Execute("SET character_set_results='utf8'"); +$db->Execute("SET character_set_server='utf8'");*/ + + +/* You must tell the script where to find the ADOdb and + * the AXMLS libraries. + */ +require( LINPHA_DIR.'/lib/adodb/adodb-xmlschema03.inc.php' ); + +$schema = new adoSchema( $db ); +$sql = $schema->ParseSchema( 'linpha_schema.xml' ); +$result = $schema->ExecuteSchema(); + +echo '<pre>'; +print_r($sql); +echo '</pre>'; + +//echo $schema->ExtractSchema(); +?> \ No newline at end of file Added: trunk/misc/datadict/test_xmldb.xml =================================================================== --- trunk/misc/datadict/test_xmldb.xml (rev 0) +++ trunk/misc/datadict/test_xmldb.xml 2008-02-13 22:00:22 UTC (rev 4877) @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<schema version="0.3"> + + <table name="users"> + <desc>A typical users table for our application.</desc> + <opt platform="mysql">ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci</opt> + <field name="userId" type="I"> + <descr>A unique ID assigned to each user.</descr> + + <KEY/> + <AUTOINCREMENT/> + </field> + + <field name="userName" type="C" size="16"><NOTNULL/></field> + + + <index name="userName"> + <descr>Put a unique index on the user name</descr> + <col>userName</col> + <UNIQUE/> + + </index> + </table> + + <sql> + <descr>Insert some data into the users table.</descr> + <query>insert into users (userName) values ( 'admin' )</query> + + <query>insert into users (userName) values ( 'Joe' )</query> + </sql> +</schema> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-13 19:01:28
|
Revision: 4876 http://linpha.svn.sourceforge.net/linpha/?rev=4876&view=rev Author: fangehrn Date: 2008-02-13 11:01:14 -0800 (Wed, 13 Feb 2008) Log Message: ----------- 2008-02-13 flo * moved not needed files to the misc folder * updated adodb to version 504 Modified Paths: -------------- trunk/linpha2/lib/classes/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/adodb-exceptions.inc.php Modified: trunk/linpha2/lib/classes/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-13 18:56:37 UTC (rev 4875) +++ trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-13 19:01:14 UTC (rev 4876) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/classes/adodb-exceptions.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-exceptions.inc.php 2008-02-13 18:56:37 UTC (rev 4875) +++ trunk/linpha2/lib/classes/adodb-exceptions.inc.php 2008-02-13 19:01:14 UTC (rev 4876) @@ -1,82 +1,82 @@ -<?php - -/** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. - * Released under both BSD license and Lesser GPL library license. - * Whenever there is any discrepancy between the two licenses, - * the BSD license will take precedence. - * - * Set tabs to 4 for best viewing. - * - * Latest version is available at http://php.weblogs.com - * - * Exception-handling code using PHP5 exceptions (try-catch-throw). - */ - - -if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); -define('ADODB_ERROR_HANDLER','adodb_throw'); - -class ADODB_Exception extends Exception { -var $dbms; -var $fn; -var $sql = ''; -var $params = ''; -var $host = ''; -var $database = ''; - - function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) - { - switch($fn) { - case 'EXECUTE': - $this->sql = $p1; - $this->params = $p2; - $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n"; - break; - - case 'PCONNECT': - case 'CONNECT': - $user = $thisConnection->user; - $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n"; - break; - default: - $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; - break; - } - - $this->dbms = $dbms; - if ($thisConnection) { - $this->host = $thisConnection->host; - $this->database = $thisConnection->database; - } - $this->fn = $fn; - $this->msg = $errmsg; - - if (!is_numeric($errno)) $errno = -1; - parent::__construct($s,$errno); - } -} - -/** -* Default Error Handler. This will be called with the following params -* -* @param $dbms the RDBMS you are connecting to -* @param $fn the name of the calling function (in uppercase) -* @param $errno the native error number from the database -* @param $errmsg the native error msg from the database -* @param $p1 $fn specific parameter - see below -* @param $P2 $fn specific parameter - see below -*/ - -function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) -{ -global $ADODB_EXCEPTION; - - if (error_reporting() == 0) return; // obey @ protocol - if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; - else $errfn = 'ADODB_EXCEPTION'; - throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); -} - - +<?php + +/** + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * Released under both BSD license and Lesser GPL library license. + * Whenever there is any discrepancy between the two licenses, + * the BSD license will take precedence. + * + * Set tabs to 4 for best viewing. + * + * Latest version is available at http://php.weblogs.com + * + * Exception-handling code using PHP5 exceptions (try-catch-throw). + */ + + +if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); +define('ADODB_ERROR_HANDLER','adodb_throw'); + +class ADODB_Exception extends Exception { +var $dbms; +var $fn; +var $sql = ''; +var $params = ''; +var $host = ''; +var $database = ''; + + function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) + { + switch($fn) { + case 'EXECUTE': + $this->sql = $p1; + $this->params = $p2; + $s = "$dbms error: [$errno: $errmsg] in $fn(\"$p1\")\n"; + break; + + case 'PCONNECT': + case 'CONNECT': + $user = $thisConnection->user; + $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n"; + break; + default: + $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; + break; + } + + $this->dbms = $dbms; + if ($thisConnection) { + $this->host = $thisConnection->host; + $this->database = $thisConnection->database; + } + $this->fn = $fn; + $this->msg = $errmsg; + + if (!is_numeric($errno)) $errno = -1; + parent::__construct($s,$errno); + } +} + +/** +* Default Error Handler. This will be called with the following params +* +* @param $dbms the RDBMS you are connecting to +* @param $fn the name of the calling function (in uppercase) +* @param $errno the native error number from the database +* @param $errmsg the native error msg from the database +* @param $p1 $fn specific parameter - see below +* @param $P2 $fn specific parameter - see below +*/ + +function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) +{ +global $ADODB_EXCEPTION; + + if (error_reporting() == 0) return; // obey @ protocol + if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; + else $errfn = 'ADODB_EXCEPTION'; + throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); +} + + ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-13 18:56:39
|
Revision: 4875 http://linpha.svn.sourceforge.net/linpha/?rev=4875&view=rev Author: fangehrn Date: 2008-02-13 10:56:37 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/misc/benchmark/perf.php Modified: trunk/misc/benchmark/perf.php =================================================================== --- trunk/misc/benchmark/perf.php 2008-02-13 18:55:13 UTC (rev 4874) +++ trunk/misc/benchmark/perf.php 2008-02-13 18:56:37 UTC (rev 4875) @@ -1,9 +1,9 @@ <?php -define('LINPHA_DIR','.'); +define('LINPHA_DIR','../../linpha2'); if (!file_exists(LINPHA_DIR.'/logsql.txt')) { - exit(1); + die("To enable sql logging create the file linpha/logsql.txt"); } include_once(LINPHA_DIR.'/lib/include/common.php'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-13 18:55:20
|
Revision: 4874 http://linpha.svn.sourceforge.net/linpha/?rev=4874&view=rev Author: fangehrn Date: 2008-02-13 10:55:13 -0800 (Wed, 13 Feb 2008) Log Message: ----------- 2008-02-13 flo * moved not needed files to the misc folder * updated adodb to version 504 Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/adodb/adodb-active-record.inc.php trunk/linpha2/lib/adodb/adodb-csvlib.inc.php trunk/linpha2/lib/adodb/adodb-datadict.inc.php trunk/linpha2/lib/adodb/adodb-error.inc.php trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php trunk/linpha2/lib/adodb/adodb-errorpear.inc.php trunk/linpha2/lib/adodb/adodb-exceptions.inc.php trunk/linpha2/lib/adodb/adodb-iterator.inc.php trunk/linpha2/lib/adodb/adodb-lib.inc.php trunk/linpha2/lib/adodb/adodb-pager.inc.php trunk/linpha2/lib/adodb/adodb-pear.inc.php trunk/linpha2/lib/adodb/adodb-perf.inc.php trunk/linpha2/lib/adodb/adodb-php4.inc.php trunk/linpha2/lib/adodb/adodb-time.inc.php trunk/linpha2/lib/adodb/adodb.inc.php trunk/linpha2/lib/adodb/docs/docs-adodb.htm trunk/linpha2/lib/adodb/docs/docs-datadict.htm trunk/linpha2/lib/adodb/docs/docs-perf.htm trunk/linpha2/lib/adodb/docs/docs-session.htm trunk/linpha2/lib/adodb/docs/docs-session.old.htm trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php trunk/linpha2/lib/adodb/perf/perf-db2.inc.php trunk/linpha2/lib/adodb/perf/perf-informix.inc.php trunk/linpha2/lib/adodb/perf/perf-mssql.inc.php trunk/linpha2/lib/adodb/perf/perf-mysql.inc.php trunk/linpha2/lib/adodb/perf/perf-oci8.inc.php trunk/linpha2/lib/adodb/perf/perf-postgres.inc.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/ChangeLog 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,4 +1,8 @@ +2008-02-13 flo + * moved not needed files to the misc folder + * updated adodb to version 504 + 2008-02-11 flo * deleted "debug" files and added them to the ignore list -> we will not forget them on releases and they will not be on any snapshot Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/index.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,11 +1,11 @@ <?php if(defined('LINPHA_DIR')) { - if(!defined('LINPHA_IS_INCLUDED')) { - define('LINPHA_IS_INCLUDED',1); - } + if(!defined('LINPHA_IS_INCLUDED')) { + define('LINPHA_IS_INCLUDED',1); + } } else { - define('LINPHA_DIR','.'); + define('LINPHA_DIR','.'); } include_once(LINPHA_DIR.'/lib/include/common.php'); @@ -13,84 +13,81 @@ /** * some init stuff */ - require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - global $linpha; - $linpha = new Linpha(); - $linpha->sql->startSession(); - - include_once(LINPHA_DIR.'/lib/include/integrity.php'); - include_once(LINPHA_DIR.'/lib/include/upgrade.php'); + require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + global $linpha; + $linpha = new Linpha(); + $linpha->sql->startSession(); + + include_once(LINPHA_DIR.'/lib/include/integrity.php'); + include_once(LINPHA_DIR.'/lib/include/upgrade.php'); + + if(!isset($_GET['linCat'])) + { + $_GET['linCat'] = 'alb'; + } - if(!isset($_GET['linCat'])) - { - $_GET['linCat'] = 'alb'; - } - /** * open modules */ switch($_GET['linCat']) { case 'alb': - require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.albums.php'); + break; case 'search': - require_once(LINPHA_DIR.'/lib/modules/module.search.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.search.php'); + break; case 'basket': - require_once(LINPHA_DIR.'/lib/modules/module.basket.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.basket.php'); + break; case 'browse': - require_once(LINPHA_DIR.'/lib/modules/module.browse.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.browse.php'); + break; case 'settings': - require_once(LINPHA_DIR.'/lib/modules/module.settings.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.settings.php'); + break; case 'ajax': - require_once(LINPHA_DIR.'/lib/modules/module.ajax.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.ajax.php'); + break; case 'newimg': - require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.newimg.php'); + break; case 'metadata': - require_once(LINPHA_DIR.'/lib/include/metadata_info_show.php'); - break; + require_once(LINPHA_DIR.'/lib/include/metadata_info_show.php'); + break; case 'video': - require_once(LINPHA_DIR.'/lib/modules/module.video.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.video.php'); + break; case 'panorama': - require_once(LINPHA_DIR.'/lib/modules/module.panorama.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.panorama.php'); + break; case 'download': - require_once(LINPHA_DIR.'/lib/modules/module.download.php'); - break; + require_once(LINPHA_DIR.'/lib/modules/module.download.php'); + break; case 'geodata': require_once(LINPHA_DIR.'/lib/modules/module.geodata.php'); break; -case 'benchmark': - require_once(LINPHA_DIR.'/lib/modules/module.benchmark.php'); - break; case 'empty': - require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); - break; - -default: - // include plugins - $pluginDir = LINPHA_DIR.'/lib/plugins'; - $includeFile = $pluginDir.'/'.$_GET['linCat'].'/module.'.$_GET['linCat'].'.php'; + require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); + break; - if( is_dir($pluginDir) - && isset($GLOBALS['linpha']->sql->config->value['plugins_'.$_GET['linCat'].'_enable']) - && $GLOBALS['linpha']->sql->config->value['plugins_'.$_GET['linCat'].'_enable']=='1' - && file_exists($includeFile)) - { - require_once($includeFile); - } - else - { - require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); - } - break; +default: + // include plugins + $pluginDir = LINPHA_DIR.'/lib/plugins'; + $includeFile = $pluginDir.'/'.$_GET['linCat'].'/module.'.$_GET['linCat'].'.php'; + + if( is_dir($pluginDir) + && isset($GLOBALS['linpha']->sql->config->value['plugins_'.$_GET['linCat'].'_enable']) + && $GLOBALS['linpha']->sql->config->value['plugins_'.$_GET['linCat'].'_enable']=='1' + && file_exists($includeFile)) + { + require_once($includeFile); + } + else + { + require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); + } + break; } ?> \ No newline at end of file Modified: trunk/linpha2/lib/adodb/adodb-active-record.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-active-record.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-active-record.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* -@version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +@version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Latest version is available at http://adodb.sourceforge.net Released under both BSD license and Lesser GPL library license. Modified: trunk/linpha2/lib/adodb/adodb-csvlib.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-csvlib.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-csvlib.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -8,7 +8,7 @@ /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/adodb-datadict.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-datadict.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-datadict.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /** - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-error.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-error.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-error.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-errorpear.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorpear.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-errorpear.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-exceptions.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-exceptions.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-exceptions.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-iterator.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-iterator.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-iterator.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-lib.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-lib.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-lib.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -10,7 +10,7 @@ $ADODB_INCLUDED_LIB = 1; /* - @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim\@natsoft.com.my). All rights reserved. + @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim\@natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. @@ -417,7 +417,7 @@ } else $rewritesql = "SELECT COUNT(*) FROM (".$rewritesql.")"; - } else if (strncmp($zthis->databaseType,'postgres',8) == 0) { + } else if (strncmp($zthis->databaseType,'postgres',8) == 0 || strncmp($zthis->databaseType,'mysql',5) == 0) { $rewritesql = "SELECT COUNT(*) FROM ($rewritesql) _ADODB_ALIAS_"; } else { $rewritesql = "SELECT COUNT(*) FROM ($rewritesql)"; @@ -451,7 +451,7 @@ // strip off unneeded ORDER BY if no UNION if (preg_match('/\s*UNION\s*/is', $sql)) $rewritesql = $sql; - else $rewritesql = preg_replace('/(\sORDER\s+BY\s.*)/is','',$sql); + else $rewritesql = $rewritesql = adodb_strip_order_by($sql); if (preg_match('/\sLIMIT\s+[0-9]+/i',$sql,$limitarr)) $rewritesql .= $limitarr[0]; @@ -1012,7 +1012,6 @@ if (!is_numeric($val)) $val = (integer) $val; break; - default: $val = str_replace(array("'"," ","("),"",$arrFields[$fname]); // basic sql injection defence if (empty($val)) $val = '0'; Modified: trunk/linpha2/lib/adodb/adodb-pager.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-pager.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-pager.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-pear.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-pear.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-pear.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-perf.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-perf.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-perf.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/adodb-php4.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-php4.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-php4.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/adodb-time.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-time.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb-time.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -242,6 +242,12 @@ CHANGELOG +- 11 Feb 2008 0.33 +* Bug in 0.32 fix for hour handling. Fixed. + +- 1 Feb 2008 0.32 +* Now adodb_mktime(0,0,0,12+$m,20,2040) works properly. + - 10 Jan 2008 0.31 * Now adodb_mktime(0,0,0,24,1,2037) works correctly. @@ -380,7 +386,7 @@ /* Version Number */ -define('ADODB_DATE_VERSION',0.31); +define('ADODB_DATE_VERSION',0.33); $ADODB_DATETIME_CLASS = (PHP_VERSION >= 5.2); @@ -426,10 +432,13 @@ /** Test Suite -*/ +*/ function adodb_date_test() { + for ($m=-24; $m<=24; $m++) + echo "$m :",adodb_date('d-m-Y',adodb_mktime(0,0,0,1+$m,20,2040)),"<br>"; + error_reporting(E_ALL); print "<h4>Testing adodb_date and adodb_mktime. version=".ADODB_DATE_VERSION.' PHP='.PHP_VERSION."</h4>"; @set_time_limit(0); @@ -1211,7 +1220,7 @@ ); - if ($usephpfns && ($year + $mon/12+$day/365.25+$hr*24*365.25 >= 2038)) $usephpfns = false; + if ($usephpfns && ($year + $mon/12+$day/365.25+$hr/(24*365.25) >= 2038)) $usephpfns = false; if ($usephpfns) { return $is_gmt ? @@ -1237,7 +1246,7 @@ $year = adodb_year_digit_check($year); if ($mon > 12) { - $y = floor($mon / 12); + $y = floor(($mon-1)/ 12); $year += $y; $mon -= $y*12; } else if ($mon < 1) { Modified: trunk/linpha2/lib/adodb/adodb.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/adodb.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -14,7 +14,7 @@ /** \mainpage - @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. You can choose which license you prefer. @@ -169,7 +169,7 @@ /** * ADODB version as a string. */ - $ADODB_vers = 'V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.'; + $ADODB_vers = 'V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released BSD & LGPL.'; /** * Determines whether recordset->RecordCount() is used. Modified: trunk/linpha2/lib/adodb/docs/docs-adodb.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-adodb.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-adodb.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -15,7 +15,7 @@ <body bgcolor="#ffffff" text="black"> <h2>ADOdb Library for PHP</h2> -<p>V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com)</p> +<p>V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com)</p> <p><font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.</font></p> @@ -2118,7 +2118,7 @@ Since 4.96, we return null if no records were found.</font></p> <p><font><b>GetRow<a name="getrow"></a>($sql,$inputarr=false)</b></font></p> <p><font>Executes the SQL and returns the first row as an array. The recordset and remaining - rows are discarded for you automatically. If an error occurs, false is returned.</font></p> + rows are discarded for you automatically. If no data is found, an empty recordset is returned. If an error occurs, false is returned.</font></p> <p><font><b>GetAll<a name="getall"></a>($sql,$inputarr=false)</b></font></p> <p>Executes the SQL and returns the all the rows as a 2-dimensional @@ -2929,6 +2929,11 @@ <h2><font>Change Log<a name="Changes"></a><a name="changes"></a><a name="changelog"></a></font></h2> +<p><a name="4.98"></a><b>4.98/5.04 13 Feb 2008</b> +<p> Fixed adodb_mktime problem which causes a performance bottleneck in $hrs. +<p>Added mysqli support to adodb_getcount(). +<p>Removed MYSQLI_TYPE_CHAR from MetaType(). + <p><a name="4.97"></a><b>4.97/5.03 22 Jan 2008</b> <p>Active Record: $ADODB_ASSOC_CASE=1 did not work properly. Fixed. <p>Modified Fields() in recordset class to support display null fields in FetchNextObject(). Modified: trunk/linpha2/lib/adodb/docs/docs-datadict.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-datadict.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-datadict.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -20,7 +20,7 @@ </head> <body style="background-color: rgb(255, 255, 255);"> <h2>ADOdb Data Dictionary Library for PHP</h2> -<p>V5.03 22 Jan 2008 (c) 2000-2008 John Lim (<a +<p>V5.04 13 Feb 2008 (c) 2000-2008 John Lim (<a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a>).<br> AXMLS (c) 2004 ars Cognita, Inc</p> <p><font size="1">This software is dual licensed using BSD-Style and Modified: trunk/linpha2/lib/adodb/docs/docs-perf.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-perf.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-perf.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -18,7 +18,7 @@ </head> <body> <h3>The ADOdb Performance Monitoring Library</h3> -<p>V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my)</p> +<p>V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my)</p> <p><font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.</font></p> Modified: trunk/linpha2/lib/adodb/docs/docs-session.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-session.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-session.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -21,7 +21,7 @@ <body style="background-color: rgb(255, 255, 255);"> <h1>ADODB Session 2 Management Manual</h1> <p> -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my) +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my) </p> <p> <font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial Modified: trunk/linpha2/lib/adodb/docs/docs-session.old.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-session.old.htm 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/docs/docs-session.old.htm 2008-02-13 18:55:13 UTC (rev 4874) @@ -21,7 +21,7 @@ <body style="background-color: rgb(255, 255, 255);"> <h3>ADODB Session Management Manual</h3> <p> -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my) +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my) </p> <p> <font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial Modified: trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-access.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ado.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ado5.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ado_access.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ado_mssql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-borland_ibase.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-csv.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-db2.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2006 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2006 John Lim (jlim#natsoft.com.my). All rights reserved. This is a version of the ADODB driver for DB2. It uses the 'ibm_db2' PECL extension for PHP (http://pecl.php.net/package/ibm_db2), which in turn requires DB2 V8.2.2 or Modified: trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-fbsql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-firebird.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ibase.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-informix.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** -* @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +* @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-informix72.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim. All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-ldap.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mssql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mssqlpo.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** -* @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +* @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mysql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mysqli.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. @@ -945,7 +945,7 @@ case 'SET': case MYSQLI_TYPE_TINY_BLOB : - case MYSQLI_TYPE_CHAR : + #case MYSQLI_TYPE_CHAR : case MYSQLI_TYPE_STRING : case MYSQLI_TYPE_ENUM : case MYSQLI_TYPE_SET : @@ -1052,7 +1052,7 @@ case 'SET': case MYSQLI_TYPE_TINY_BLOB : - case MYSQLI_TYPE_CHAR : + #case MYSQLI_TYPE_CHAR : case MYSQLI_TYPE_STRING : case MYSQLI_TYPE_ENUM : case MYSQLI_TYPE_SET : Modified: trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mysqlpo.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-mysqlt.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-netezza.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. First cut at the Netezza Driver by Josh Eldridge joshuae74#hotmail.com Based on the previous postgres drivers. Modified: trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-oci8.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* - version V5.03 22 Jan 2008 (c) 2000-2008 John Lim. All rights reserved. + version V5.04 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, Modified: trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-oci805.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /** - * @version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + * @version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. * Released under both BSD license and Lesser GPL library license. * Whenever there is any discrepancy between the two licenses, * the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-oci8po.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim. All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbc.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbc_db2.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbc_mssql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbc_oracle.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbtp.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-odbtp_unicode.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. See License.txt. Modified: trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-oracle.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo_mssql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -2,7 +2,7 @@ /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo_mysql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -2,7 +2,7 @@ /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo_oci.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -2,7 +2,7 @@ /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-pdo_pgsql.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,7 +1,7 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-postgres.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-postgres64.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-postgres7.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-postgres8.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-proxy.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sapdb.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sqlanywhere.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -version V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights +version V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, Modified: trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sqlite.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sqlitepo.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sybase.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim. All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim. All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-sybase_ase.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* - V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. + V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php =================================================================== --- trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php 2008-02-13 18:42:19 UTC (rev 4873) +++ trunk/linpha2/lib/adodb/drivers/adodb-vfp.inc.php 2008-02-13 18:55:13 UTC (rev 4874) @@ -1,6 +1,6 @@ <?php /* -V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. +V5.04 13 Feb 2008 (c) 2000-2008 John Lim (jlim#natsoft.com.my). All rights reserved. Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Modified: trunk/linpha2/lib/adodb/perf/perf-db2.inc.php =================================================================== --- trunk/linpha2/lib/adodb/perf/perf-db2.inc.php 2008-02-13 18:42:19 UTC (rev... [truncated message content] |
From: <fan...@us...> - 2008-02-13 18:42:23
|
Revision: 4873 http://linpha.svn.sourceforge.net/linpha/?rev=4873&view=rev Author: fangehrn Date: 2008-02-13 10:42:19 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/misc/benchmark/benchmark.php Removed Paths: ------------- trunk/linpha2/lib/modules/module.benchmark.php Deleted: trunk/linpha2/lib/modules/module.benchmark.php =================================================================== --- trunk/linpha2/lib/modules/module.benchmark.php 2008-02-13 18:37:37 UTC (rev 4872) +++ trunk/linpha2/lib/modules/module.benchmark.php 2008-02-13 18:42:19 UTC (rev 4873) @@ -1,118 +0,0 @@ -<?php - -function callbackBenchmark() -{ - benchmarkConfigTable(); - - echo '<br /><br />'; - - echo microtime(true)-$GLOBALS['linStartTime'].'<br />'; -} - - -function benchmarkConfigTable() -{ - $startTime = microtime(true); - - - $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . - "FROM ".LIN_PREFIX."config WHERE user_id = '0'"); - while($data = $query->FetchRow()) - { - $config[$data['option_name']] = $data['option_value']; - } - - $dbversion = $config['sys_db_version']; - $events = $config['plugins_log_email_add_events']; - //$nrprevnext = $config['sys_style_image_nrprevnextthumbs]']; - //$nrrows = $config['sys_style_thumb_nojsnrrows']; - //$nrcols = $config['sys_style_thumb_nojsnrcols']; - - $endTime = microtime(true); - echo ($endTime - $startTime).'<br />'; - - - $startTime = adodb_microtime(); - - $dbversion = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'sys_db_version'"); - $events = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'plugins_log_email_add_events'"); - //$nrprevnext = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'sys_style_image_nrprevnextthumbs'"); - //$nrrows = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'sys_style_thumb_nojsnrrows'"); - //$nrcols = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'sys_style_thumb_nojsnrcols'"); - - $endTime = microtime(true); - echo ($endTime - $startTime).'<br />'; - - /** - * 1 config element: - run 1 - 0.00226402282715 - 0.00149202346802 - - run 2 - 0.00227904319763 - 0.00114703178406 - - run 3 - 0.00260281562805 - 0.00146698951721 - - run 4 - 0.00237584114075 - 0.00184106826782 - - * 2 config elements - run 1 - 0.00249886512756 - 0.00247406959534 - - run 2 - 0.00243592262268 - 0.00234603881836 - - run 3 - 0.00245499610901 - 0.00245714187622 - - run 4 - 0.00249600410461 - 0.00249814987183 - - * 5 config elements: - run 1 - 0.00249576568604 - 0.00594997406006 - - run 2 - 0.00240993499756 - 0.00583410263062 - - run 3 - 0.00282597541809 - 0.00611996650696 - - run 4 - 0.00280523300171 - 0.00573897361755 - - - - -> yes it is good to have an array with the saved config entries - */ -} - -function benchmarkGetAssoc() -{ - // $db->GetAssoc - // array_merge - // copy by reference -} - - -$linpha->template->output['default'] = ''; -$linpha->template->fnCallback = 'callbackBenchmark'; -$linpha->template->setModuleName('default'); -$linpha->template->URL_full = LINPHA_LINK.'&linCat=empty'; -$linpha->template->output['title'] = i18n("empty"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); -?> \ No newline at end of file Copied: trunk/misc/benchmark/benchmark.php (from rev 4872, trunk/linpha2/lib/modules/module.benchmark.php) =================================================================== --- trunk/misc/benchmark/benchmark.php (rev 0) +++ trunk/misc/benchmark/benchmark.php 2008-02-13 18:42:19 UTC (rev 4873) @@ -0,0 +1,118 @@ +<?php + +function callbackBenchmark() +{ + benchmarkConfigTable(); + + echo '<br /><br />'; + + echo microtime(true)-$GLOBALS['linStartTime'].'<br />'; +} + + +function benchmarkConfigTable() +{ + $startTime = microtime(true); + + + $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . + "FROM ".LIN_PREFIX."config WHERE user_id = '0'"); + while($data = $query->FetchRow()) + { + $config[$data['option_name']] = $data['option_value']; + } + + $dbversion = $config['sys_db_version']; + $events = $config['plugins_log_email_add_events']; + //$nrprevnext = $config['sys_style_image_nrprevnextthumbs]']; + //$nrrows = $config['sys_style_thumb_nojsnrrows']; + //$nrcols = $config['sys_style_thumb_nojsnrcols']; + + $endTime = microtime(true); + echo ($endTime - $startTime).'<br />'; + + + $startTime = adodb_microtime(); + + $dbversion = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'sys_db_version'"); + $events = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'plugins_log_email_add_events'"); + //$nrprevnext = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'sys_style_image_nrprevnextthumbs'"); + //$nrrows = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'sys_style_thumb_nojsnrrows'"); + //$nrcols = $GLOBALS['linpha']->db->GetOne("SELECT option_value FROM ".LIN_PREFIX."config WHERE user_id = '0' AND option_name = 'sys_style_thumb_nojsnrcols'"); + + $endTime = microtime(true); + echo ($endTime - $startTime).'<br />'; + + /** + * 1 config element: + run 1 + 0.00226402282715 + 0.00149202346802 + + run 2 + 0.00227904319763 + 0.00114703178406 + + run 3 + 0.00260281562805 + 0.00146698951721 + + run 4 + 0.00237584114075 + 0.00184106826782 + + * 2 config elements + run 1 + 0.00249886512756 + 0.00247406959534 + + run 2 + 0.00243592262268 + 0.00234603881836 + + run 3 + 0.00245499610901 + 0.00245714187622 + + run 4 + 0.00249600410461 + 0.00249814987183 + + * 5 config elements: + run 1 + 0.00249576568604 + 0.00594997406006 + + run 2 + 0.00240993499756 + 0.00583410263062 + + run 3 + 0.00282597541809 + 0.00611996650696 + + run 4 + 0.00280523300171 + 0.00573897361755 + + + + -> yes it is good to have an array with the saved config entries + */ +} + +function benchmarkGetAssoc() +{ + // $db->GetAssoc + // array_merge + // copy by reference +} + + +$linpha->template->output['default'] = ''; +$linpha->template->fnCallback = 'callbackBenchmark'; +$linpha->template->setModuleName('default'); +$linpha->template->URL_full = LINPHA_LINK.'&linCat=empty'; +$linpha->template->output['title'] = i18n("empty"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-13 18:37:40
|
Revision: 4872 http://linpha.svn.sourceforge.net/linpha/?rev=4872&view=rev Author: fangehrn Date: 2008-02-13 10:37:37 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Removed Paths: ------------- trunk/misc/.settings/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-13 18:36:35
|
Revision: 4871 http://linpha.svn.sourceforge.net/linpha/?rev=4871&view=rev Author: fangehrn Date: 2008-02-13 10:36:23 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Removed Paths: ------------- trunk/misc/.cache/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-12 18:01:25
|
Revision: 4870 http://linpha.svn.sourceforge.net/linpha/?rev=4870&view=rev Author: bzrudi Date: 2008-02-12 10:01:18 -0800 (Tue, 12 Feb 2008) Log Message: ----------- default of 350px is ways to large for widescreen laptop reduced to 150px Modified Paths: -------------- trunk/linpha2/lib/plugins/maps/sql/sql.data.php Modified: trunk/linpha2/lib/plugins/maps/sql/sql.data.php =================================================================== --- trunk/linpha2/lib/plugins/maps/sql/sql.data.php 2008-02-12 17:59:58 UTC (rev 4869) +++ trunk/linpha2/lib/plugins/maps/sql/sql.data.php 2008-02-12 18:01:18 UTC (rev 4870) @@ -16,7 +16,7 @@ "VALUES ('plugins_maps_google_key', 'ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg', '0', '0')"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."config (option_name, option_value, override, user_id) " . - "VALUES ('plugins_maps_markerThumbSize', '350', '0', '0')"; + "VALUES ('plugins_maps_markerThumbSize', '150', '0', '0')"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('plugins_maps_setMarkers', '')"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-12 18:00:13
|
Revision: 4869 http://linpha.svn.sourceforge.net/linpha/?rev=4869&view=rev Author: bzrudi Date: 2008-02-12 09:59:58 -0800 (Tue, 12 Feb 2008) Log Message: ----------- some minor geoimport improvements Modified Paths: -------------- trunk/linpha2/lib/modules/module.geodata.php trunk/linpha2/lib/plugins/maps/xml_parser.class.php Modified: trunk/linpha2/lib/modules/module.geodata.php =================================================================== --- trunk/linpha2/lib/modules/module.geodata.php 2008-02-12 13:35:55 UTC (rev 4868) +++ trunk/linpha2/lib/modules/module.geodata.php 2008-02-12 17:59:58 UTC (rev 4869) @@ -19,38 +19,112 @@ */ if (!defined('LINPHA_DIR')) { exit (1); } +if(!defined('TOP_DIR')) { define('TOP_DIR','../.'); } include_once LINPHA_DIR.'/lib/plugins/maps/xml_parser.class.php'; $urlFull = LINPHA_LINK.'&linCat=geodata'; -$linpha->template->setModuleName('geodata'); -//$linpha->template->overrideModule('head','map'); -$linpha->template->URL_full = $urlFull; -$linpha->template->URL_base = $urlFull; -$linpha->template->output['title'] = i18n("Geodata"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); +echo '<h1 class="linStyle">'.i18n("GPX File Import Wizzard").'</h1><hr>'; +if(!isset($_POST['cmd'])) +{ + //$query = $GLOBALS['linpha']->db->Execute("DELETE FROM ".LIN_PREFIX."plugins_maps_image_geodata "); + echo i18n("Please Select Folder With GPX File:")."<br />"; + echo "<form action='./?linCat=geodata' method='POST'> " . + "<select name='album_select[]' size='10' style='width: 500px;'>"; + linBuildAlbumSelect($with_all_albs_entry=false,$with_linebreaks=true); -$GPXData = new LinXmlParser('/tmp/sample.gpx'); -$array_with_gpx = $GPXData->readXmlFile(); -$track_times = $GPXData->getGpxTimeRange($array_with_gpx); -$image_times = $GPXData->getImageTimeRange(6); //parent_id linpha_photos + echo "</select><br />"; -echo "<br>***OFFSET CHECKING***"; - -if($GPXData->compareTimeRanges($track_times, $image_times)) -{ - echo "<br>Time range OK, going checking offset<br>"; - $GPXData->fixImagesOffset($track_times, $image_times, $image_tmp=array()); + echo "<br /><input type='hidden' name='cmd' value='step2'> " . + "<input type='submit' name='submit' " . + "value=".i18n(LIN_STR_SUBMIT)."></form>"; } -else +elseif($_POST['cmd'] == 'step2') { - echo "<br>Time Range error - images time range is larger than track time"; - echo "ABORT"; + /** + * Backup for later use + */ + if(isset($_POST['album_select']) && is_array($_POST['album_select'])) + { + $parent_id = $_POST['album_select']['0']; + } + + /** + * Get GPX filename from db + */ + $album_path = LinSql::getFullImagePath($parent_id); + + $gpx_filename = $GLOBALS['linpha']->db->GetOne("SELECT name " . + "FROM ".LIN_PREFIX."photos " . + "WHERE parent_id = '".$parent_id."' " . + "AND img_type = '9999999' " . + "AND name LIKE '%.gpx' " . + "OR name LIKE '%.GPX' "); + + if(isset($gpx_filename)) + { + if(isset($gpx_filename)) + { + $gpx_filename = LINPHA_DIR.TOP_DIR."".$album_path."/".$gpx_filename.""; + } + + $GeoWizzard = new LinXmlParser($gpx_filename); + $gpxDataFromFile = $GeoWizzard->readXmlFile(); + $track_times = $GeoWizzard->getGpxTimeRange($gpxDataFromFile); + $image_times = $GeoWizzard->getImageTimeRange($parent_id); //parent_id linpha_photos + + if($GeoWizzard->compareTimeRanges($track_times, $image_times)) + { + $trackTimeDelta = $track_times['endtime']-$track_times['starttime']; + $imageTimeDelta = $image_times['endtime']-$image_times['starttime']; + + $imagetdwidth = round((($imageTimeDelta*100)/$trackTimeDelta),0); + $offsetleft = round(((($image_times['starttime'] - $track_times['starttime'])*100))/$trackTimeDelta,0); + //echo "imagedelta".$imageTimeDelta."<br>"; + /* echo "imagwitdh".$tdwidth; + echo "leftwidth".$tdleft;*/ + + + echo i18n("Performing a couple of required tests...")."<br />"; + echo "<b>Timedelta comparison GPX Track <-> Images:</b><br>"; + echo "<table width ='99%'><tr> " . + "<td width='50%' style='border-left: 2px solid;'> " . + "<b><-GPX Track start</b><br /> ".date("Y:m:d H:i:s", $track_times['starttime'])."</td> ". + "<td align='right' style='border-right: 2px solid;'> " . + "<b>GPX Track end-></b><br /><nobr> ".date("Y:m:d H:i:s", $track_times['endtime'])."</nobr></td></tr> " . + "<tr bgcolor='green'><td colspan='2'><br /><b>GPX Time Delta: </b>" . + "".date("H:i:s", $trackTimeDelta)."h<br /> ". + "</td></tr> " . + "<tr> " . + // "<td width='$tdleft' style='border-left: 2px solid;'> " . + // "<b><-Offset</b><br /> ".date("H:i:s", $image_times['starttime'] - $track_times['starttime'])."</td> ". + "<td width='$imagetdwidth%' bgcolor='green'> " . + "<b><br/>Images Time Delta</b><nobr> ".date("H:i:s", $imageTimeDelta)."h</nobr></td><td width='*%'>".$imagetdwidth."%</td> </tr> " . + "<br /> ". + "</table><br />"; + + + $GeoWizzard->fixImagesOffset($track_times, $image_times); + } + else + { + echo "<br>Time Range error - images time range is larger than track time"; + echo "ABORT"; + } + } + else + { + echo i18n("No GPX file found, consider running album import first"); + } + } + + + //echo "<pre>", print_r($array_with_gpx), "</pre>"; ?> \ No newline at end of file Modified: trunk/linpha2/lib/plugins/maps/xml_parser.class.php =================================================================== --- trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-12 13:35:55 UTC (rev 4868) +++ trunk/linpha2/lib/plugins/maps/xml_parser.class.php 2008-02-12 17:59:58 UTC (rev 4869) @@ -101,6 +101,60 @@ return $this->xml_data; } + + + + + public function readFloXmlFile() + { + $handle = @fopen("/tmp/sample.gpx", "r"); + if($handle) + { + $part = 0; + $read = 4092; + while(!feof($handle)) { + $rbuf = fread($handle, $read); //2MB chunks + for($i=$read;$i > 0 || $n == chr(10);$i--) { + $n=substr($rbuf, $i, 1); + if($n == chr(10))break; + //If we are at the end of the file, just grab the rest and stop loop + elseif(feof($handle)) { + $i = $read; + $buf = substr($rbuf, 0, $i+1); + break; + } + + //This is the buffer we want to do stuff with, maybe thow to a function? + $buf = substr($rbuf, 0, $i+1); + + echo "buf".$buf."<br>"; + if(substr($buf, 0, 6) == '<trkpt') + { + //echo "TRACKHIT"; + } + //Point marker back to last \n point + $part = ftell($handle)-($read-($i+1)); + fseek($handle, $part); + } + } + + + /* while (!feof($handle)) + { + $buffer = ltrim(fgets($handle, 8192)); + error_log($buffer, 0); + if(substr($buffer, 0, 6) == '<trkpt') + { + echo "TRACKHIT"; + } + + //echo "LINE:".$buffer."<br>"; + }*/ + fclose($handle); + } + //return $this->xml_data;*/ + } + /** * This is just an helper/wrapper method for readXmlFile() and is called * for each trkpoint data entry from readXmlFile(). @@ -163,12 +217,12 @@ } } - echo "**TRACK INFO**<br>"; - echo "min ".$date_min." -- "; - echo "max ".$date_max; - echo " length ".($date_max - $date_min)."<br>"; - echo "track starts from: ".date("Y:m:d H:i:s", $date_min); - echo " track ends at: ".date("Y:m:d H:i:s", $date_max)."<br><br>"; + /* echo "**TRACK INFO**<br>"; + echo "min ".$date_min." -- "; + echo "max ".$date_max; + echo " length ".($date_max - $date_min)."<br>"; + echo "track starts from: ".date("Y:m:d H:i:s", $date_min); + echo " track ends at: ".date("Y:m:d H:i:s", $date_max)."<br><br>";*/ return array("starttime" => $date_min, "endtime" => $date_max); } @@ -217,13 +271,13 @@ } } } - echo "**IMAGE INFO**<br>"; - echo "min ".$date_min." -- "; - echo "max ".$date_max; - echo " length ".($date_max - $date_min)."<br>"; + /* echo "**IMAGE INFO**<br>"; + echo "min ".$date_min." -- "; + echo "max ".$date_max; + echo " length ".($date_max - $date_min)."<br>"; - echo "images start from: ".date("Y:m:d H:i:s", $date_min); - echo " images end at: ".date("Y:m:d H:i:s", $date_max)."<br>"; + echo "images start from: ".date("Y:m:d H:i:s", $date_min); + echo " images end at: ".date("Y:m:d H:i:s", $date_max)."<br>";*/ return array("starttime" => $date_min, "endtime" => $date_max, "geodata" => $geodata); } @@ -278,12 +332,12 @@ } /** - * All images must be taken within track time range delta t. If we found + * All images must be taken within track time range delta t. If we found * images taken earlier or later, fix it! * @param $array $track start/endtime track * @param $array start/endtime images * @author bzrudi - */ + */ public function fixImagesOffset($track, $images) //, $image_tmp { /** @@ -294,7 +348,7 @@ if($images['starttime'] < $track['starttime']) { echo "Offset detected, images start earlier...<br>"; - + $number = count($images['geodata']); while(list($image_time, $filename) = each($images['geodata'])) @@ -345,7 +399,7 @@ echo "Rerunning offset test...<br>"; $this->fixImagesOffset($track, $image_tmp); } - + } elseif($images['endtime'] > $track['endtime']) { @@ -419,7 +473,7 @@ private function triggerImage2trkpt($images) { /** - * @todo mv to __constructor + * @todo mv to __constructor */ $gpx = $this->readXmlFile($this->filename); @@ -427,8 +481,8 @@ ksort($gpx); /** - * Create new array with all needed information sorted - */ + * Create new array with all needed information sorted + */ foreach($gpx AS $index => $value) { @@ -438,9 +492,9 @@ "lon" => $value['trkpt']['lon'], "ele" => $value['ele']); } - + echo "<br>***CALLING TRACKPOINT RADAR***<br>"; - + foreach($images['geodata'] AS $image_time => $image_filename) { echo "Trying to find match for: ".$image_time." ".$image_filename."<br>"; @@ -458,9 +512,9 @@ /** * Trackpoint radar. Try to find nearest trkpt for image - * We do this by adding an offset (positiv and negativ) of one second to + * We do this by adding an offset (positiv and negativ) of one second to * the original image_time until we got key hit. - * + * * @param array $trkdata array with time and lat lon from gpx track * @param int $image_time current image timestamp * @param int $offset current offset in seconds @@ -475,12 +529,12 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time]['lat']."<br>and LON: " . "".$trkdata[$image_time]['lon']."<br><br>"; - - $this->writeGpsData2File($image_filename, - $trkdata[$image_time]['lat'], - $trkdata[$image_time]['lon'], - $trkdata[$image_time]['ele']); - + + $this->writeGpsData2File($image_filename, + $trkdata[$image_time]['lat'], + $trkdata[$image_time]['lon'], + $trkdata[$image_time]['ele']); + return false; } elseif(array_key_exists(($image_time + $offset), $trkdata)) @@ -489,12 +543,12 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time + $offset]['lat']."<br>and LON: " . "".$trkdata[$image_time + $offset]['lon']."<br><br>"; - - $this->writeGpsData2File($image_filename, - $trkdata[$image_time + $offset]['lat'], - $trkdata[$image_time + $offset]['lon'], - $trkdata[$image_time + $offset]['ele']); - + + $this->writeGpsData2File($image_filename, + $trkdata[$image_time + $offset]['lat'], + $trkdata[$image_time + $offset]['lon'], + $trkdata[$image_time + $offset]['ele']); + return false; } elseif(array_key_exists(($image_time - $offset), $trkdata)) @@ -503,11 +557,11 @@ echo "<br>Connecting image ".$image_time." " . "<br>to LAT: ".$trkdata[$image_time - $offset]['lat']."<br>and LON: " . "".$trkdata[$image_time - $offset]['lon']."<br><br>"; - $this->writeGpsData2File($image_filename, - $trkdata[$image_time - $offset]['lat'], - $trkdata[$image_time - $offset]['lon'], - $trkdata[$image_time - $offset]['ele']); - + $this->writeGpsData2File($image_filename, + $trkdata[$image_time - $offset]['lat'], + $trkdata[$image_time - $offset]['lon'], + $trkdata[$image_time - $offset]['ele']); + return false; } else @@ -517,7 +571,7 @@ } } - + /** * Write GPS data to file */ @@ -525,16 +579,16 @@ { echo "Trying to write GPS data to files - ***SIMULATION***<br>"; echo "Trying file: ".$filename."<br>"; - + ($lon > 0) ? $lonref = "E" : $latref = "W"; ($lat > 0) ? $latref = "N" : $latref = "S"; // 0 = Above Sea Level // 1 = Below Sea Level ($ele > 0) ? $eleref = "0" : $eleref = "1"; - + echo "Latref ".$latref." Longref ".$lonref."<br><br>"; - - + + $filename = substr($filename, 2); $filename = LINPHA_DIR."/$filename"; $return = ""; @@ -545,9 +599,9 @@ "-GPSLatitude='$lat' " . "-GPSAltitudeRef='$eleref' " . "-GPSAltitude='$ele' "; - + //exec(LINPHA_DIR.'/lib/exiftool/exiftool'." $parameters $filename"); - //LinFilesys::linExec($metaData->objMetaTool.' '.$parameters.' "'.$filename.'"', $meta, $return); + //LinFilesys::linExec($metaData->objMetaTool.' '.$parameters.' "'.$filename.'"', $meta, $return); } }// end class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-12 13:36:00
|
Revision: 4868 http://linpha.svn.sourceforge.net/linpha/?rev=4868&view=rev Author: bzrudi Date: 2008-02-12 05:35:55 -0800 (Tue, 12 Feb 2008) Log Message: ----------- and again fixed missing FETCH_NUM statement (hopefully I got them all nailed now) Modified Paths: -------------- trunk/linpha2/admin/maintenance_import.php Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-02-11 21:31:42 UTC (rev 4867) +++ trunk/linpha2/admin/maintenance_import.php 2008-02-12 13:35:55 UTC (rev 4868) @@ -407,14 +407,20 @@ * * nr images to index: (nr_total - nr_indexed) */ - $nr_total = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) FROM ".LIN_PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); + $nr_total = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) AS s " . + "FROM ".LIN_PREFIX."photos " . + "WHERE parent_id = '0' " . + "GROUP BY parent_id"); + foreach($array_meta AS $value) { if($GLOBALS['linpha']->sql->config->value['sys_image_'.$value]) { - $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) FROM ".LIN_PREFIX."meta_".$value); + $nr_indexed = $GLOBALS['linpha']->db->GetRow("SELECT count(md5sum) " . + "AS number_idx " . + "FROM ".LIN_PREFIX."meta_".$value); - echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total[0] - $nr_indexed[0]) .' <br />'; + echo strtoupper($value).': '.i18n("Nr Images Needs Indexing:").' ' . ($nr_total['s'] - $nr_indexed['number_idx']) .' <br />'; } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-11 21:31:43
|
Revision: 4867 http://linpha.svn.sourceforge.net/linpha/?rev=4867&view=rev Author: fangehrn Date: 2008-02-11 13:31:42 -0800 (Mon, 11 Feb 2008) Log Message: ----------- * fixed some E_STRICT error messages, there are a lot of them... Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/plugins/watermark/func.watermark.php trunk/linpha2/templates/default/themes/default/colorsettings.php trunk/linpha2/templates/misc/roundcorners.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/ChangeLog 2008-02-11 21:31:42 UTC (rev 4867) @@ -2,6 +2,7 @@ 2008-02-11 flo * deleted "debug" files and added them to the ignore list -> we will not forget them on releases and they will not be on any snapshot + * fixed some E_STRICT error messages, there are a lot of them... 2008-02-11 bzrudi * Removed all calls for ADODB_FETCH_NUM as they do no longer work. Modified: trunk/linpha2/lib/classes/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -86,4 +86,4 @@ echo $s.'<br />'; linLog(LOG_TYPE_DB, LOG_ERR, 'adodb', $s); } -?> +?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -57,8 +57,7 @@ } else { - //error_reporting('E_ALL'); - error_reporting(0); + error_reporting(E_ALL); // | E_STRICT error_reporting is turned off by make_release.sh include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); /** Modified: trunk/linpha2/lib/plugins/watermark/func.watermark.php =================================================================== --- trunk/linpha2/lib/plugins/watermark/func.watermark.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/lib/plugins/watermark/func.watermark.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -26,7 +26,7 @@ * @author flo * @todo adapt from linpha1 */ -function needWatermark($imgid) +static function needWatermark($imgid) { if( $GLOBALS['linpha']->sql->config->value['plugins_active_wm'] && $GLOBALS['linpha']->sql->config->value['plugins_wm_active'] @@ -41,7 +41,7 @@ /** * returns array with all the configs and the default values, they are only defined here */ -function getWatermarkArray() +static function getWatermarkArray() { return array ( 'wm_active' => "0", @@ -67,7 +67,7 @@ ); } -function readWatermark() +static function readWatermark() { $arr_config = LinWatermark::getWatermarkArray(); while(list($name,$value) = each($arr_config) ) @@ -77,7 +77,7 @@ return $arr_read; } -function updateWatermark() +static function updateWatermark() { $arr_config = LinWatermark::getWatermarkArray(); while(list($name,$value) = each($arr_config) ) @@ -89,7 +89,7 @@ /** * restore watermark settings to initial settings or to examples */ -function restoreWatermark() +static function restoreWatermark() { global $wm_restore_to; @@ -155,7 +155,7 @@ * $resize: resize factor in percent * */ -function wmArrResized($w,$h,$org_width,$org_height,$resize) +static function wmArrResized($w,$h,$org_width,$org_height,$resize) { $arr_resized['w'] = round($w * $resize/100); $arr_resized['h'] = round($h * $resize/100); @@ -321,7 +321,7 @@ /** * not used anymore */ -function getHtmlColorFromRgb($r,$g,$b) +static function getHtmlColorFromRgb($r,$g,$b) { if(strlen(dechex($r))==1) { $r = '0'.$r; @@ -346,7 +346,7 @@ * used to check if it is a valid html color * @uses isHtmlColor() */ -function everyCharIsHex($string) +static function everyCharIsHex($string) { for($i=0;$i<strlen($string);$i++) { @@ -387,7 +387,7 @@ * used to check if it is a valid html color * @uses getRgbFromAll() */ -function isHtmlColor($string) +static function isHtmlColor($string) { switch(strlen($string)) { @@ -412,7 +412,7 @@ * it doesn't matter if the html color is '#00FF00' or '00FF00' * @uses getRgbFromAll() */ -function getRgbFromHtml($string) +static function getRgbFromHtml($string) { switch(strlen($string)) { @@ -438,7 +438,7 @@ * * @uses watermark_gd() */ -function getRgbFromAll($string) +static function getRgbFromAll($string) { if( isset( LinWatermark::$Colors[$string]) ) { @@ -459,7 +459,7 @@ * * used in linpha2 - admin - settings_layout */ -function getHtmlFromAll($string) +static function getHtmlFromAll($string) { if(LinWatermark::isHtmlColor($string)) { @@ -493,7 +493,7 @@ * pos_x, pos_y: additional adjust for the image * */ -function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) +static function calcAlign($align, $src_w, $src_h, $dst_w, $dst_h, $pos_x, $pos_y) { switch($align) Modified: trunk/linpha2/templates/default/themes/default/colorsettings.php =================================================================== --- trunk/linpha2/templates/default/themes/default/colorsettings.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/templates/default/themes/default/colorsettings.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -5,7 +5,7 @@ * force caching in browser * works in firefox and internet explorer */ -Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past +Header("Last-Modified: " . gmdate("D, d M Y H:i:s",gmmktime (0,0,0,1,1,2000))); // Date in the past Header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image Header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); Modified: trunk/linpha2/templates/misc/roundcorners.php =================================================================== --- trunk/linpha2/templates/misc/roundcorners.php 2008-02-11 19:21:34 UTC (rev 4866) +++ trunk/linpha2/templates/misc/roundcorners.php 2008-02-11 21:31:42 UTC (rev 4867) @@ -74,7 +74,7 @@ * force caching in browser * works in firefox and internet explorer */ -Header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT"); // Date in the past +Header("Last-Modified: " . gmdate("D, d M Y H:i:s",gmmktime (0,0,0,1,1,2000))); // Date in the past Header("Expires: Mon, 26 Jul 2100 05:00:00 GMT"); // In other words... never expire the image Header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-11 19:21:36
|
Revision: 4866 http://linpha.svn.sourceforge.net/linpha/?rev=4866&view=rev Author: fangehrn Date: 2008-02-11 11:21:34 -0800 (Mon, 11 Feb 2008) Log Message: ----------- 2008-02-11 flo * deleted "debug" files and added them to the ignore list -> we will not forget them on releases and they will not be on any snapshot Modified Paths: -------------- trunk/linpha2/lib/classes/linpha.sql.class.php Property Changed: ---------------- trunk/linpha2/ trunk/linpha2/install/ Property changes on: trunk/linpha2 ___________________________________________________________________ Name: svn:ignore - .project project.index .cache .settings + .project project.index .cache .settings logsql.txt Property changes on: trunk/linpha2/install ___________________________________________________________________ Name: svn:ignore + ignore_delete_install_msg.txt Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 18:59:15 UTC (rev 4865) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 19:21:34 UTC (rev 4866) @@ -27,7 +27,7 @@ class LinSql { - private $isLoggedIn, $isAdmin; + private $isLoggedIn = false, $isAdmin; public $config; // sub class $linpha->sql->config /** @@ -57,14 +57,19 @@ } else { - error_reporting('E_ALL'); + //error_reporting('E_ALL'); + error_reporting(0); include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); /** - * if this file does not exists we already switch to installer + * if we can keep the "_once" at those include files it would be + * a good security improvement! + * + * if this file does not exists we already switched to installer + * -> there's no need for file_exists() */ $sql_dir = ''; - require_once(LINPHA_DIR.'/var/config.dir.php'); // no include_once if we reconnect from another directory... + require_once(LINPHA_DIR.'/var/config.dir.php'); $include_file = LinFilesys::getFullPath( $sql_dir ) . '/config.sql.php'; if( file_exists($include_file) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-11 18:59:22
|
Revision: 4865 http://linpha.svn.sourceforge.net/linpha/?rev=4865&view=rev Author: fangehrn Date: 2008-02-11 10:59:15 -0800 (Mon, 11 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/misc/benchmark/perf.php Removed Paths: ------------- trunk/linpha2/perf.php Deleted: trunk/linpha2/perf.php =================================================================== --- trunk/linpha2/perf.php 2008-02-11 18:55:38 UTC (rev 4864) +++ trunk/linpha2/perf.php 2008-02-11 18:59:15 UTC (rev 4865) @@ -1,25 +0,0 @@ -<?php -define('LINPHA_DIR','.'); - -if (!file_exists(LINPHA_DIR.'/logsql.txt')) -{ - exit(1); -} - -include_once(LINPHA_DIR.'/lib/include/common.php'); - -/** - * some init stuff - */ - require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); - global $linpha; - $linpha = new Linpha(); - $linpha->sql->startSession(); - -/** - * do perf - */ - $perf = &NewPerfMonitor($GLOBALS['linpha']->db); - define('ADODB_PERF_NO_RUN_SQL',1); - $perf->UI($pollsecs=5); -?> \ No newline at end of file Copied: trunk/misc/benchmark/perf.php (from rev 4864, trunk/linpha2/perf.php) =================================================================== --- trunk/misc/benchmark/perf.php (rev 0) +++ trunk/misc/benchmark/perf.php 2008-02-11 18:59:15 UTC (rev 4865) @@ -0,0 +1,25 @@ +<?php +define('LINPHA_DIR','.'); + +if (!file_exists(LINPHA_DIR.'/logsql.txt')) +{ + exit(1); +} + +include_once(LINPHA_DIR.'/lib/include/common.php'); + +/** + * some init stuff + */ + require_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); + global $linpha; + $linpha = new Linpha(); + $linpha->sql->startSession(); + +/** + * do perf + */ + $perf = &NewPerfMonitor($GLOBALS['linpha']->db); + define('ADODB_PERF_NO_RUN_SQL',1); + $perf->UI($pollsecs=5); +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-11 18:55:52
|
Revision: 4864 http://linpha.svn.sourceforge.net/linpha/?rev=4864&view=rev Author: fangehrn Date: 2008-02-11 10:55:38 -0800 (Mon, 11 Feb 2008) Log Message: ----------- Added Paths: ----------- trunk/misc/benchmark/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-11 18:48:31
|
Revision: 4863 http://linpha.svn.sourceforge.net/linpha/?rev=4863&view=rev Author: fangehrn Date: 2008-02-11 10:48:26 -0800 (Mon, 11 Feb 2008) Log Message: ----------- 2008-02-11 flo * deleted "debug" files and added them to the ignore list -> we will not forget them on releases and they will not be on any snapshot Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/lib/classes/linpha.sql.class.php Removed Paths: ------------- trunk/linpha2/install/ignore_delete_install_msg.txt trunk/linpha2/logsql.txt Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-11 18:05:17 UTC (rev 4862) +++ trunk/linpha2/ChangeLog 2008-02-11 18:48:26 UTC (rev 4863) @@ -1,3 +1,8 @@ + +2008-02-11 flo + * deleted "debug" files and added them to the ignore list + -> we will not forget them on releases and they will not be on any snapshot + 2008-02-11 bzrudi * Removed all calls for ADODB_FETCH_NUM as they do no longer work. AdoDB documentation says FTECH_ASSOC is nearly as fast as FETCH_NUM. Deleted: trunk/linpha2/install/ignore_delete_install_msg.txt =================================================================== --- trunk/linpha2/install/ignore_delete_install_msg.txt 2008-02-11 18:05:17 UTC (rev 4862) +++ trunk/linpha2/install/ignore_delete_install_msg.txt 2008-02-11 18:48:26 UTC (rev 4863) @@ -1,2 +0,0 @@ -If this file exists, the check for existing ./install directory is ignored. -This file must be remove in official releases. \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 18:05:17 UTC (rev 4862) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 18:48:26 UTC (rev 4863) @@ -177,7 +177,6 @@ /** * enable sql logging - * @TODO disable on public release */ if (file_exists(LINPHA_DIR.'/logsql.txt')) { $GLOBALS['linpha']->db->LogSQL(); Deleted: trunk/linpha2/logsql.txt =================================================================== --- trunk/linpha2/logsql.txt 2008-02-11 18:05:17 UTC (rev 4862) +++ trunk/linpha2/logsql.txt 2008-02-11 18:48:26 UTC (rev 4863) @@ -1,2 +0,0 @@ -if this file exists linpha logs all sql queries -by appending the GET variable "perf" you will get some nice stats \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-11 18:05:21
|
Revision: 4862 http://linpha.svn.sourceforge.net/linpha/?rev=4862&view=rev Author: bzrudi Date: 2008-02-11 10:05:17 -0800 (Mon, 11 Feb 2008) Log Message: ----------- and again fixed missing FETCH_NUM statement (hopefully I got them all nailed now) Modified Paths: -------------- trunk/linpha2/admin/maintenance_import.php Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-02-11 17:56:23 UTC (rev 4861) +++ trunk/linpha2/admin/maintenance_import.php 2008-02-11 18:05:17 UTC (rev 4862) @@ -178,13 +178,13 @@ echo i18n("Create Thumbnail"); while($data = $createthumbquery->FetchRow()) { - if( ! $thumbnail->createThumbnail($data['0']) ) + if( ! $thumbnail->createThumbnail($data['id']) ) { echo i18n("Error While Creating Thumbnail!")."<br />Error: ".$thumbnail->error_msg."<br />"; } if( ! $thumbnail->isCached ) // thumbnail wasn't cached -> now created! { - echo " ".$data['0'].","; + echo " ".$data['id'].","; } flush(); } @@ -391,7 +391,7 @@ { $thumbnail->mode = 'thumb'; - $thumbnail->photo_id = $data['0']; + $thumbnail->photo_id = $data['id']; $thumbnail->setFileInformation(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-11 17:56:26
|
Revision: 4861 http://linpha.svn.sourceforge.net/linpha/?rev=4861&view=rev Author: bzrudi Date: 2008-02-11 09:56:23 -0800 (Mon, 11 Feb 2008) Log Message: ----------- fixed missing FETCH_NUM statement (hopefully I got them all nailed now) Modified Paths: -------------- trunk/linpha2/lib/classes/linpha.metadata.class.php Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-11 17:51:58 UTC (rev 4860) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-11 17:56:23 UTC (rev 4861) @@ -944,7 +944,7 @@ //echo '<pre>', print_r($dataArray), '</pre>'; $str_columns = "md5sum, "; - $str_values = "'".$data['1']."', "; + $str_values = "'".$data['id']."', "; if(is_array($dataArray)) { @@ -974,7 +974,7 @@ "(" . $str_columns . ") VALUES (" . $str_values . ")"); $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET geodata='1' WHERE md5sum='".$data['1']."' "); + "SET geodata='1' WHERE md5sum='".$data['md5sum']."' "); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-11 17:52:04
|
Revision: 4860 http://linpha.svn.sourceforge.net/linpha/?rev=4860&view=rev Author: bzrudi Date: 2008-02-11 09:51:58 -0800 (Mon, 11 Feb 2008) Log Message: ----------- Removed all calls for ADODB_FETCH_NUM as they do no longer work. Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/maintenance_import.php trunk/linpha2/admin/permissions_readwrite.php trunk/linpha2/install/step10_postsettings.php trunk/linpha2/lib/classes/linpha.image.class.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.import.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/modules/module.basket.php trunk/linpha2/lib/modules/module.benchmark.php trunk/linpha2/lib/modules/module.browse.php trunk/linpha2/lib/modules/module.search.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/ChangeLog 2008-02-11 17:51:58 UTC (rev 4860) @@ -1,4 +1,12 @@ - +2008-02-11 bzrudi + * Removed all calls for ADODB_FETCH_NUM as they do no longer work. + AdoDB documentation says FTECH_ASSOC is nearly as fast as FETCH_NUM. + As we used FETCH_NUM just in a small number of cases, I guess it's save to + convert to default (FETCH_ASSOC). + To be true I wonder if it ever worked as expected as we sometimes asked for + FETCH_NUM but return was used as ASSOC !?!?. However let's use ASSOC to + be save. + 2008-02-07 flo * AdoDB updated to version 503 * fixed adodb error handler Modified: trunk/linpha2/admin/maintenance_import.php =================================================================== --- trunk/linpha2/admin/maintenance_import.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/admin/maintenance_import.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -150,11 +150,11 @@ { echo i18n("Delete Thumbnails"); $query = $GLOBALS['linpha']->db->Execute($sql); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { - if( LinImage::deleteCachedThumbnail($data[0], $data[1])) + if( LinImage::deleteCachedThumbnail($data['id'], $data['img_type'])) { - echo " ".$data[0].","; + echo " ".$data['id'].","; } } echo '<br />'; @@ -176,15 +176,15 @@ if($_REQUEST['index_thumbnails']!='no') { echo i18n("Create Thumbnail"); - while($data = $createthumbquery->FetchRow(ADODB_FETCH_NUM)) + while($data = $createthumbquery->FetchRow()) { - if( ! $thumbnail->createThumbnail($data[0]) ) + if( ! $thumbnail->createThumbnail($data['0']) ) { echo i18n("Error While Creating Thumbnail!")."<br />Error: ".$thumbnail->error_msg."<br />"; } if( ! $thumbnail->isCached ) // thumbnail wasn't cached -> now created! { - echo " ".$data[0].","; + echo " ".$data['0'].","; } flush(); } @@ -233,7 +233,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE " . "parent_id = '".LinSql::linAddslashes($value)."' AND " . "img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $array_meta_ids[$data['id']] = $data['md5sum']; } @@ -387,11 +387,11 @@ $num = 0; $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $thumbnail->mode = 'thumb'; - $thumbnail->photo_id = $data[0]; + $thumbnail->photo_id = $data['0']; $thumbnail->setFileInformation(); Modified: trunk/linpha2/admin/permissions_readwrite.php =================================================================== --- trunk/linpha2/admin/permissions_readwrite.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/admin/permissions_readwrite.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -122,9 +122,9 @@ */ $array_groups = Array(); $query = $GLOBALS['linpha']->db->Execute("SELECT id, group_name FROM ".LIN_PREFIX."groups WHERE group_name <> 'admin'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { - $array_groups[$data[0]] = $data[1]; + $array_groups[$data['id']] = $data['group_name']; } /** @@ -154,10 +154,10 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($linpha->template->idCurrent)."'"); - $data = $query->FetchRow(ADODB_FETCH_NUM); + $data = $query->FetchRow(); ?> <form name="permission" method="POST" action="<?php echo LINPHA_DIR.'/admin/?cat=permissions_'.$cat2.'&parent_id='.$parent_id; ?>"> - <h3><?php echo i18n("Change/Add permissions of folder/file"); ?> "<?php echo $data[0]; ?>"</h3> + <h3><?php echo i18n("Change/Add permissions of folder/file"); ?> "<?php echo $data['name']; ?>"</h3> <?php /** Modified: trunk/linpha2/install/step10_postsettings.php =================================================================== --- trunk/linpha2/install/step10_postsettings.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/install/step10_postsettings.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -98,9 +98,9 @@ <?php $query = $linpha->db->Execute("SELECT option_value FROM ".LIN_PREFIX."config " . "WHERE option_name='sys_im_use_imagemagick'"); -$data = $query->FetchRow(ADODB_FETCH_NUM); +$data = $query->FetchRow(); -if(false === $data[0]) +if(false === $data['option_value']) { echo "<h2>".i18n_install("Please Choose Thumbnail Quality")."</h2><hr>"; ?> Modified: trunk/linpha2/lib/classes/linpha.image.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.image.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.image.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -797,9 +797,9 @@ function deleteCachedImage($id,$img_type) { $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."photos_cache WHERE photo_id = '".$id."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { - $output = LinImage::getCachePath('img',$data[0],$img_type); + $output = LinImage::getCachePath('img',$data['id'],$img_type); if(file_exists($output)) { Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -26,7 +26,7 @@ if(!defined('LINPHA_DIR')) { exit(1); } define('LIN_SELECT_FIELDS', - "".LIN_PREFIX."photos.id AS 'id2', " . + "".LIN_PREFIX."photos.id AS id2, " . "".LIN_PREFIX."photos.id AS id, ".LIN_PREFIX."photos.name AS name, " . "".LIN_PREFIX."photos.img_type AS img_type, ".LIN_PREFIX."photos.md5sum AS md5sum, " . "".LIN_PREFIX."photos.width AS width, ".LIN_PREFIX."photos.height AS height, " . @@ -260,7 +260,7 @@ $value['name'] = htmlspecialchars($value['name'],ENT_QUOTES); $this->photos_filtered[] = $value; - print_r($value); + //print_r($value); } } } @@ -973,15 +973,15 @@ { $GLOBALS['linpha']->template->output['browse_by_date'] = ''; - $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . + $data = $GLOBALS['linpha']->db->GetRow("SELECT min(datetimeoriginal) AS min , max(datetimeoriginal) AS max " . "FROM ".LIN_PREFIX."meta_exif"); - if(isset($data[0]) && isset($data[1]) && !empty($data[0]) && !empty($data[1]) ) + if(isset($data['min']) && isset($data['max']) && !empty($data['min']) && !empty($data['max']) ) { /** * get min and max year */ - $min_year = substr($data[0],0,4); - $max_year = substr($data[1],0,4); + $min_year = substr($data['min'],0,4); + $max_year = substr($data['max'],0,4); /** * get years between */ @@ -992,10 +992,10 @@ */ if($i > 1900) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data[0]>0) + $data = $GLOBALS['linpha']->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data['datetime']>0) { - $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $GLOBALS['linpha']->template->output['browse_by_date'] .= '<a href="'.LINPHA_LINK.'&linCat=browse&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; } } } @@ -1033,14 +1033,14 @@ for($i = 1; $i <= $nr_images ; ) { - $data = $query->FetchRow(ADODB_FETCH_NUM); - if(isset($data['0'])) + $data = $query->FetchRow(); + if(isset($data['id'])) { - $path = LinSql::getFullImagePath( $data[0] ); + $path = LinSql::getFullImagePath( $data['id'] ); - if(file_exists($path) && LinSql::photoIsAllowed($data['0'])) + if(file_exists($path) && LinSql::photoIsAllowed($data['id'])) { - $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['0'],'path'=>$path); + $GLOBALS['linpha']->template->output[$key][] = array('id'=>$data['id'],'path'=>$path); $i++; } } Modified: trunk/linpha2/lib/classes/linpha.import.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.import.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.import.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -142,15 +142,15 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT id " . "FROM ".LIN_PREFIX."photos WHERE img_type = '0' " . "AND parent_id = '".$parent_id."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { /** * on dryrun, the delete process isn't done completley * so it would appear here again, prevent this! */ - if( !isset($deleted_keys) OR !in_array($data['0'],$deleted_keys) ) + if( !isset($deleted_keys) OR !in_array($data['id'],$deleted_keys) ) { - LinImport::updateDir($data['0'], $recursive, $dryrun); + LinImport::updateDir($data['id'], $recursive, $dryrun); } } } @@ -187,7 +187,7 @@ /** * delete thumbnail if one exists with the same id */ - $inserted_id = $GLOBALS['linpha']->db->GetOne("SELECT MAX(id) FROM ".LIN_PREFIX."photos "); + $inserted_id = $GLOBALS['linpha']->db->GetOne("SELECT max(id) FROM ".LIN_PREFIX."photos "); LinImage::deleteCachedThumbnail($inserted_id,$file_type); @@ -381,10 +381,10 @@ { if( $id != 0 ) { - $data = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) " . + $data = $GLOBALS['linpha']->db->GetRow("SELECT sum(stats_numbers) AS s " . "FROM ".LIN_PREFIX."photos WHERE parent_id = '".$id."'"); $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " . - "SET stats_numbers = '".$data[0]."' WHERE id = '".$id."'"); + "SET stats_numbers = '".$data['s']."' WHERE id = '".$id."'"); $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id " . "FROM ".LIN_PREFIX."photos WHERE id = '".$id."'"); Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -73,9 +73,9 @@ "WHERE flags = '" . $flag_nr . "' " . "ORDER by id"); - while ($fields_data = $query->FetchRow(ADODB_FETCH_NUM)) + while ($fields_data = $query->FetchRow()) { - $this->cachedSelectedFieldNames[] = $fields_data['0']; + $this->cachedSelectedFieldNames[] = $fields_data['name']; } } @@ -938,7 +938,7 @@ while($data = $query->FetchRow()) { - $filename = LinSql::getFullImagePath($data['0']); + $filename = LinSql::getFullImagePath($data['id']); $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); //echo '<pre>', print_r($dataArray), '</pre>'; Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -57,7 +57,7 @@ } else { - error_reporting(0); + error_reporting('E_ALL'); include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); /** @@ -171,7 +171,7 @@ } - exit(1); + //exit(1); } @@ -477,7 +477,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . "FROM ".LIN_PREFIX."config WHERE user_id = '".LinSql::linAddslashes($_SESSION['user_id'])."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $GLOBALS['linpha']->sql->config->value[$data['option_name']] = $data['option_value']; } @@ -545,18 +545,18 @@ "WHERE perm_type = '".LinSql::linAddslashes($perm_type)."' " . "AND photos_id = '".LinSql::linAddslashes($photos_id)."'"); - if( isset( $data[0] ) && !empty( $data[0] ) ) + if( isset( $data['permission'] ) && !empty( $data['permission'] ) ) { - return array($i, $data[0]); + return array($i, $data['permission']); } else { $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".LIN_PREFIX."photos " . "WHERE id = '".LinSql::linAddslashes($photos_id)."'"); - if( isset( $data[0] ) ) + if( isset( $data['parent_id'] ) ) { - $photos_id = $data[0]; + $photos_id = $data['parent_id']; } else { @@ -968,7 +968,7 @@ */ $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . "FROM ".LIN_PREFIX."config WHERE user_id = '0'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $this->value[$data['option_name']] = $data['option_value']; } @@ -983,7 +983,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . "FROM ".LIN_PREFIX."config WHERE user_id = '".$_SESSION['user_id']."'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $GLOBALS['linpha']->sql->config->value[$data['option_name']] = $data['option_value']; } Modified: trunk/linpha2/lib/modules/module.basket.php =================================================================== --- trunk/linpha2/lib/modules/module.basket.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/modules/module.basket.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -166,12 +166,12 @@ foreach($_SESSION['basket_ids'] AS $value) { $data = $GLOBALS['linpha']->db->GetRow("SELECT parent_id FROM ".LIN_PREFIX."photos WHERE id = '". LinSql::linAddslashes($value)."'" ); - $array_folders[] = $data[0]; + $array_folders[] = $data['parent_id']; /** * store all imgids in an array with parent_id as the key for easy access */ - $GLOBALS['linpha']->template->output['basket_folder_contents'][$data[0]][] = $value; + $GLOBALS['linpha']->template->output['basket_folder_contents'][$data['parent_id']][] = $value; } $GLOBALS['linpha']->template->output['basket_folders'] = array_unique($array_folders); Modified: trunk/linpha2/lib/modules/module.benchmark.php =================================================================== --- trunk/linpha2/lib/modules/module.benchmark.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/modules/module.benchmark.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -17,7 +17,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT option_name, option_value " . "FROM ".LIN_PREFIX."config WHERE user_id = '0'"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { $config[$data['option_name']] = $data['option_value']; } Modified: trunk/linpha2/lib/modules/module.browse.php =================================================================== --- trunk/linpha2/lib/modules/module.browse.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/modules/module.browse.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -69,11 +69,11 @@ /** * year */ - $data = $linpha->db->GetRow("SELECT min(datetimeoriginal), max(datetimeoriginal) " . + $data = $linpha->db->GetRow("SELECT min(datetimeoriginal) AS min, max(datetimeoriginal) AS max " . "FROM ".LIN_PREFIX."meta_exif"); - $min_year = substr($data[0],0,4); - $max_year = substr($data[1],0,4); + $min_year = substr($data['min'],0,4); + $max_year = substr($data['max'],0,4); $sum = 0; @@ -87,19 +87,19 @@ */ if($i > 1900) { - $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); - if($data[0]>0) + $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) AS datetime FROM ".LIN_PREFIX."meta_exif WHERE datetimeoriginal LIKE '".$i."%'"); + if($data['datetime']>0) { if(isset($_GET['year']) && $i == $_GET['year']) { - $str_datelinks .= $i.' ('.$data[0].'), '; + $str_datelinks .= $i.' ('.$data['datetime'].'), '; } else { - $str_datelinks .= '<a href="'.$url_base.'&year='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $str_datelinks .= '<a href="'.$url_base.'&year='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; } - $sum += $data[0]; + $sum += $data['datetime']; } } } @@ -107,8 +107,11 @@ /** * calc not indexed images */ - $data = $linpha->db->GetRow("SELECT sum( stats_numbers ) FROM ".LIN_PREFIX."photos WHERE parent_id = '0' GROUP BY parent_id"); - $str_datelinks .= '<a href="'.$url_base.'&year=0">'.i18n("not indexed").'</a> ('.($data[0]-$sum).')'; + $data = $linpha->db->GetRow("SELECT sum( stats_numbers ) AS sum " . + "FROM ".LIN_PREFIX."photos " . + "WHERE parent_id = '0' " . + "GROUP BY parent_id"); + $str_datelinks .= '<a href="'.$url_base.'&year=0">'.i18n("not indexed").'</a> ('.($data['sum']-$sum).')'; if(isset($_GET['year']) && $_GET['year'] != 0) @@ -127,17 +130,19 @@ $i = "0".$i; } - $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif " . - "WHERE datetimeoriginal LIKE '".LinSql::linAddslashes($search_string).":".$i."%'"); - if($data[0]>0) + $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) AS datetime " . + "FROM ".LIN_PREFIX."meta_exif " . + "WHERE datetimeoriginal " . + "LIKE '".LinSql::linAddslashes($search_string).":".$i."%'"); + if($data['datetime']>0) { if(isset($_GET['month']) && $i == $_GET['month']) { - $str_datelinks .= $i.' ('.$data[0].'), '; + $str_datelinks .= $i.' ('.$data['datetime'].'), '; } else { - $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; } } } @@ -162,17 +167,19 @@ $i = "0".$i; } - $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) FROM ".LIN_PREFIX."meta_exif " . - "WHERE datetimeoriginal LIKE '".LinSql::linAddslashes($search_string).":".$i."%'"); - if($data[0]>0) + $data = $linpha->db->GetRow("SELECT count(datetimeoriginal) AS datetime " . + "FROM ".LIN_PREFIX."meta_exif " . + "WHERE datetimeoriginal " . + "LIKE '".LinSql::linAddslashes($search_string).":".$i."%'"); + if($data['datetime']>0) { if(isset($_GET['day']) && $i == $_GET['day']) { - $str_datelinks .= $i.' ('.$data[0].'), '; + $str_datelinks .= $i.' ('.$data['datetime'].'), '; } else { - $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'&day='.$i.'">'.$i.'</a> ('.$data[0].'), '; + $str_datelinks .= '<a href="'.$url_base.'&year='.$_GET['year'].'&month='.$_GET['month'].'&day='.$i.'">'.$i.'</a> ('.$data['datetime'].'), '; } } } Modified: trunk/linpha2/lib/modules/module.search.php =================================================================== --- trunk/linpha2/lib/modules/module.search.php 2008-02-11 16:30:34 UTC (rev 4859) +++ trunk/linpha2/lib/modules/module.search.php 2008-02-11 17:51:58 UTC (rev 4860) @@ -198,9 +198,9 @@ } $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM ".LIN_PREFIX."meta_fields WHERE field_type = '1' AND (flags = '5' OR flags = '7')"); - while($data = $query->FetchRow(ADODB_FETCH_NUM)) + while($data = $query->FetchRow()) { - if(isset($_REQUEST['button']['meta'][$data[0]]) OR isset($_REQUEST['button']['meta']['all'])) + if(isset($_REQUEST['button']['meta'][$data['id']]) OR isset($_REQUEST['button']['meta']['all'])) { $sql_buttons .= " OR ("; @@ -208,7 +208,7 @@ reset($array_strings); for($i = 1; list($key,$value) = each($array_strings); $i++) { - $sql_buttons .= " (".LIN_PREFIX."meta_data.field_id = '".$data[0]."' AND ".LIN_PREFIX."meta_data.meta_data LIKE '%".$value."%') "; + $sql_buttons .= " (".LIN_PREFIX."meta_data.field_id = '".$data['id']."' AND ".LIN_PREFIX."meta_data.meta_data LIKE '%".$value."%') "; /** * append AND/OR, but not on last item This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bz...@us...> - 2008-02-11 16:30:40
|
Revision: 4859 http://linpha.svn.sourceforge.net/linpha/?rev=4859&view=rev Author: bzrudi Date: 2008-02-11 08:30:34 -0800 (Mon, 11 Feb 2008) Log Message: ----------- fix for broken "select" testing Modified Paths: -------------- trunk/linpha2/install/step8_testing.php Modified: trunk/linpha2/install/step8_testing.php =================================================================== --- trunk/linpha2/install/step8_testing.php 2008-02-07 23:24:36 UTC (rev 4858) +++ trunk/linpha2/install/step8_testing.php 2008-02-11 16:30:34 UTC (rev 4859) @@ -244,8 +244,8 @@ $error = false; if($key == "SELECT") { - $data = $result->FetchRow(ADODB_FETCH_NUM); - if( !$data OR @$data[1] != md5('the life ist beautiful')) + $data = $result->FetchRow(); + if( !$data OR @$data['md5sum'] != md5('the life ist beautiful')) { $error = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-07 23:24:41
|
Revision: 4858 http://linpha.svn.sourceforge.net/linpha/?rev=4858&view=rev Author: fangehrn Date: 2008-02-07 15:24:36 -0800 (Thu, 07 Feb 2008) Log Message: ----------- changed line ending to LF Modified Paths: -------------- trunk/linpha2/templates/default/maps.html.php trunk/linpha2/templates/default/view_img.head.php trunk/linpha2/templates/default/view_img.html.php trunk/linpha2/templates/default/view_thumb_static.html.php Modified: trunk/linpha2/templates/default/maps.html.php =================================================================== --- trunk/linpha2/templates/default/maps.html.php 2008-02-07 23:22:46 UTC (rev 4857) +++ trunk/linpha2/templates/default/maps.html.php 2008-02-07 23:24:36 UTC (rev 4858) @@ -1,166 +1,166 @@ - -<div id="linDivMainOuter"> - <?php echo $linTpl->divRoundCorners('top'); ?> - <div id="linDivMain"> - - -<div id="linDivMapTop"></div> - -<div id="linDivMapMain"> - <div id="linDivMapNav"></div> - <div id="linDivMapResizeBorder" ondblClick="myLinMaps.toggleNav();"></div> - <div id="linDivMapObject"></div> -</div> - -<div id="linDivMapBottom"> - <form action="" style="margin: 0;"> - <input type="text" id="linInputAddress" size="30"> - <input type="button" onclick="myLinMapObject.geocodeAddress( $('linInputAddress').value )" value="<?php - echo i18n("Geocode"); ?>"> - <a href="javascript:myLinGlobal.createPopup('linDivPopupHelp');"><img style="border: 0;" src="<?php - echo LINPHA_CLIENT; ?>/lib/graphics/ss_random.gif" /></a> - <a href="javascript:myLinMaps.loadAlbums();"><?php echo i18n("Albums"); ?></a> - - </form> -</div> - - </div> - <?php echo $linTpl->divRoundCorners('bottom'); ?> -</div> - -<div id="linDivPopupHelp" style="display: none"> - <div> - <b><?php echo i18n("Legend:"); ?></b><br /><br /> - <img src="http://maps.google.com/mapfiles/ms/micons/red-dot.png" style="vertical-align:middle" alt="red" /> - <?php echo i18n("Current Marker"); ?><br /><br /> - <img src="http://maps.google.com/mapfiles/ms/micons/purple-dot.png" style="vertical-align:middle" alt="blue" /> - <?php echo i18n("Location Marker"); ?><br /><br /> - <img src="http://maps.google.com/mapfiles/ms/micons/blue-dot.png" style="vertical-align:middle" alt="purple" /> - <?php echo i18n("Location Marker With Assigned Albums"); ?><br /><br /> - <img src="http://maps.google.com/mapfiles/ms/micons/green-dot.png" style="vertical-align:middle" alt="green" /> - <?php echo i18n("Location Marker With Assigned Images (GPS)"); ?><br /><br /> - <img src="http://maps.google.com/mapfiles/ms/micons/yellow-dot.png" style="vertical-align:middle" alt="yellow" /> - <?php echo i18n("Images"); ?><br /><br /> - </div> - - <?php - if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) - { - ?> - <br /> - <div> - <b>Create marker:</b><br /> - 1. Enter address or just press "Geocode"<br /> - 2. Drag the marker to fine adjust<br /> - 3. Check marker name<br /> - 4. Press "Save"<br /> - <br /> - <b>Assign albums:</b><br /> - 1. Click on a marker<br /> - 2. Press "Assign album"<br /> - 3. Choose album and press "Save"<br /> - 4. Repeat for multiple albums<br /> - <br /> - <b>Assign images to an album marker:</b><br /> - This is done automatically. But it's required that your images have the - GPS information stored inside. You will need a GPS Data Logger to do this - automatically. It is also possible do it manually. Robogeo is a tool, but - it is not free.<br /> - </div> - - <div> - <b>Not assigned images:</b><br /> - albums/album1 (22 images)<br /> - </div> - <?php - } - ?> -</div> - -<div id="linDivPopupAlbums" style="display: none;"> - <br /> - <?php echo i18n("Please select the album to show in Google Maps:"); ?> - <div id="linDivMapAlbums"></div> -</div> - -<div id="linDivEditMarker" style="display: none;"> - <fieldset style="width: 350px;"><legend><?php echo i18n("Create New Marker"); ?></legend> - <label for="linInputMarkerName" class="linInputEditMarker"><?php echo i18n("Marker Name"); ?>: - </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="31" /><br /> - <label for="linInputLat" class="linInputEditMarker"><?php echo i18n("Lat/Lon/Zoom"); ?>: - </label><input type="text" id="linInputLat" name="linInputLat" size="10" /> - <input type="text" id="linInputLon" name="linInputLon" size="10" /> - <input type="text" id="linInputZoom" name="linInputZoom" size="1" /> - - <br /><br /> - <input type="submit" value="<?php echo i18n("Save"); ?>" /> - <input type="button" value="<?php echo i18n("Cancel"); ?>" onclick="myLinMaps.removeEditMarker()"/> - <input type="hidden" name="cmd" value="saveMarker" /> - - </fieldset> -</div> - -<div id="linDivLoadingOuter" style="display: none;" class="linBackground"> - <?php echo $linTpl->divRoundCorners('top'); ?> - <div id="linDivLoading"> - <img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/loading.gif" /> - </div> - <?php echo $linTpl->divRoundCorners('bottom'); ?> -</div> - + +<div id="linDivMainOuter"> + <?php echo $linTpl->divRoundCorners('top'); ?> + <div id="linDivMain"> + + +<div id="linDivMapTop"></div> + +<div id="linDivMapMain"> + <div id="linDivMapNav"></div> + <div id="linDivMapResizeBorder" ondblClick="myLinMaps.toggleNav();"></div> + <div id="linDivMapObject"></div> +</div> + +<div id="linDivMapBottom"> + <form action="" style="margin: 0;"> + <input type="text" id="linInputAddress" size="30"> + <input type="button" onclick="myLinMapObject.geocodeAddress( $('linInputAddress').value )" value="<?php + echo i18n("Geocode"); ?>"> + <a href="javascript:myLinGlobal.createPopup('linDivPopupHelp');"><img style="border: 0;" src="<?php + echo LINPHA_CLIENT; ?>/lib/graphics/ss_random.gif" /></a> + <a href="javascript:myLinMaps.loadAlbums();"><?php echo i18n("Albums"); ?></a> + + </form> +</div> + + </div> + <?php echo $linTpl->divRoundCorners('bottom'); ?> +</div> + +<div id="linDivPopupHelp" style="display: none"> + <div> + <b><?php echo i18n("Legend:"); ?></b><br /><br /> + <img src="http://maps.google.com/mapfiles/ms/micons/red-dot.png" style="vertical-align:middle" alt="red" /> + <?php echo i18n("Current Marker"); ?><br /><br /> + <img src="http://maps.google.com/mapfiles/ms/micons/purple-dot.png" style="vertical-align:middle" alt="blue" /> + <?php echo i18n("Location Marker"); ?><br /><br /> + <img src="http://maps.google.com/mapfiles/ms/micons/blue-dot.png" style="vertical-align:middle" alt="purple" /> + <?php echo i18n("Location Marker With Assigned Albums"); ?><br /><br /> + <img src="http://maps.google.com/mapfiles/ms/micons/green-dot.png" style="vertical-align:middle" alt="green" /> + <?php echo i18n("Location Marker With Assigned Images (GPS)"); ?><br /><br /> + <img src="http://maps.google.com/mapfiles/ms/micons/yellow-dot.png" style="vertical-align:middle" alt="yellow" /> + <?php echo i18n("Images"); ?><br /><br /> + </div> + + <?php + if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + ?> + <br /> + <div> + <b>Create marker:</b><br /> + 1. Enter address or just press "Geocode"<br /> + 2. Drag the marker to fine adjust<br /> + 3. Check marker name<br /> + 4. Press "Save"<br /> + <br /> + <b>Assign albums:</b><br /> + 1. Click on a marker<br /> + 2. Press "Assign album"<br /> + 3. Choose album and press "Save"<br /> + 4. Repeat for multiple albums<br /> + <br /> + <b>Assign images to an album marker:</b><br /> + This is done automatically. But it's required that your images have the + GPS information stored inside. You will need a GPS Data Logger to do this + automatically. It is also possible do it manually. Robogeo is a tool, but + it is not free.<br /> + </div> + + <div> + <b>Not assigned images:</b><br /> + albums/album1 (22 images)<br /> + </div> + <?php + } + ?> +</div> + +<div id="linDivPopupAlbums" style="display: none;"> + <br /> + <?php echo i18n("Please select the album to show in Google Maps:"); ?> + <div id="linDivMapAlbums"></div> +</div> + +<div id="linDivEditMarker" style="display: none;"> + <fieldset style="width: 350px;"><legend><?php echo i18n("Create New Marker"); ?></legend> + <label for="linInputMarkerName" class="linInputEditMarker"><?php echo i18n("Marker Name"); ?>: + </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="31" /><br /> + <label for="linInputLat" class="linInputEditMarker"><?php echo i18n("Lat/Lon/Zoom"); ?>: + </label><input type="text" id="linInputLat" name="linInputLat" size="10" /> + <input type="text" id="linInputLon" name="linInputLon" size="10" /> + <input type="text" id="linInputZoom" name="linInputZoom" size="1" /> + + <br /><br /> + <input type="submit" value="<?php echo i18n("Save"); ?>" /> + <input type="button" value="<?php echo i18n("Cancel"); ?>" onclick="myLinMaps.removeEditMarker()"/> + <input type="hidden" name="cmd" value="saveMarker" /> + + </fieldset> +</div> + +<div id="linDivLoadingOuter" style="display: none;" class="linBackground"> + <?php echo $linTpl->divRoundCorners('top'); ?> + <div id="linDivLoading"> + <img src="<?php echo LINPHA_CLIENT; ?>/lib/graphics/loading.gif" /> + </div> + <?php echo $linTpl->divRoundCorners('bottom'); ?> +</div> + <script language="JavaScript" type="text/javascript"> -function linGetMarkerHtml(markerNode) -{ - var htmlStr = '<b>' + markerNode.name + '</b><br />'; - - if( markerNode.type == 'images' ) - { - htmlStr += '<img src="'+imageSrc+markerNode.id+'" width="' + - linMapsMarkerThumbSize+'" >' + markerNode.text; - - $('thumb_'+markerNode.id).focus(); - } - else - { - - if( markerNode.albId != 0 ) { - htmlStr += '<?php echo i18n("Album"); ?>: ' + markerNode.path + '<br />'; - - if( markerNode.type == 'albumWithImg') { - htmlStr += '<a href="javascript:myLinMaps.loadImages('+ markerNode.albId +')"><?php - echo i18n("Open Images"); ?></a><br />'; - } - } - - <?php - if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) - { - ?> - htmlStr += '<br /><fieldset style="width: 350px;"><legend><?php - echo i18n("Edit Marker"); ?></legend><form><select name="linInputAlbum" style="width: 250px;"><?php - linBuildAlbumSelect($with_all_albs_entry=false,$with_linebreaks=false); ?></select><br />'; - - if(markerNode.albId != 0) - { - htmlStr += '<input type="button" value="<?php echo i18n("Change Assigned Album"); - ?>" onclick="myLinMaps.assignAlbumChange(' + markerNode.id + ',this.form.linInputAlbum.value)">' + - '<input type="button" value="<?php echo i18n("Delete"); - ?>" onclick="myLinMaps.assignAlbumDelete(' + markerNode.id + ',0)"><br /><br />'; - } else { - htmlStr += '<input type="button" value="<?php echo i18n("Assign Album"); - ?>" onclick="myLinMaps.assignAlbum(' + markerNode.id + ', this.form.linInputAlbum.value)">'; - } - - htmlStr += '<input type="button" value="<?php echo i18n("Delete Marker"); ?>" onclick="if(confirm(\'<?php - echo sprintf(LIN_STR_CONFIRMDELETE, i18n("this marker")); - ?>\')){myLinMaps.deleteMarker(' + markerNode.id + ');}"></form></fieldset>'; - <?php - } - ?> - } - - return htmlStr; -} +function linGetMarkerHtml(markerNode) +{ + var htmlStr = '<b>' + markerNode.name + '</b><br />'; + + if( markerNode.type == 'images' ) + { + htmlStr += '<img src="'+imageSrc+markerNode.id+'" width="' + + linMapsMarkerThumbSize+'" >' + markerNode.text; + $('thumb_'+markerNode.id).focus(); + } + else + { + + if( markerNode.albId != 0 ) { + htmlStr += '<?php echo i18n("Album"); ?>: ' + markerNode.path + '<br />'; + + if( markerNode.type == 'albumWithImg') { + htmlStr += '<a href="javascript:myLinMaps.loadImages('+ markerNode.albId +')"><?php + echo i18n("Open Images"); ?></a><br />'; + } + } + + <?php + if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + ?> + htmlStr += '<br /><fieldset style="width: 350px;"><legend><?php + echo i18n("Edit Marker"); ?></legend><form><select name="linInputAlbum" style="width: 250px;"><?php + linBuildAlbumSelect($with_all_albs_entry=false,$with_linebreaks=false); ?></select><br />'; + + if(markerNode.albId != 0) + { + htmlStr += '<input type="button" value="<?php echo i18n("Change Assigned Album"); + ?>" onclick="myLinMaps.assignAlbumChange(' + markerNode.id + ',this.form.linInputAlbum.value)">' + + '<input type="button" value="<?php echo i18n("Delete"); + ?>" onclick="myLinMaps.assignAlbumDelete(' + markerNode.id + ',0)"><br /><br />'; + } else { + htmlStr += '<input type="button" value="<?php echo i18n("Assign Album"); + ?>" onclick="myLinMaps.assignAlbum(' + markerNode.id + ', this.form.linInputAlbum.value)">'; + } + + htmlStr += '<input type="button" value="<?php echo i18n("Delete Marker"); ?>" onclick="if(confirm(\'<?php + echo sprintf(LIN_STR_CONFIRMDELETE, i18n("this marker")); + ?>\')){myLinMaps.deleteMarker(' + markerNode.id + ');}"></form></fieldset>'; + <?php + } + ?> + } + + return htmlStr; +} + </script> - + Modified: trunk/linpha2/templates/default/view_img.head.php =================================================================== --- trunk/linpha2/templates/default/view_img.head.php 2008-02-07 23:22:46 UTC (rev 4857) +++ trunk/linpha2/templates/default/view_img.head.php 2008-02-07 23:24:36 UTC (rev 4858) @@ -1,25 +1,25 @@ - -<script language="JavaScript" type="text/javascript"> -var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; -var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; -var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; -var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; -var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; -var startImgHeight = <?php echo $GLOBALS['linpha']->imgview->img_height; ?>; -var firstImgId = <?php echo $GLOBALS['linpha']->imgview->photos_filtered[0]['id']; /* @todo needs updating on change of sort order */ ?>; -var lastImgId = <?php echo $GLOBALS['linpha']->imgview->photos_filtered[ count($GLOBALS['linpha']->imgview->photos_filtered)-1 ]['id']; /* @todo needs updating on change of sort order */ ?>; -var useEffects = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_useeffects']; ?>; -var linSlideshowHtml = '<?php -/** - * @todo is it somehow possible to cache the slideshow divs? - * for example in external .js file? (that would have to be generated from a php file...) - */ -$fragment = 'slideshow'; ob_start(); -include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); -$string = ob_get_clean(); $string = str_replace("\n","",$string); $string = str_replace("\r","",$string); $string = str_replace("\t","",$string); -echo $string; -?>'; -</script> - -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder"></script> -<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinImage.js"> </script> + +<script language="JavaScript" type="text/javascript"> +var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; +var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; +var thumbSrc = '<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='; ?>'; +var maxImageWidth = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_width']; ?>; +var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; +var startImgHeight = <?php echo $GLOBALS['linpha']->imgview->img_height; ?>; +var firstImgId = <?php echo $GLOBALS['linpha']->imgview->photos_filtered[0]['id']; /* @todo needs updating on change of sort order */ ?>; +var lastImgId = <?php echo $GLOBALS['linpha']->imgview->photos_filtered[ count($GLOBALS['linpha']->imgview->photos_filtered)-1 ]['id']; /* @todo needs updating on change of sort order */ ?>; +var useEffects = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_useeffects']; ?>; +var linSlideshowHtml = '<?php +/** + * @todo is it somehow possible to cache the slideshow divs? + * for example in external .js file? (that would have to be generated from a php file...) + */ +$fragment = 'slideshow'; ob_start(); +include(LINPHA_DIR.'/templates/'.$this->template_name.'/fragments.php'); +$string = ob_get_clean(); $string = str_replace("\n","",$string); $string = str_replace("\r","",$string); $string = str_replace("\t","",$string); +echo $string; +?>'; +</script> + +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder"></script> +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinImage.js"> </script> Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2008-02-07 23:22:46 UTC (rev 4857) +++ trunk/linpha2/templates/default/view_img.html.php 2008-02-07 23:24:36 UTC (rev 4858) @@ -48,14 +48,14 @@ <br /><br /> - <div id="linDivTabs"> - <a href="javascript:myLinGlobal.openTab('linDivTab',0)">Comments</a> | - <a href="javascript:myLinGlobal.openTab('linDivTab',1)">Rating</a> | - <a href="javascript:myLinGlobal.openTab('linDivTab',2)">Info</a> | - <a id="linAMetaExif" href="javascript:myLinGlobal.openTab('linDivTab',3)">EXIF</a> - <br /><br /> - - <div class="linDivTab"> + <div id="linDivTabs"> + <a href="javascript:myLinGlobal.openTab('linDivTab',0)">Comments</a> | + <a href="javascript:myLinGlobal.openTab('linDivTab',1)">Rating</a> | + <a href="javascript:myLinGlobal.openTab('linDivTab',2)">Info</a> | + <a id="linAMetaExif" href="javascript:myLinGlobal.openTab('linDivTab',3)">EXIF</a> + <br /><br /> + + <div class="linDivTab"> <!-- comments --> <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> <!-- show add comment form --> @@ -81,32 +81,32 @@ <?php } /* end if checkPermission('metadata_comments') */ ?> <!-- show image comments --> - <div id="linDivComments"></div> - </div> - <div class="linDivTab"> - Rating - </div> - <div class="linDivTab"> - Info - <div id="linDivMeta"></div> - - <div id="linDivVideoLink" class="linDivMetaLinks"> - <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> - <br /> - <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> - <br /> - <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> - </div> - - </div> - <div class="linDivTab"> - EXIF - - <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> - </div> - <script type="text/javascript"> - myLinGlobal.openTab('linDivTab',0); - </script> + <div id="linDivComments"></div> + </div> + <div class="linDivTab"> + Rating + </div> + <div class="linDivTab"> + Info + <div id="linDivMeta"></div> + + <div id="linDivVideoLink" class="linDivMetaLinks"> + <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> + <br /> + <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> + <br /> + <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> + </div> + + </div> + <div class="linDivTab"> + EXIF + + <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> + </div> + <script type="text/javascript"> + myLinGlobal.openTab('linDivTab',0); + </script> </div> </div> Modified: trunk/linpha2/templates/default/view_thumb_static.html.php =================================================================== --- trunk/linpha2/templates/default/view_thumb_static.html.php 2008-02-07 23:22:46 UTC (rev 4857) +++ trunk/linpha2/templates/default/view_thumb_static.html.php 2008-02-07 23:24:36 UTC (rev 4858) @@ -1,56 +1,56 @@ - -<!-- navigation --> -<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> - <div id="linDivNavigationOuter"> - <?php echo $linTpl->divRoundCorners('top'); ?> - - <div id="linDivNavigation"> - <?php echo $linTpl->output['navigation']; ?> - </div> - - <?php echo $linTpl->divRoundCorners('bottom'); ?> - </div> -<?php } ?> - -<!-- main --> -<div id="linDivMainOuter"> - <?php echo $linTpl->divRoundCorners('top'); ?> - - <div id="linDivPagenrOuter"> - <div id="linDivPagenr"> - <div id="linDivPagenrLeft" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_left']; ?></div> - <div id="linDivPagenrMiddle" class="linDivPagenrAll linDivPagenrMiddle"><?php echo $linTpl->output['page_nr']; ?></div> - <div id="linDivPagenrRight" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_right']; ?></div> - </div> - </div> - - <div id="linDivMain"> - - <?php - if( isset($GLOBALS['linpha']->imgview->photos_show)) - { - for($i=1; list($key,$value) = each($GLOBALS['linpha']->imgview->photos_show); $i++) - { - if( ($i-1) % $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols'] == 0) { - echo '<div style="clear: left;"></div>'; // add clear float for line break - } - ?> - - <div class="linDivThumb"> - <?php echo $linTpl->output['thumb_infos'][$value['id']]['before']; ?> - <div class="linDivImg"> - <a href="<?php echo $linTpl->URL_base.'&linId='.$value['id']; ?>"> - <img src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$value['id']; ?>" width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" alt="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" title="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" class="linImgThumb" /></a> - </div> - <div class="linDivText"><?php echo $linTpl->output['thumb_infos'][$value['id']]['after']; ?></div> - </div> - <?php - } - } - ?> - - </div> - <div style="clear: both;"></div> - - <?php echo $linTpl->divRoundCorners('bottom'); ?> + +<!-- navigation --> +<?php if(isset($linTpl->output['navigation']) && !empty($linTpl->output['navigation'])) { ?> + <div id="linDivNavigationOuter"> + <?php echo $linTpl->divRoundCorners('top'); ?> + + <div id="linDivNavigation"> + <?php echo $linTpl->output['navigation']; ?> + </div> + + <?php echo $linTpl->divRoundCorners('bottom'); ?> + </div> +<?php } ?> + +<!-- main --> +<div id="linDivMainOuter"> + <?php echo $linTpl->divRoundCorners('top'); ?> + + <div id="linDivPagenrOuter"> + <div id="linDivPagenr"> + <div id="linDivPagenrLeft" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_left']; ?></div> + <div id="linDivPagenrMiddle" class="linDivPagenrAll linDivPagenrMiddle"><?php echo $linTpl->output['page_nr']; ?></div> + <div id="linDivPagenrRight" class="linDivPagenrAll"><?php echo $linTpl->output['page_nr_right']; ?></div> + </div> + </div> + + <div id="linDivMain"> + + <?php + if( isset($GLOBALS['linpha']->imgview->photos_show)) + { + for($i=1; list($key,$value) = each($GLOBALS['linpha']->imgview->photos_show); $i++) + { + if( ($i-1) % $GLOBALS['linpha']->sql->config->value['sys_style_thumb_nojsnrcols'] == 0) { + echo '<div style="clear: left;"></div>'; // add clear float for line break + } + ?> + + <div class="linDivThumb"> + <?php echo $linTpl->output['thumb_infos'][$value['id']]['before']; ?> + <div class="linDivImg"> + <a href="<?php echo $linTpl->URL_base.'&linId='.$value['id']; ?>"> + <img src="<?php echo LINPHA_CLIENT.'/get_thumb.php?linId='.$value['id']; ?>" width="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" height="<?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>" alt="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" title="<?php echo $linTpl->output['thumb_infos'][$value['id']]['title']; ?>" class="linImgThumb" /></a> + </div> + <div class="linDivText"><?php echo $linTpl->output['thumb_infos'][$value['id']]['after']; ?></div> + </div> + <?php + } + } + ?> + + </div> + <div style="clear: both;"></div> + + <?php echo $linTpl->divRoundCorners('bottom'); ?> </div> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fan...@us...> - 2008-02-07 23:22:55
|
Revision: 4857 http://linpha.svn.sourceforge.net/linpha/?rev=4857&view=rev Author: fangehrn Date: 2008-02-07 15:22:46 -0800 (Thu, 07 Feb 2008) Log Message: ----------- 2008-02-07 flo * Important: the define ADODB_FETCH_ASSOC never worked now it is enabled and maybe some queries are broken..? -> imgview broken because of $db->GetAssoc() * Added benchmark module * Enabled adodb's logSql() function -> perf.php analysis all sql queries Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/index.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/include/common.php trunk/linpha2/templates/default/default.html.php trunk/linpha2/templates/default/global.html.php trunk/linpha2/templates/default/home.html.php Added Paths: ----------- trunk/linpha2/lib/adodb/docs/ trunk/linpha2/lib/adodb/docs/docs-active-record.htm trunk/linpha2/lib/adodb/docs/docs-adodb.htm trunk/linpha2/lib/adodb/docs/docs-datadict.htm trunk/linpha2/lib/adodb/docs/docs-oracle.htm trunk/linpha2/lib/adodb/docs/docs-perf.htm trunk/linpha2/lib/adodb/docs/docs-session.htm trunk/linpha2/lib/adodb/docs/docs-session.old.htm trunk/linpha2/lib/adodb/docs/old-changelog.htm trunk/linpha2/lib/adodb/docs/readme.htm trunk/linpha2/lib/adodb/docs/tips_portable_sql.htm trunk/linpha2/lib/adodb/docs/tute.htm trunk/linpha2/lib/adodb/perf/ trunk/linpha2/lib/adodb/perf/perf-db2.inc.php trunk/linpha2/lib/adodb/perf/perf-informix.inc.php trunk/linpha2/lib/adodb/perf/perf-mssql.inc.php trunk/linpha2/lib/adodb/perf/perf-mysql.inc.php trunk/linpha2/lib/adodb/perf/perf-oci8.inc.php trunk/linpha2/lib/adodb/perf/perf-postgres.inc.php trunk/linpha2/lib/modules/module.benchmark.php trunk/linpha2/logsql.txt trunk/linpha2/perf.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-07 20:43:31 UTC (rev 4856) +++ trunk/linpha2/ChangeLog 2008-02-07 23:22:46 UTC (rev 4857) @@ -2,6 +2,12 @@ 2008-02-07 flo * AdoDB updated to version 503 * fixed adodb error handler + * Important: the define ADODB_FETCH_ASSOC never worked + now it is enabled and maybe some queries are broken..? + -> imgview broken because of $db->GetAssoc() + * Added benchmark module + * Enabled adodb's logSql() function + -> perf.php analysis all sql queries 2008-02-06 flo * common.php/linpha.class.php Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2008-02-07 20:43:31 UTC (rev 4856) +++ trunk/linpha2/index.php 2008-02-07 23:22:46 UTC (rev 4857) @@ -67,11 +67,13 @@ case 'geodata': require_once(LINPHA_DIR.'/lib/modules/module.geodata.php'); break; +case 'benchmark': + require_once(LINPHA_DIR.'/lib/modules/module.benchmark.php'); + break; case 'empty': require_once(LINPHA_DIR.'/lib/modules/module.empty.php'); break; - - + default: // include plugins $pluginDir = LINPHA_DIR.'/lib/plugins'; Added: trunk/linpha2/lib/adodb/docs/docs-active-record.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-active-record.htm (rev 0) +++ trunk/linpha2/lib/adodb/docs/docs-active-record.htm 2008-02-07 23:22:46 UTC (rev 4857) @@ -0,0 +1,544 @@ +<html> +<style> +pre { + background-color: #eee; + padding: 0.75em 1.5em; + font-size: 12px; + border: 1px solid #ddd; +} + +li,p { +font-family: Arial, Helvetica, sans-serif ; +} +</style> +<title>ADOdb Active Record</title> +<body> +<h1>ADOdb Active Record</h1> +<p> (c) 2000-2008 John Lim (jlim#natsoft.com)</p> +<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This + means you can use it in compiled proprietary and commercial products.</font></p> +<p><hr> +<ol> + +<h3><li>Introduction</h3> +<p> +ADOdb_Active_Record is an Object Relation Mapping (ORM) implementation using PHP. In an ORM system, the tables and rows of the database are abstracted into native PHP objects. This allows the programmer to focus more on manipulating the data and less on writing SQL queries. +<p> +This implementation differs from Zend Framework's implementation in the following ways: +<ul> +<li>Works with PHP4 and PHP5 and provides equivalent functionality in both versions of PHP.<p> +<li>ADOdb_Active_Record works when you are connected to multiple databases. Zend's only works when connected to a default database.<p> +<li>Support for $ADODB_ASSOC_CASE. The field names are upper-cased, lower-cased or left in natural case depending on this setting.<p> +<li>No field name conversion to camel-caps style, unlike Zend's implementation which will convert field names such as 'first_name' to 'firstName'.<p> +<li>NewADOConnection::GetActiveRecords() and ADOConnection::GetActiveRecordsClass() functions in adodb.inc.php.<p> +<li>Caching of table metadata so it is only queried once per table, no matter how many Active Records are created.<p> +<li>The additional functionality is described <a href=#additional>below</a>. +</ul> +<P> +ADOdb_Active_Record is designed upon the principles of the "ActiveRecord" design pattern, which was first described by Martin Fowler. The ActiveRecord pattern has been implemented in many forms across the spectrum of programming languages. ADOdb_Active_Record attempts to represent the database as closely to native PHP objects as possible. +<p> +ADOdb_Active_Record maps a database table to a PHP class, and each instance of that class represents a table row. Relations between tables can also be defined, allowing the ADOdb_Active_Record objects to be nested. +<p> + +<h3><li>Setting the Database Connection</h3> +<p> +The first step to using ADOdb_Active_Record is to set the default connection that an ADOdb_Active_Record objects will use to connect to a database. + +<pre> +require_once('adodb/adodb-active-record.inc.php'); + +$db = NewADOConnection('mysql://root:pwd@localhost/dbname'); +ADOdb_Active_Record::SetDatabaseAdapter($db); +</pre> + +<h3><li>Table Rows as Objects</h3> +<p> +First, let's create a temporary table in our MySQL database that we can use for demonstrative purposes throughout the rest of this tutorial. We can do this by sending a CREATE query: + +<pre> +$db->Execute("CREATE TEMPORARY TABLE `persons` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name_first` varchar(100) NOT NULL default '', + `name_last` varchar(100) NOT NULL default '', + `favorite_color` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM; + "); + </pre> +<p> +ADOdb_Active_Record's are object representations of table rows. Each table in the database is represented by a class in PHP. To begin working with a table as a ADOdb_Active_Record, a class that extends ADOdb_Active_Records needs to be created for it. + +<pre> +class Person extends ADOdb_Active_Record{} +$person = new Person(); +</pre> + +<p> +In the above example, a new ADOdb_Active_Record object $person was created to access the "persons" table. Zend_Db_DataObject takes the name of the class, pluralizes it (according to American English rules), and assumes that this is the name of the table in the database. +<p> +This kind of behavior is typical of ADOdb_Active_Record. It will assume as much as possible by convention rather than explicit configuration. In situations where it isn't possible to use the conventions that ADOdb_Active_Record expects, options can be overridden as we'll see later. + +<h3><li>Table Columns as Object Properties</h3> +<p> +When the $person object was instantiated, ADOdb_Active_Record read the table metadata from the database itself, and then exposed the table's columns (fields) as object properties. +<p> +Our "persons" table has three fields: "name_first", "name_last", and "favorite_color". Each of these fields is now a property of the $person object. To see all these properties, use the ADOdb_Active_Record::getAttributeNames() method: +<pre> +var_dump($person->getAttributeNames()); + +/** + * Outputs the following: + * array(4) { + * [0]=> + * string(2) "id" + * [1]=> + * string(9) "name_first" + * [2]=> + * string(8) "name_last" + * [3]=> + * string(13) "favorite_color" + * } + */ + </pre> +<p> +One big difference between ADOdb and Zend's implementation is we do not automatically convert to camelCaps style. +<p> +<h3><li>Inserting and Updating a Record</h3><p> + +An ADOdb_Active_Record object is a representation of a single table row. However, when our $person object is instantiated, it does not reference any particular row. It is a blank record that does not yet exist in the database. An ADOdb_Active_Record object is considered blank when its primary key is NULL. The primary key in our persons table is "id". +<p> +To insert a new record into the database, change the object's properties and then call the ADOdb_Active_Record::save() method: +<pre> +$person = new Person(); +$person->nameFirst = 'Andi'; +$person->nameLast = 'Gutmans'; +$person->save(); + </pre> +<p> +Oh, no! The above code snippet does not insert a new record into the database. Instead, outputs an error: +<pre> +1048: Column 'name_first' cannot be null + </pre> +<p> +This error occurred because MySQL rejected the INSERT query that was generated by ADOdb_Active_Record. If exceptions are enabled in ADOdb and you are using PHP5, an error will be thrown. In the definition of our table, we specified all of the fields as NOT NULL; i.e., they must contain a value. +<p> +ADOdb_Active_Records are bound by the same contraints as the database tables they represent. If the field in the database cannot be NULL, the corresponding property in the ADOdb_Active_Record also cannot be NULL. In the example above, we failed to set the property $person->favoriteColor, which caused the INSERT to be rejected by MySQL. +<p> +To insert a new ADOdb_Active_Record in the database, populate all of ADOdb_Active_Record's properties so that they satisfy the constraints of the database table, and then call the save() method: +<pre> +/** + * Calling the save() method will successfully INSERT + * this $person into the database table. + */ +$person = new Person(); +$person->name_first = 'Andi'; +$person->name_last = 'Gutmans'; +$person->favorite_color = 'blue'; +$person->save(); +</pre> +<p> +Once this $person has been INSERTed into the database by calling save(), the primary key can now be read as a property. Since this is the first row inserted into our temporary table, its "id" will be 1: +<pre> +var_dump($person->id); + +/** + * Outputs the following: + * string(1) + */ + </pre> +<p> +From this point on, updating it is simply a matter of changing the object's properties and calling the save() method again: + +<pre> +$person->favorite_color = 'red'; +$person->save(); + </pre> +<p> +The code snippet above will change the favorite color to red, and then UPDATE the record in the database. + +<a name=additional> +<h2>ADOdb Specific Functionality</h2> +<h3><li>Setting the Table Name</h3> +<p>The default behaviour on creating an ADOdb_Active_Record is to "pluralize" the class name and + use that as the table name. Often, this is not the case. For example, the Person class could be reading + from the "People" table. +<p>We provide two ways to define your own table: +<p>1. Use a constructor parameter to override the default table naming behaviour. +<pre> + class Person extends ADOdb_Active_Record{} + $person = new Person('People'); +</pre> +<p>2. Define it in a class declaration: +<pre> + class Person extends ADOdb_Active_Record + { + var $_table = 'People'; + } + $person = new Person(); +</pre> + +<h3><li>$ADODB_ASSOC_CASE</h3> +<p>This allows you to control the case of field names and properties. For example, all field names in Oracle are upper-case by default. So you +can force field names to be lowercase using $ADODB_ASSOC_CASE. Legal values are as follows: +<pre> + 0: lower-case + 1: upper-case + 2: native-case +</pre> +<p>So to force all Oracle field names to lower-case, use +<pre> +$ADODB_ASSOC_CASE = 0; +$person = new Person('People'); +$person->name = 'Lily'; +$ADODB_ASSOC_CASE = 2; +$person2 = new Person('People'); +$person2->NAME = 'Lily'; +</pre> + +<p>Also see <a href=http://phplens.com/adodb/reference.constants.adodb_assoc_case.html>$ADODB_ASSOC_CASE</a>. + +<h3><li>ADOdb_Active_Record::Save()</h3> +<p> +Saves a record by executing an INSERT or UPDATE SQL statement as appropriate. +<p>Returns false on unsuccessful INSERT, true if successsful INSERT. +<p>Returns 0 on failed UPDATE, and 1 on UPDATE if data has changed, and -1 if no data was changed, so no UPDATE statement was executed. + +<h3><li>ADOdb_Active_Record::Replace()</h3> +<p> +ADOdb supports replace functionality, whereby the record is inserted if it does not exists, or updated otherwise. +<pre> +$rec = new ADOdb_Active_Record("product"); +$rec->name = 'John'; +$rec->tel_no = '34111145'; +$ok = $rec->replace(); // 0=failure, 1=update, 2=insert +</pre> + + +<h3><li>ADOdb_Active_Record::Load($where)</h3> +<p>Sometimes, we want to load a single record into an Active Record. We can do so using: +<pre> +$person->load("id=3"); + +// or using bind parameters + +$person->load("id=?", array(3)); +</pre> +<p>Returns false if an error occurs. + +<h3><li>ADOdb_Active_Record::Find($whereOrderBy, $bindarr=false, $pkeyArr=false)</h3> +<p>We want to retrieve an array of active records based on some search criteria. For example: +<pre> +class Person extends ADOdb_Active_Record { +var $_table = 'people'; +} + +$person = new Person(); +$peopleArray = $person->Find("name like ? order by age", array('Sm%')); +</pre> + +<h3><li>Error Handling and Debugging</h3> +<p> +In PHP5, if adodb-exceptions.inc.php is included, then errors are thrown. Otherwise errors are handled by returning a value. False by default means an error has occurred. You can get the last error message using the ErrorMsg() function. +<p> +To check for errors in ADOdb_Active_Record, do not poll ErrorMsg() as the last error message will always be returned, even if it occurred several operations ago. Do this instead: +<pre> +# right! +$ok = $rec->Save(); +if (!$ok) $err = $rec->ErrorMsg(); + +# wrong :( +$rec->Save(); +if ($rec->ErrorMsg()) echo "Wrong way to detect error"; +</pre> +<p>The ADOConnection::Debug property is obeyed. So +if $db->debug is enabled, then ADOdb_Active_Record errors are also outputted to standard output and written to the browser. + +<h3><li>ADOdb_Active_Record::Set()</h3> +<p>You can convert an array to an ADOdb_Active_Record using Set(). The array must be numerically indexed, and have all fields of the table defined in the array. The elements of the array must be in the table's natural order too. +<pre> +$row = $db->GetRow("select * from tablex where id=$id"); + +# PHP4 or PHP5 without enabling exceptions +$obj = new ADOdb_Active_Record('Products'); +if ($obj->ErrorMsg()){ + echo $obj->ErrorMsg(); +} else { + $obj->Set($row); +} + +# in PHP5, with exceptions enabled: + +include('adodb-exceptions.inc.php'); +try { + $obj = new ADOdb_Active_Record('Products'); + $obj->Set($row); +} catch(exceptions $e) { + echo $e->getMessage(); +} +</pre> +<p> +<h3><li>Primary Keys</h3> +<p> +ADOdb_Active_Record does not require the table to have a primary key. You can insert records for such a table, but you will not be able to update nor delete. +<p>Sometimes you are retrieving data from a view or table that has no primary key, but has a unique index. You can dynamically set the primary key of a table through the constructor, or using ADOdb_Active_Record::SetPrimaryKeys(): +<pre> + $pkeys = array('category','prodcode'); + + // set primary key using constructor + $rec = new ADOdb_Active_Record('Products', $pkeys); + + // or use method + $rec->SetPrimaryKeys($pkeys); +</pre> + + +<h3><li>Retrieval of Auto-incrementing ID</h3> +When creating a new record, the retrieval of the last auto-incrementing ID is not reliable for databases that do not support the Insert_ID() function call (check $connection->hasInsertID). In this case we perform a <b>SELECT MAX($primarykey) FROM $table</b>, which will not work reliably in a multi-user environment. You can override the ADOdb_Active_Record::LastInsertID() function in this case. + +<h3><li>Dealing with Multiple Databases</h3> +<p> +Sometimes we want to load data from one database and insert it into another using ActiveRecords. This can be done using the optional parameter of the ADOdb_Active_Record constructor. In the following example, we read data from db.table1 and store it in db2.table2: +<pre> +$db = NewADOConnection(...); +$db2 = NewADOConnection(...); + +ADOdb_Active_Record::SetDatabaseAdapter($db2); + +$activeRecs = $db->GetActiveRecords('table1'); + +foreach($activeRecs as $rec) { + $rec2 = new ADOdb_Active_Record('table2',$db2); + $rec2->id = $rec->id; + $rec2->name = $rec->name; + + $rec2->Save(); +} +</pre> +<p> +If you have to pass in a primary key called "id" and the 2nd db connection in the constructor, you can do so too: +<pre> +$rec = new ADOdb_Active_Record("table1",array("id"),$db2); +</pre> + +<h3><li>$ADODB_ACTIVE_CACHESECS</h3> +<p>You can cache the table metadata (field names, types, and other info such primary keys) in $ADODB_CACHE_DIR (which defaults to /tmp) by setting +the global variable $ADODB_ACTIVE_CACHESECS to a value greater than 0. This will be the number of seconds to cache. + You should set this to a value of 30 seconds or greater for optimal performance. + +<h3><li>Active Record Considered Bad?</h3> +<p>Although the Active Record concept is useful, you have to be aware of some pitfalls when using Active Record. The level of granularity of Active Record is individual records. It encourages code like the following, used to increase the price of all furniture products by 10%: +<pre> + $recs = $db->GetActiveRecords("Products","category='Furniture'"); + foreach($recs as $rec) { + $rec->price *= 1.1; // increase price by 10% for all Furniture products + $rec->save(); + } +</pre> +Of course a SELECT statement is superior because it's simpler and much more efficient (probably by a factor of x10 or more): +<pre> + $db->Execute("update Products set price = price * 1.1 where category='Furniture'"); +</pre> +<p>Another issue is performance. For performance sensitive code, using direct SQL will always be faster than using Active Records due to overhead and the fact that all fields in a row are retrieved (rather than only the subset you need) whenever an Active Record is loaded. + +<h3><li>Transactions</h3> +<p> +The default transaction mode in ADOdb is autocommit. So that is the default with active record too. +The general rules for managing transactions still apply. Active Record to the database is a set of insert/update/delete statements, and the db has no knowledge of active records. +<p> +Smart transactions, that does an auto-rollback if an error occurs, is still the best method to multiple activities (inserts/updates/deletes) that need to be treated as a single transaction: +<pre> +$conn->StartTrans(); +$parent->save(); +$child->save(); +$conn->CompleteTrans(); +</pre> + +<h2>ADOConnection Supplement</h2> + +<h3><li>ADOConnection::GetActiveRecords()</h3> +<p> +This allows you to retrieve an array of ADOdb_Active_Records. Returns false if an error occurs. +<pre> +$table = 'products'; +$whereOrderBy = "name LIKE 'A%' ORDER BY Name"; +$activeRecArr = $db->GetActiveRecords($table, $whereOrderBy); +foreach($activeRecArr as $rec) { + $rec->id = rand(); + $rec->save(); +} +</pre> +<p> +And to retrieve all records ordered by specific fields: +<pre> +$whereOrderBy = "1=1 ORDER BY Name"; +$activeRecArr = $db->ADOdb_Active_Records($table); +</pre> +<p> +To use bind variables (assuming ? is the place-holder for your database): +<pre> +$activeRecArr = $db->GetActiveRecords($tableName, 'name LIKE ?', + array('A%')); +</pre> +<p>You can also define the primary keys of the table by passing an array of field names: +<pre> +$activeRecArr = $db->GetActiveRecords($tableName, 'name LIKE ?', + array('A%'), array('id')); +</pre> + +<h3><li>ADOConnection::GetActiveRecordsClass()</h3> +<p> +This allows you to retrieve an array of objects derived from ADOdb_Active_Records. Returns false if an error occurs. +<pre> +class Product extends ADOdb_Active_Records{}; +$table = 'products'; +$whereOrderBy = "name LIKE 'A%' ORDER BY Name"; +$activeRecArr = $db->GetActiveRecordsClass('Product',$table, $whereOrderBy); + +# the objects in $activeRecArr are of class 'Product' +foreach($activeRecArr as $rec) { + $rec->id = rand(); + $rec->save(); +} +</pre> +<p> +To use bind variables (assuming ? is the place-holder for your database): +<pre> +$activeRecArr = $db->GetActiveRecordsClass($className,$tableName, 'name LIKE ?', + array('A%')); +</pre> +<p>You can also define the primary keys of the table by passing an array of field names: +<pre> +$activeRecArr = $db->GetActiveRecordsClass($className,$tableName, 'name LIKE ?', + array('A%'), array('id')); +</pre> + +</ol> + +<h3><li>ADOConnection::ErrorMsg()</h3> +<p>Returns last error message. +<h3><li>ADOConnection::ErrorNo()</h3> +<p>Returns last error number. +<h2>Code Sample</h2> +<p>The following works with PHP4 and PHP5 +<pre> +include('../adodb.inc.php'); +include('../adodb-active-record.inc.php'); + +// uncomment the following if you want to test exceptions +#if (PHP_VERSION >= 5) include('../adodb-exceptions.inc.php'); + +$db = NewADOConnection('mysql://root@localhost/northwind'); +$db->debug=1; +ADOdb_Active_Record::SetDatabaseAdapter($db); + +$db->Execute("CREATE TEMPORARY TABLE `persons` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name_first` varchar(100) NOT NULL default '', + `name_last` varchar(100) NOT NULL default '', + `favorite_color` varchar(100) NOT NULL default '', + PRIMARY KEY (`id`) + ) ENGINE=MyISAM; + "); + +class Person extends ADOdb_Active_Record{} +$person = new Person(); + +echo "<p>Output of getAttributeNames: "; +var_dump($person->getAttributeNames()); + +/** + * Outputs the following: + * array(4) { + * [0]=> + * string(2) "id" + * [1]=> + * string(9) "name_first" + * [2]=> + * string(8) "name_last" + * [3]=> + * string(13) "favorite_color" + * } + */ + +$person = new Person(); +$person->nameFirst = 'Andi'; +$person->nameLast = 'Gutmans'; +$person->save(); // this save() will fail on INSERT as favorite_color is a must fill... + + +$person = new Person(); +$person->name_first = 'Andi'; +$person->name_last = 'Gutmans'; +$person->favorite_color = 'blue'; +$person->save(); // this save will perform an INSERT successfully + +echo "<p>The Insert ID generated:"; print_r($person->id); + +$person->favorite_color = 'red'; +$person->save(); // this save() will perform an UPDATE + +$person = new Person(); +$person->name_first = 'John'; +$person->name_last = 'Lim'; +$person->favorite_color = 'lavender'; +$person->save(); // this save will perform an INSERT successfully + +// load record where id=2 into a new ADOdb_Active_Record +$person2 = new Person(); +$person2->Load('id=2'); +var_dump($person2); + +// retrieve an array of records +$activeArr = $db->GetActiveRecordsClass($class = "Person",$table = "persons","id=".$db->Param(0),array(2)); +$person2 = $activeArr[0]; +echo "<p>Name first (should be John): ",$person->name_first, "<br>Class = ",get_class($person2); +</pre> + + <h3>Todo (Code Contributions welcome)</h3> + <p>Check _original and current field values before update, only update changes. Also if the primary key value is changed, then on update, we should save and use the original primary key values in the WHERE clause! + <p>Handle 1-to-many relationships. + <p>PHP5 specific: Make GetActiveRecords*() return an Iterator. + <p>PHP5 specific: Change PHP5 implementation of Active Record to use __get() and __set() for better performance. + +<h3> Change Log</h3> +<p>0.08 +Added support for assoc arrays in Set(). + +<p>0.07 +<p>$ADODB_ASSOC_CASE=2 did not work properly. Fixed. +<p>Added === check in ADODB_SetDatabaseAdapter for $db, adodb-active-record.inc.php. Thx Christian Affolter. + +<p>0.06 +<p>Added ErrorNo(). +<p>Fixed php 5.2.0 compat issues. + +<p>0.05 +<p>If inserting a record and the value of a primary key field is null, then we do not insert that field in as +we assume it is an auto-increment field. Needed by mssql. + +<p>0.04 5 June 2006 <br> +<p>Added support for declaring table name in $_table in class declaration. Thx Bill Dueber for idea. +<p>Added find($where,$bindarr=false) method to retrieve an array of active record objects. + +<p>0.03 <br> +- Now we only update fields that have changed, using $this->_original.<br> +- We do not include auto_increment fields in replace(). Thx Travis Cline<br> +- Added ADODB_ACTIVE_CACHESECS.<br> + +<p>0.02 <br> +- Much better error handling. ErrorMsg() implemented. Throw implemented if adodb-exceptions.inc.php detected.<br> +- You can now define the primary keys of the view or table you are accessing manually.<br> +- The Active Record allows you to create an object which does not have a primary key. You can INSERT but not UPDATE in this case. +- Set() documented.<br> +- Fixed _pluralize bug with y suffix. + +<p> + 0.01 6 Mar 2006<br> +- Fixed handling of nulls when saving (it didn't save nulls, saved them as '').<br> +- Better error handling messages.<br> +- Factored out a new method GetPrimaryKeys().<br> + <p> + 0.00 5 Mar 2006<br> + 1st release +</body> +</html> \ No newline at end of file Added: trunk/linpha2/lib/adodb/docs/docs-adodb.htm =================================================================== --- trunk/linpha2/lib/adodb/docs/docs-adodb.htm (rev 0) +++ trunk/linpha2/lib/adodb/docs/docs-adodb.htm 2008-02-07 23:22:46 UTC (rev 4857) @@ -0,0 +1,3627 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><title>ADODB Manual</title> + +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + + +<style> +pre { + background-color: #eee; + padding: 0.75em 1.5em; + font-size: 12px; + border: 1px solid #ddd; +} +</style></head> +<body bgcolor="#ffffff" text="black"> + +<h2>ADOdb Library for PHP</h2> +<p>V5.03 22 Jan 2008 (c) 2000-2008 John Lim (jlim#natsoft.com)</p> +<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This + means you can use it in compiled proprietary and commercial products.</font></p> + + + <p>Useful ADOdb links: <a href="http://adodb.sourceforge.net/#download">Download</a> <a href="http://adodb.sourceforge.net/#docs">Other Docs</a> + +</p><p><a href="#intro"><b>Introduction</b></a><b><br> + <a href="#features">Unique Features</a><br> + <a href="#users">How People are using ADOdb</a><br> + <a href="#bugs">Feature Requests and Bug Reports</a><br> + </b><b><a href="#install">Installation</a><br> + <a href="#mininstall">Minimum Install</a><br> + <a href="#coding">Initializing Code and Connectioning to Databases</a><br> + </b><font size="2"> <a href="#dsnsupport">Data Source Name (DSN) Support</a></font> <a href="#connect_ex">Connection Examples</a> <br> + <b><a href="#speed">High Speed ADOdb - tuning tips</a></b><br> + <b><a href="#hack">Hacking and Modifying ADOdb Safely</a><br> + <a href="#php5">PHP5 Features</a></b><br> + <font size="2"><a href="#php5iterators">foreach iterators</a> <a href="#php5exceptions">exceptions</a></font><br> + <b> <a href="#drivers">Supported Databases</a></b><br> + <b> <a href="#quickstart">Tutorials</a></b><br> + <a href="#ex1">Example 1: Select</a><br> + <a href="#ex2">Example 2: Advanced Select</a><br> + <a href="#ex3">Example 3: Insert</a><br> + <a href="#ex4">Example 4: Debugging</a> <a href="#exrs2html">rs2html + example</a><br> + <a href="#ex5">Example 5: MySQL and Menus</a><br> + <a href="#ex6">Example 6: Connecting to Multiple Databases at once</a> <br> + <a href="#ex7">Example 7: Generating Update and Insert SQL</a> <br> + <a href="#ex8">Example 8: Implementing Scrolling with Next and Previous</a><br> + <a href="#ex9">Example 9: Exporting in CSV or Tab-Delimited Format</a> <br> + <a href="#ex10">Example 10: Custom filters</a><br> + <a href="#ex11">Example 11: Smart Transactions</a><br> + <br> + <b> <a href="#errorhandling">Using Custom Error Handlers and PEAR_Error</a><br> + <a href="#DSN">Data Source Names</a><br> + <a href="#caching">Caching</a><br> + <a href="#pivot">Pivot Tables</a></b> +</p><p><a href="#ref"><b>REFERENCE</b></a> +</p><p> <font size="2">Variables: <a href="#adodb_countrecs">$ADODB_COUNTRECS</a> +<a href="#adodb_ansi_padding_off">$ADODB_ANSI_PADDING_OFF</a> + <a href="#adodb_cache_dir">$ADODB_CACHE_DIR</a> <br> + <a href="#force_type">$ADODB_FORCE_TYPE</a> + <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a> + <a href="#adodb_lang">$ADODB_LANG</a> <a href=#adodb_auto_quote>ADODB_QUOTE_FIELDNAMES</a> <br> + Constants: </font><font size="2"><a href="#adodb_assoc_case">ADODB_ASSOC_CASE</a> + </font><br> + <a href="#ADOConnection"><b> ADOConnection</b></a><br> + <font size="2">Connections: <a href="#connect">Connect</a> <a href="#pconnect">PConnect</a> + <a href="#nconnect">NConnect</a> <a href="#isconnected">IsConnected</a><br> + Executing SQL: <a href="#execute">Execute</a> <a href="#cacheexecute"><i>CacheExecute</i></a> + <a href="#selectlimit">SelectLimit</a> <a href="#cacheSelectLimit"><i>CacheSelectLimit</i></a> + <a href="#param">Param</a> <a href="#prepare">Prepare</a> <a href="#preparesp">PrepareSP</a> + <a href="#inparameter">InParameter</a> <a href="#outparameter">OutParameter</a> <a href="#autoexecute">AutoExecute</a> + <br> + <a href="#getone">GetOne</a> + <a href="#cachegetone"><i>CacheGetOne</i></a> <a href="#getrow">GetRow</a> <a href="#cachegetrow"><i>CacheGetRow</i></a> + <a href="#getall">GetAll</a> <a href="#cachegetall"><i>CacheGetAll</i></a> <a href="#getcol">GetCol</a> + <a href="#cachegetcol"><i>CacheGetCol</i></a> <a href="#getassoc1">GetAssoc</a> <a href="#cachegetassoc"><i>CacheGetAssoc</i></a> <a href="#replace">Replace</a> + <br> + <a href="#executecursor">ExecuteCursor</a> + (oci8 only)<br> + Generates SQL strings: <a href="#getupdatesql">GetUpdateSQL</a> <a href="#getinsertsql">GetInsertSQL</a> + <a href="#concat">Concat</a> <a href="#ifnull">IfNull</a> <a href="#length">length</a> <a href="#random">random</a> <a href="#substr">substr</a> + <a href="#qstr">qstr</a> <a href="#param">Param</a> <a href="#OffsetDate">OffsetDate</a> <a href="#sqldate">SQLDate</a> + <a href="#dbdate">DBDate</a> <a href="#dbtimestamp">DBTimeStamp</a> + <a href="#binddate">BindDate</a> <a href="#bindtimestamp">BindTimeStamp</a> + <br> + Blobs: <a href="#updateblob">UpdateBlob</a> <a href="#updateclob">UpdateClob</a> + <a href="#updateblobfile">UpdateBlobFile</a> <a href="#blobencode">BlobEncode</a> + <a href="#blobdecode">BlobDecode</a><br> + Paging/Scrolling: <a href="#pageexecute">PageExecute</a> <a href="#cachepageexecute">CachePageExecute</a><br> + Cleanup: <a href="#cacheflush">CacheFlush</a> <a href="#Close">Close</a><br> + Transactions: <a href="#starttrans">StartTrans</a> <a href="#completetrans">CompleteTrans</a> + <a href="#failtrans">FailTrans</a> <a href="#hasfailedtrans">HasFailedTrans</a> + <a href="#begintrans">BeginTrans</a> <a href="#committrans">CommitTrans</a> + <a href="#rollbacktrans">RollbackTrans</a> <a href=#SetTransactionMode>SetTransactionMode</a><br> + Fetching Data: </font> <font size="2"><a href="#setfetchmode">SetFetchMode</a><br> + Strings: <a href="#concat">concat</a> <a href="#length">length</a> <a href="#qstr">qstr</a> <a href="#quote">quote</a> <a href="#substr">substr</a><br> + Dates: <a href="#dbdate">DBDate</a> <a href="#dbtimestamp">DBTimeStamp</a> <a href="#unixdate">UnixDate</a> + <a href="#binddate">BindDate</a> <a href="#bindtimestamp">BindTimeStamp</a> + <a href="#unixtimestamp">UnixTimeStamp</a> <a href="#OffsetDate">OffsetDate</a> + <a href="#SQLDate">SQLDate</a> <br> + Row Management: <a href="#affected_rows">Affected_Rows</a> <a href="#inserted_id">Insert_ID</a> <a href="#rowlock">RowLock</a> + <a href="#genid">GenID</a> <a href="#createseq">CreateSequence</a> <a href="#dropseq">DropSequence</a> + <br> + Error Handling: <a href="#errormsg">ErrorMsg</a> <a href="#errorno">ErrorNo</a> + <a href="#metaerror">MetaError</a> <a href="#metaerrormsg">MetaErrorMsg</a> <a href="#ignoreerrors">IgnoreErrors</a><br> + Data Dictionary (metadata): <a href="#metadatabases">MetaDatabases</a> <a href="#metatables">MetaTables</a> + <a href="#metacolumns">MetaColumns</a> <a href="#metacolumnames">MetaColumnNames</a> + <a href="#metaprimarykeys">MetaPrimaryKeys</a> <a href="#metaforeignkeys">MetaForeignKeys</a> + <a href="#serverinfo">ServerInfo</a> <br> + Statistics and Query-Rewriting: <a href="#logsql">LogSQL</a> <a href="#fnexecute">fnExecute + and fnCacheExecute</a><br> + </font><font size="2">Deprecated: <a href="#bind">Bind</a> <a href="#blankrecordset">BlankRecordSet</a> + <a href="#parameter">Parameter</a></font> + <a href="#adorecordSet"><b><br> + ADORecordSet</b></a><br> + <font size="2"> + Returns one field: <a href="#fields">Fields</a><br> + Returns one row:<a href="#fetchrow">FetchRow</a> <a href="#fetchinto">FetchInto</a> + <a href="#fetchobject">FetchObject</a> <a href="#fetchnextobject">FetchNextObject</a> + <a href="#fetchobj">FetchObj</a> <a href="#fetchnextobj">FetchNextObj</a> + <a href="#getrowassoc">GetRowAssoc</a> <br> + Returns all rows:<a href="#getarray">GetArray</a> <a href="#getrows">GetRows</a> + <a href="#getassoc">GetAssoc</a><br> + Scrolling:<a href="#move">Move</a> <a href="#movenext">MoveNext</a> <a href="#movefirst">MoveFirst</a> + <a href="#movelast">MoveLast</a> <a href="#abspos">AbsolutePosition</a> <a href="#currentrow">CurrentRow</a> + <a href="#atfirstpage">AtFirstPage</a> <a href="#atlastpage">AtLastPage</a> + <a href="#absolutepage">AbsolutePage</a> </font> <font size="2"><br> + Menu generation:<a href="#getmenu">GetMenu</a> <a href="#getmenu2">GetMenu2</a><br> + Dates:<a href="#userdate">UserDate</a> <a href="#usertimestamp">UserTimeStamp</a> + <a href="#unixdate">UnixDate</a> <a href="#unixtimestamp">UnixTimeStamp<br> + </a>Recordset Info:<a href="#recordcount">RecordCount</a> <a href="#po_recordcount">PO_RecordCount</a> + <a href="#nextrecordset">NextRecordSet</a><br> + Field Info:<a href="#fieldcount">FieldCount</a> <a href="#fetchfield">FetchField</a> + <a href="#metatype">MetaType</a><br> + Cleanup: <a href="#rsclose">Close</a></font> +</p> +<p><font size="2"><a href="#rs2html"><b>rs2html</b></a> <a href="#exrs2html">example</a></font><br> + <a href="#adodiff">Differences between ADOdb and ADO</a><br> + <a href="#driverguide"><b>Database Driver Guide<br> + </b></a><b><a href="#changes">Change Log</a></b><br> +</p> +<h2>Introduction<a name="intro"></a></h2> +<p>PHP's database access functions are not standardised. This creates a need for + a database class library to hide the differences between the different database + API's (encapsulate the differences) so we can easily switch databases. PHP 4.0.5 or later + is now required (because we use array-based str_replace).</p> +<p>We currently support MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL Anywhere, Informix, + PostgreSQL, FrontBase, SQLite, Interbase (Firebird and Borland variants), Foxpro, Access, ADO, DB2, SAP DB and ODBC. + We have had successful reports of connecting to Progress and CacheLite via ODBC. We hope more people + will contribute drivers to support other databases.</p> +<p>PHP4 supports session variables. You can store your session information using + ADOdb for true portability and scalability. See adodb-session.php for more information.</p> +<p>Also read <a href="http://phplens.com/lens/adodb/tips_portable_sql.htm">tips_portable_sql.htm</a> + for tips on writing + portable SQL.</p> +<h2>Unique Features of ADOdb<a name="features"></a></h2> +<ul> + <li><b>Easy for Windows programmers</b> to adapt to because many of the conventions + are similar to Microsoft's ADO.</li> + <li>Unlike other PHP database classes which focus only on select statements, + <b>we provide support code to handle inserts and updates which can be adapted + to multiple databases quickly.</b> Methods are provided for date handling, + string concatenation and string quoting characters for differing databases.</li> + <li>A<b> metatype system </b>is built in so that we can figure out that types + such as CHAR, TEXT and STRING are equivalent in different databases.</li> + <li><b>Easy to port</b> because all the database dependant code are stored in + stub functions. You do not need to port the core logic of the classes.</li> + <li><b>Portable table and index creation</b> with the <a href="docs-datadict.htm">datadict</a> classes. + </li><li><b>Database performance monitoring and SQL tuning</b> with the <a href="docs-perf.htm">performance monitoring</a> classes. + </li><li><b>Database-backed sessions</b> with the <a href="docs-session.htm">session management</a> classes. Supports session expiry notification. +<li><b>Object-Relational Mapping</b> using <a href="docs-active-record.htm">ADOdb_Active_Record</a> classes. +</li></ul> +<h2>How People are using ADOdb<a name="users"></a></h2> +Here are some examples of how people are using ADOdb (for a much longer list, +visit <a href="http://phplens.com/phpeverywhere/adodb-cool-apps">adodb-cool-apps</a>): +<ul> +<li><a href="http://phplens.com/">PhpLens</a> 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.<p> + +</p></li><li><a href="http://www.interakt.ro/phakt/">PHAkt: PHP Extension for DreamWeaver Ultradev</a> allows you to script PHP in the popular Web page editor. Database handling provided by ADOdb.<p> + +</p></li><li><a href="http://www.andrew.cmu.edu/%7Erdanyliw/snort/snortacid.html">Analysis Console for Intrusion Databases</a> +(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.<p> + +</p></li><li><a href="http://www.postnuke.com/">PostNuke</a> 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. <p> + +</p></li><li><a href="http://www.auto-net.no/easypublish.php?page=index&lang_id=2">EasyPublish CMS</a> +is another free content management system for managing information and +integrated modules on your internet, intranet- and extranet-sites. From +Norway.<p> + +</p></li><li><a href="http://nola.noguska.com/">NOLA</a> is a full featured accounting, inventory, and job tracking application. It is licensed under the GPL, and developed by Noguska. +</li></ul><p> + +</p><h2>Feature Requests and Bug Reports<a name="bugs"></a></h2> +<p>Feature requests and bug reports can be emailed to <a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a> + or posted to the ADOdb Help forums at <a href="http://phplens.com/lens/lensforum/topics.php?id=4">http://phplens.com/lens/lensforum/topics.php?id=4</a>.</p> +<h2>Installation Guide<a name="install"></a></h2> +<p>Make sure you are running PHP 4.0.5 or later. + Unpack all the files into a directory accessible by your webserver.</p> +<p>To test, try modifying some of the tutorial examples. Make sure you customize + the connection settings correctly. You can debug using <i>$db->debug = true</i> as shown below:</p> +<pre><?php<br> include('adodb/adodb.inc.php');<br> $db = <a href="#adonewconnection">ADONewConnection</a>($dbdriver); # eg 'mysql' or 'postgres'<br> $db->debug = true;<br> $db-><a href="#connect">Connect</a>($server, $user, $password, $database);<br> $rs = $db-><a href="#execute">Execute</a>('select * from some_small_table');<br> print "<pre>";<br> print_r($rs-><a href="#getrows">GetRows</a>());<br> print "</pre>";<br>?></pre> + + <h3>Minimum Install<a name="mininstall"></a></h3> +<p>For developers who want to release a minimal install of ADOdb, you will need: +</p><ul> +<li>adodb.inc.php +</li><li>adodb-lib.inc.php +</li><li>adodb-time.inc.php +</li><li>drivers/adodb-$database.inc.php +</li><li>license.txt (for legal reasons) +</li><li>adodb-php4.inc.php +</li><li>adodb-iterator.inc.php (php5 functionality) +</li></ul> +Optional: +<ul> +<li>adodb-error.inc.php and lang/adodb-$lang.inc.php (if you use MetaError()) +</li><li>adodb-csvlib.inc.php (if you use cached recordsets - CacheExecute(), etc) +</li><li>adodb-exceptions.inc.php and adodb-errorhandler.inc.php (if you use adodb error handler or php5 exceptions). +<li>adodb-active-record.inc.php if you use <a href=docs-active-record.htm>Active Records</a>. +</li></ul> + +<h3>Code Initialization Examples<a name="coding"></a></h3> +<p>When running ADOdb, at least two files are loaded. First is adodb/adodb.inc.php, + which contains all functions used by all database classes. The code specific + to a particular database is in the adodb/driver/adodb-????.inc.php file.</p> + <a name="adonewconnection"></a> +<p>For example, to connect to a mysql database:</p> +<pre>include('/path/to/set/here/adodb.inc.php');<br>$conn =ADONewConnection('mysql');<br></pre> +<p>Whenever you need to connect to a database, you create a Connection object + using the <b>ADONewConnection</b>($driver) function. + <b>NewADOConnection</b>($driver) is an alternative name for the same function.</p> + +<p>At this point, you are not connected to the database (no longer true if you pass in a <a href="#dsnsupport">dsn</a>). You will first need to decide +whether to use <i>persistent</i> or <i>non-persistent</i> connections. The advantage of <i>persistent</i> +connections is that they are faster, as the database connection is never closed (even +when you call Close()). <i>Non-persistent </i>connections take up much fewer resources though, +reducing the risk of your database and your web-server becoming overloaded. +</p><p>For persistent connections, +use $conn-><a href="#pconnect">PConnect()</a>, + or $conn-><a href="#connect">Connect()</a> for non-persistent connections. +Some database drivers also support <a href="#nconnect">NConnect()</a>, which forces +the creation of a new connection. + +<a name="connection_gotcha"></a> +</p><p><b>Connection Gotcha</b>: If you create two connections, but both use the same userid and password, +PHP will share the same connection. This can cause problems if the connections are meant to +different databases. The solution is to always use different userid's for different databases, + or use NConnect(). + + <a name="dsnsupport"></a> + </p><h3>Data Source Name (DSN) Support</h3> + <p> Since ADOdb 4.51, you can connect to a database by passing a dsn to NewADOConnection() (or ADONewConnection, which is + the same function). The dsn format is: +</p><pre> $driver://$username:$password@hostname/$database?options[=value]<br></pre><p> +NewADOConnection() calls Connect() or PConnect() internally for you. If the connection fails, false is returned. +</p><pre> <font color="#008000"># non-persistent connection</font> + $dsn = 'mysql://root:pwd@localhost/mydb'; + $db = NewADOConnection($dsn); + if (!$db) die("Connection failed"); + + <font color="#008000"># no need to call connect/pconnect!</font> + $arr = $db->GetArray("select * from table"); + + <font color="#008000"># persistent connection</font> + $dsn2 = 'mysql://root:pwd@localhost/mydb?persist'; +</pre> +<p> +If you have special characters such as /:?_ in your dsn, then you need to rawurlencode them first: +</p><pre> $pwd = rawurlencode($pwd);<br> $dsn = "mysql://root:$pwd@localhost/mydb"; + $dsn2=rawurlencode("sybase_ase")."://user:pass@host/path?query";<br></pre> +<p> +Legal options are: +</p><p> +<table align="center" border="1"><tbody><tr><td>For all drivers</td><td> + 'persist', 'persistent', 'debug', 'fetchmode', 'new' + </td></tr><tr><td>Interbase/Firebird + </td><td> + 'dialect','charset','buffers','role' + </td></tr><tr><td>M'soft ADO</td><td> + 'charpage' + + </td></tr><tr><td>MySQL</td><td> + 'clientflags' +</td></tr><tr><td>MySQLi</td><td> + 'port', 'socket', 'clientflags' +</td></tr><tr><td>Oci8</td><td> + 'nls_date_format','charset' +</td></tr></tbody></table> +</p><p> +For all drivers, when the options <i>persist</i> or <i>persistent</i> are set, a persistent connection is forced; similarly, when <i>new</i> is set, then +a new connection will be created using NConnect if the underlying driver supports it. +The <i>debug</i> option enables debugging. The <i>fetchmode</i> calls <a href="#setfetchmode">SetFetchMode()</a>. +If no value is defined for an option, then the value is set to 1. +</p><p> +ADOdb DSN's are compatible with version 1.0 of PEAR DB's DSN format. +<a name="connect_ex"> +</a></p><h3><a name="connect_ex">Examples of Connecting to Databases</a></h3> +<h4><a name="connect_ex">MySQL and Most Other Database Drivers</a></h4> +<p><a name="connect_ex">MySQL connections are very straightforward, and the parameters are identical + to mysql_connect:</a></p> +<pre><a name="connect_ex"> $conn =ADONewConnection('mysql'); <br> $conn->PConnect('localhost','userid','password','database');<br> <br> <font color="#008000"># or dsn </font> + $dsn = 'mysql://user:pwd@localhost/mydb'; + $conn = ADONewConnection($dsn); # no need for Connect() + + <font color="#008000"># or persistent dsn</font> + $dsn = 'mysql://user:pwd@localhost/mydb?persist'; + $conn = ADONewConnection($dsn); # no need for PConnect() + + <font color="#008000"># a more complex example:</font> + $pwd = urlencode($pwd); + $flags = MYSQL_CLIENT_COMPRESS; + $dsn = "mysql://user:$pwd@localhost/mydb?persist&clientflags=$flags"; + $conn = ADONewConnection($dsn); # no need for PConnect() + </a></pre> +<p><a name="connect_ex"> For most drivers, you can use the standard function: Connect($server, $user, $password, $database), or +a </a><a href="dsnsupport">DSN</a> since ADOdb 4.51. Exceptions to this are listed below. +</p> +<a name=pdo> +<h4>PDO</h4> +<p>PDO, which only works with PHP5, accepts a driver specific connection string: +<pre> + $conn = NewADOConnection('pdo'); + $conn->Connect('mysql:host=localhost',$user,$pwd,$mydb); + $conn->Connect('mysql:host=localhost;dbname=mydb',$user,$pwd); + $conn->Connect("mysql:host=localhost;dbname=mydb;username=$user;password=$pwd"); +</pre> +<p>The DSN mechanism is also supported: +<pre> + $conn = NewADOConnection("pdo_mysql://user:pwd@localhost/mydb?persist"); # persist is optional +</pre> +<h4>PostgreSQL</h4> +<p>PostgreSQL 7 and 8 accepts connections using: </p> +<p>a. the standard connection string:</p> +<pre> $conn = ADONewConnection('postgres'); <br> $conn->PConnect('host=localhost port=5432 dbname=mary');</pre> +<p> b. the classical 4 parameters:</p> + <pre> $conn->PConnect('localhost','userid','password','database');<br> </pre> +<p>c. dsn: +</p><pre> $dsn = 'postgres://user:pwd@localhost/mydb?persist'; # persist is optional + $conn = ADONewConnection($dsn); # no need for Connect/PConnect<br></pre> +<a name="ldap"></a> + + <h4>LDAP</h4> + <p>Here is an example of querying a LDAP server. Thanks to Josh Eldridge for the driver and this example: +</p><pre> +require('/path/to/adodb.inc.php'); + +/* Make sure to set this BEFORE calling Connect() */ +$LDAP_CONNECT_OPTIONS = Array( + Array ("OPTION_NAME"=>LDAP_OPT_DEREF, "OPTION_VALUE"=>2), + Array ("OPTION_NAME"=>LDAP_OPT_SIZELIMIT,"OPTION_VALUE"=>100), + Array ("OPTION_NAME"=>LDAP_OPT_TIMELIMIT,"OPTION_VALUE"=>30), + Array ("OPTION_NAME"=>LDAP_OPT_PROTOCOL_VERSION,"OPTION_VALUE"=>3), + Array ("OPTION_NAME"=>LDAP_OPT_ERROR_NUMBER,"OPTION_VALUE"=>13), + Array ("OPTION_NAME"=>LDAP_OPT_REFERRALS,"OPTION_VALUE"=>FALSE), + Array ("OPTION_NAME"=>LDAP_OPT_RESTART,"OPTION_VALUE"=>FALSE) +); +$host = 'ldap.baylor.edu'; +$ldapbase = 'ou=People,o=Baylor University,c=US'; + +$ldap = NewADOConnection( 'ldap' ); +$ldap->Connect( $host, $user_name='', $password='', $ldapbase ); + +echo "<pre>"; + +print_r( $ldap->ServerInfo() ); +$ldap->SetFetchMode(ADODB_FETCH_ASSOC); +$userName = 'eldridge'; +$filter="(|(CN=$userName*)(sn=$userName*)(givenname=$userName*)(uid=$userName*))"; + +$rs = $ldap->Execute( $filter ); +if ($rs) + while ($arr = $rs->FetchRow()) { + print_r($arr); + } + +$rs = $ldap->Execute( $filter ); +if ($rs) + while (!$rs->EOF) { + print_r($rs->fields); + $rs->MoveNext(); + } + +print_r( $ldap->GetArray( $filter ) ); +print_r( $ldap->GetRow( $filter ) ); + +$ldap->Close(); +echo "</pre>"; +</pre> +<p>Using DSN: +<pre> +$dsn = "ldap://ldap.baylor.edu/ou=People,o=Baylor University,c=US"; +$db = NewADOConnection($dsn); +</pre> +<h4>Interbase/Firebird</h4> +You define the database in the $host parameter: +<pre> $conn =ADONewConnection('ibase'); <br> $conn->PConnect('localhost:c:\ibase\employee.gdb','sysdba','masterkey');<br></pre> +<p>Or dsn: +</p><pre> $dsn = 'firebird://user:pwd@localhost/mydb?persist&dialect=3'; # persist is optional<br> $conn = ADONewConnection($dsn); # no need for Connect/PConnect<br></pre> +<h4>SQLite</h4> +Sqlite will create the database file if it does not exist. +<pre> $conn =ADONewConnection('sqlite'); + $conn->PConnect('c:\path\to\sqlite.db'); # sqlite will create if does not exist<br></pre> +<p>Or dsn: +</p><pre> $path = urlencode('c:\path\to\sqlite.db'); + $dsn = "sqlite://$path/?persist"; # persist is optional + $conn = ADONewConnection($dsn); # no need for Connect/PConnect<br></pre> +<h4>Oracle (oci8)</h4> +<p>With oci8, you can connect in multiple ways. Note that oci8 works fine with +newer versions of the Oracle, eg. 9i and 10g.</p> +<p>a. PHP and Oracle reside on the same machine, use default SID.</p> +<pre> $conn->Connect(false, 'scott', 'tiger');</pre> +<p>b. TNS Name defined in tnsnames.ora (or ONAMES or HOSTNAMES), eg. 'myTNS'</p> +<pre> $conn->PConnect(false, 'scott', 'tiger', 'myTNS');</pre> +<p>or</p> +<pre> $conn->PConnect('myTNS', 'scott', 'tiger');</pre> +<p>c. Host Address and SID</p> +<pre> + $conn->connectSID = true; + $conn->Connect('192.168.0.1', 'scott', 'tiger', 'SID');</pre> +<p>d. Host Address and Service Name</p> +<pre> $conn->Connect('192.168.0.1', 'scott', 'tiger', 'servicename');</pre> +<p>e. Oracle connection string: +</p><pre> $cstr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)(PORT=$port))<br> (CONNECT_DATA=(SID=$sid)))";<br> $conn->Connect($cstr, 'scott', 'tiger');<br></pre> +<p>f. ADOdb dsn: +</p><pre> $dsn = 'oci8://user:pwd@tnsname/?persist'; # persist is optional<br> $conn = ADONewConnection($dsn); # no need for Connect/PConnect<br> <br> $dsn = 'oci8://user:pwd@host/sid';<br> $conn = ADONewConnection($dsn);<br> <br> $dsn = 'oci8://user:pwd@/'; # oracle on local machine<br> $conn = ADONewConnection($dsn);<br></pre> +<p>You can also set the charSet for Oracle 9.2 and later, supported since PHP 4.3.2, ADOdb 4.54: +</p><pre> $conn->charSet = 'we8iso8859p1';<br> $conn->Connect(...);<br> <br> # or<br> $dsn = 'oci8://user:pwd@tnsname/?charset=WE8MSWIN1252';<br> $db = ADONewConnection($dsn);<br></pre> +<a name="dsnless"></a> +<h4>DSN-less ODBC ( Access, MSSQL and DB2 examples)</h4> +<p>ODBC DSN's can be created in the ODBC control panel, or you can use a DSN-less + connection.To use DSN-less connections with ODBC you need PHP 4.3 or later. +</p> +<p>For Microsoft Access:</p> +<pre> $db = ADONewConnection('access');<br> $dsn = <strong>"Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\\northwind.mdb;Uid=Admin;Pwd=;";</strong> + $db->Connect($dsn); +</pre> +For Microsoft SQL Server: +<pre> $db = ADONewConnection('odbc_mssql');<br> $dsn = <strong>"Driver={SQL Server};Server=localhost;Database=northwind;"</strong>;<br> $db->Connect($dsn,'userid','password');<br></pre> +or if you prefer to use the mssql extension (which is limited to mssql 6.5 functionality): +<pre> $db = ADONewConnection('mssql');<br> $db->Execute('localhost', 'userid', 'password', 'northwind');<br></pre> +For DB2: +<pre> + $dbms = 'db2'; # or 'odbc_db2' if db2 extension not available + $db = ADONewConnection($dbms); + $dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP;". + "uid=root; pwd=secret";<br> $db->Connect($dsn); +</pre> +<b>DSN-less Connections with ADO</b><br> +If you are using versions of PHP earlier than PHP 4.3.0, DSN-less connections +only work with Microsoft's ADO, which is Microsoft's COM based API. An example +using the ADOdb library and Microsoft's ADO: +<pre><?php<br> include('adodb.inc.php'); <br> $db =ADONewConnection("ado_mssql");<br> print "<h1>Connecting DSN-less $db->databaseType...</h1>";<br> <br> <b>$myDSN="PROVIDER=MSDASQL;DRIVER={SQL Server};"<br> . "SERVER=flipper;DATABASE=ai;UID=sa;PWD=;" ;</b> + $db->Connect($myDSN); + + $rs = $db->Execute("select * from table"); + $arr = $rs->GetArray(); + print_r($arr); +?> +</pre><a name="speed"></a> +<h2>High Speed ADOdb - tuning tips</h2> +<p>ADOdb is a big class library, yet it <a href="http://phplens.com/lens/adodb/">consistently beats</a> all other PHP class + libraries in performance. This is because it is designed in a layered fashion, + like an onion, with the fastest functions in the innermost layer. Stick to the + following functions for best performance:</p> +<table align="center" border="1" width="40%"> + <tbody><tr> + <td><div align="center"><b>Innermost Layer</b></div></td> + </tr> + <tr> + <td><p align="center">Connect, PConnect, NConnect<br> + Execute, CacheExecute<br> + SelectLimit, CacheSelectLimit<br> + MoveNext, Close <br> + qstr, Affected_Rows, Insert_ID</p></td> + </tr> +</tbody></table> +<p>The fastest way to access the field data is by accessing the array $recordset->fields + directly. Also set the global variables <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a> + = ADODB_FETCH_NUM, and (for oci8, ibase/firebird and odbc) <a href="#adodb_countrecs">$ADODB_COUNTRECS</a> = false + before you connect to your database.</p> +<p>Consider using bind parameters if your database supports it, as it improves + query plan reuse. Use ADOdb's performance tuning system to identify bottlenecks + quickly. At the time of writing (Dec 2003), this means oci8 and odbc drivers.</p> + <p>Lastly make sure you have a PHP accelerator cache installed such as APC, Turck + MMCache, Zend Accelerator or ionCube.</p> + <p>Some examples:</p> + <table align="center" border="1"><tbody><tr><td><b>Fastest data retrieval using PHP</b></td><td><b>Fastest data retrieval using ADOdb extension</b></td></tr> +<tr><td> +<pre>$rs = $rs->Execute($sql);<br>while (!$rs->EOF) {<br> var_dump($rs->fields);<br> $rs->MoveNext();<br>}</pre></td><td> +<pre>$rs = $rs->Execute($sql);<br>$array = adodb_getall($rs);<br>var_dump($array);<br><br><br></pre></td></tr></tbody></table> + <p><b>Advanced Tips</b> + </p><p>If you have the <a href="http://adodb.sourceforge.net/#extension">ADOdb C extension</a> installed, + you can replace your calls to $rs->MoveNext() with adodb_movenext($rs). + This doubles the speed of this operation. For retrieving entire recordsets at once, +use GetArray(), which uses the high speed extension function adodb_getall($rs) internally. + </p><p>Execute() is the default way to run queries. You can use the low-level functions _Execute() and _query() +to reduce query overhead. Both these functions share the same parameters as Execute(). +</p><p>If you do not have any bind parameters or your database supports +binding (without emulation), +then you can call _Execute() directly. Calling this function bypasses +bind emulation. Debugging is still supported in _Execute(). +</p><p>If you do not require debugging facilities nor emulated +binding, and do not require a recordset to be returned, then you can +call _query. This is great for inserts, updates and deletes. Calling +this function +bypasses emulated binding, debugging, and recordset handling. Either +the resultid, true or false are returned by _query(). </p><p>For Informix, you can disable scrollable cursors with $db->cursorType = 0. +</p><p><a name="hack"></a> </p> +<h2>Hacking ADOdb Safely</h2> +<p>You might want to modify ADOdb for your own purposes. Luckily you can +still maintain backward compatibility by sub-classing ADOdb and using the $ADODB_NEWCONNECTION +variable. $ADODB_NEWCONNECTION allows you to override the behaviour of ADONewConnection(). +ADOConnection() checks for this variable and will call +the function-name stored in this variable if it is defined. +</p><p>In the following example, new functionality for the connection object +is placed in the <i>hack_mysql</i> and <i>hack_postgres7</i> classes. The recordset class naming convention +can be controlled using $rsPrefix. Here we set it to 'hack_rs_', which will make ADOdb use +<i>hack_rs_mysql</i> and <i>hack_rs_postgres7</i> as the recordset classes. + + +</p><pre>class hack_mysql extends adodb_mysql {<br>var $rsPrefix = 'hack_rs_';<br> /* Your mods here */<br>}<br><br>class hack_rs_mysql extends ADORecordSet_mysql {<br> /* Your mods here */<br>}<br><br>class hack_postgres7 extends adodb_postgres7 {<br>var $rsPrefix = 'hack_rs_';<br> /* Your mods here */<br>}<br><br>class hack_rs_postgres7 extends ADORecordSet_postgres7 {<br> /* Your mods here */<br>}<br><br>$ADODB_NEWCONNECTION = 'hack_factory';<br><br>function hack_factory($driver)<br>{<br> if ($driver !== 'mysql' && $driver !== 'postgres7') return false;<br> <br> $driver = 'hack_'.$driver;<br> $obj = new $driver();<br> return $obj;<br>}<br><br>include_once('adodb.inc.php');<br></pre> +<p></p><p>Don't forget to call the constructor of the parent class in +your constructor. If you want to use the default ADOdb drivers return +false in the above hack_factory() function. + Also you can define your own ADORecordSet_empty() class, by defining a class $$this->rsPrefix.'empty' since 4.96/5.02. +<a name="php5"></a> +</p><h2>PHP5 Features</h2> + ADOdb 4.02 or later will transparently determine which version of PHP you are using. +If PHP5 is detected, the following features become available: +<ul> + +<li><b>PDO</b>: PDO drivers are available. See the <a href=#pdo>connection examples</a>. Currently PDO drivers are + not as powerful as native drivers, and should be treated as experimental.<br><br> +<a name="php5iterators"></a> +<li><b>Foreach iterators</b>: This is a very natural way of going through a recordset: +<pre> $ADODB_FETCH_MODE = ADODB_FETCH_NUM;<br> $rs = $db->Execute($sql);<br> foreach($rs as $k =gt; $row) {<br> echo "r1=".$row[0]." r2=".$row[1]."<br>";<br> }<br></pre> +<p> +<a name="php5exceptions"></a> +</p></li><li><b>Exceptions</b>: Just include <i>adodb-exceptions.inc.php</i> and you can now +catch exceptions on errors as they occur. +<pre> <b>include("../adodb-exceptions.inc.php");</b> <br> include("../adodb.inc.php"); <br> try { <br> $db = NewADOConnection("oci8"); <br> $db->Connect('','scott','bad-password'); <br> } catch (exception $e) { <br> var_dump($e); <br> adodb_backtrace($e->gettrace());<br> } <br></pre> +<p>Note that reaching EOF is <b>not</b> considered an error nor an exception. +</p></li></ul> +<h3><a name="drivers"></a>Databases Supported</h3> +The <i>name</i> below is the value you pass to NewADOConnection($name) to create a connection object for that database. +<p> +</p><p> +</p><table border="1" width="100%"> + <tbody><tr valign="top"> + <td><b>Name</b></td> + <td><b>Tested</b>... [truncated message content] |
From: <fan...@us...> - 2008-02-07 20:43:39
|
Revision: 4856 http://linpha.svn.sourceforge.net/linpha/?rev=4856&view=rev Author: fangehrn Date: 2008-02-07 12:43:31 -0800 (Thu, 07 Feb 2008) Log Message: ----------- 2008-02-07 flo * AdoDB updated to version 503 * fixed adodb error handler Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/lib/classes/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.functions.php trunk/linpha2/lib/classes/linpha.sql.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/ChangeLog 2008-02-07 20:43:31 UTC (rev 4856) @@ -1,4 +1,7 @@ +2008-02-07 flo + * AdoDB updated to version 503 + * fixed adodb error handler 2008-02-06 flo * common.php/linpha.class.php Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/docs/dev/TODO.txt 2008-02-07 20:43:31 UTC (rev 4856) @@ -24,8 +24,6 @@ - should enable browsers cache for the thumbnails and maybe also for the images -- fix (adodb) error handler - - compress javascripts (prototype and scriptaculous) they are now nearly 200KB big @@ -85,7 +83,7 @@ ############################################################################ Open questions ############################################################################ - + - thumbnail size, set a max size (for example 150px), to be able to switch the size on fly @@ -110,6 +108,8 @@ DONE ############################################################################ +- fix (adodb) error handler + - php session limit the session cookie not only to domain, but also to full url path we cannot use the same session in localhost/linpha1.0 and localhost/linpha2.0 Modified: trunk/linpha2/lib/classes/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/lib/classes/adodb-errorhandler.inc.php 2008-02-07 20:43:31 UTC (rev 4856) @@ -30,13 +30,13 @@ */ function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection) { - if (error_reporting() == 0) return; // obey @ protocol + //if (error_reporting() == 0) return; // obey @ protocol switch($fn) { case 'EXECUTE': $sql = $p1; $inputparams = $p2; - $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")\n"; + $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")"; break; case 'PCONNECT': @@ -44,10 +44,10 @@ $host = $p1; $database = $p2; - $s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)\n"; + $s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)"; break; default: - $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n"; + $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)"; break; } /* @@ -64,16 +64,26 @@ * and optionally, port number, of the socket receiving the debug information. * 3 message is appended to the file destination */ - if (defined('ADODB_ERROR_LOG_TYPE')) { + /*if (defined('ADODB_ERROR_LOG_TYPE')) { $t = date('Y-m-d H:i:s'); if (defined('ADODB_ERROR_LOG_DEST')) error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST); else error_log("($t) $s", ADODB_ERROR_LOG_TYPE); - } + }*/ //print "<p>$s</p>"; - trigger_error($s,ADODB_ERROR_HANDLER_TYPE); + //trigger_error($s,ADODB_ERROR_HANDLER_TYPE); + + /** + * if adodb errorhandler is used, the function $db->ErrorMsg() does not work + * anymore + * -> output the error to screen + * -> no need anymore for : + * if(!$create) { echo $GLOBALS['db']->ErrorMsg().'<br />'; } + */ + echo $s.'<br />'; + linLog(LOG_TYPE_DB, LOG_ERR, 'adodb', $s); } ?> Modified: trunk/linpha2/lib/classes/linpha.functions.php =================================================================== --- trunk/linpha2/lib/classes/linpha.functions.php 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/lib/classes/linpha.functions.php 2008-02-07 20:43:31 UTC (rev 4856) @@ -594,9 +594,11 @@ /** * don't trust $text (contains $_GET and $_POST data) * see also linpha advisory http://secunia.com/advisories/18808/ - * and for more details http://retrogod.altervista.org/linpha_10_local.html + * and for more details http://retrogod.altervista.org/linpha_10_local.html + * + * still use this even if file has a random name, its to dangerous to */ - $text = htmlspecialchars($text, ENT_QUOTES); + $text = htmlentities($text, ENT_QUOTES); /** * Process Log Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-07 20:22:33 UTC (rev 4855) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2008-02-07 20:43:31 UTC (rev 4856) @@ -46,6 +46,7 @@ if(isset($_SESSION['installmode1'])) { + include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); $db_type = $_SESSION['sql_dbtype']; $db_hostname = $_SESSION['sql_hostname']; $db_username = $_SESSION['sql_username']; @@ -56,9 +57,9 @@ } else { - error_reporting(0); - include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); - + error_reporting(0); + include_once(LINPHA_DIR.'/lib/classes/adodb-errorhandler.inc.php'); + /** * if this file does not exists we already switch to installer */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |