[Linpha-cvs] SF.net SVN: linpha: [4512] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2006-04-12 12:45:05
|
Revision: 4512 Author: bzrudi Date: 2006-04-12 05:44:38 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4512&view=rev Log Message: ----------- added basic support for ORACLE XE Database Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/install/step11_finish.php trunk/linpha2/install/step3_dbtype.php trunk/linpha2/install/step5_getlogin.php trunk/linpha2/install/step6_selectdatabase.php trunk/linpha2/install/step7_selectprefix.php trunk/linpha2/install/step9_createtables.php trunk/linpha2/lib/classes/linpha.sql.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-11 08:43:29 UTC (rev 4511) +++ trunk/linpha2/ChangeLog 2006-04-12 12:44:38 UTC (rev 4512) @@ -1,3 +1,8 @@ +2006-04-12 bzrudi <linpha2_AT_tuxpower_DOT_de> + * Installer: + - added support for ORACLE XE Database - at least tables are created + and autoincrement works for now ;-) + 2006-04-11 bzrudi <linpha2_AT_tuxpower_DOT_de> * DB fetch mode is now set to ADODB_FETCH_ASSOC by default, so no need for fetchRow(ADODB_FETCH_ASSOC) any more. If you need to fetch NUM, use this Modified: trunk/linpha2/install/step11_finish.php =================================================================== --- trunk/linpha2/install/step11_finish.php 2006-04-11 08:43:29 UTC (rev 4511) +++ trunk/linpha2/install/step11_finish.php 2006-04-12 12:44:38 UTC (rev 4512) @@ -63,7 +63,7 @@ { echo failed_msg(); } else { - $userid = $GLOBALS['linpha']->db->Insert_ID(); + $userid = $GLOBALS['linpha']->db->PO_Insert_ID(PREFIX."users", "id"); /** * adding user to group 'admin' Modified: trunk/linpha2/install/step3_dbtype.php =================================================================== --- trunk/linpha2/install/step3_dbtype.php 2006-04-11 08:43:29 UTC (rev 4511) +++ trunk/linpha2/install/step3_dbtype.php 2006-04-12 12:44:38 UTC (rev 4512) @@ -63,8 +63,15 @@ if(function_exists('sqlite_open')) { $supported_db['sqlite'] = 1; } +if(function_exists('oci_connect')) { + $supported_db['oci8'] = 1; +} /** + * @todo run thru foreach + */ + +/** * define disabled and checked variables */ if(! isset($supported_db['mysql'])) @@ -85,12 +92,20 @@ } else { $disabled_sqlite = ''; } + if(! isset($supported_db['oci8'])) + { + $disabled_oci8 = ' disabled="disabled"'; + } else { + $disabled_oci8 = ''; + } $checked_mysql = ''; $checked_postgres = ''; $checked_sqlite = ''; + $checked_oci8 = ''; + if(isset($_SESSION['sql_dbtype'])) { switch($_SESSION['sql_dbtype']) @@ -98,6 +113,7 @@ case "mysql": $checked_mysql = ' checked="checked"'; break; case "postgres": $checked_postgres = ' checked="checked"'; break; case "sqlite": $checked_sqlite = ' checked="checked"'; break; + case "oci8": $checked_oci8 = ' checked="checked"'; break; } } else { $checked_mysql = ' checked="checked"'; @@ -131,7 +147,18 @@ { echo '<b>'.tr("No Support In PHP Config (php.ini)");'</b><br />'; } +?> +<br /> + +<input type='radio' name='sql_dbtype' value='oci8'<?php echo $disabled_oci8; ?> +<?php echo $checked_oci8; ?>>Oracle<br /> +<?php +if(!isset($supported_db['oci8'])) +{ + echo '<b>'.tr("No Support In PHP Config (php.ini)");'</b><br />'; +} + ?> <br /><br /> <h1><?php echo tr("Select Installation Mode"); ?></h1> Modified: trunk/linpha2/install/step5_getlogin.php =================================================================== --- trunk/linpha2/install/step5_getlogin.php 2006-04-11 08:43:29 UTC (rev 4511) +++ trunk/linpha2/install/step5_getlogin.php 2006-04-12 12:44:38 UTC (rev 4512) @@ -215,6 +215,11 @@ "from commandline before you proceed.")."<br /><br />"; $_SESSION['sql_dbport'] = '5432'; } +elseif($_SESSION['sql_dbtype'] == 'oci8') +{ + echo tr("WOW, playing with the big ones"); + $_SESSION['sql_dbport'] = '1521'; +} ?> <div class="boxalign"> Modified: trunk/linpha2/install/step6_selectdatabase.php =================================================================== --- trunk/linpha2/install/step6_selectdatabase.php 2006-04-11 08:43:29 UTC (rev 4511) +++ trunk/linpha2/install/step6_selectdatabase.php 2006-04-12 12:44:38 UTC (rev 4512) @@ -101,6 +101,10 @@ case "postgres": $_SESSION['allowed_to_create_db'] = false; break; +case "oci8": + $_SESSION['allowed_to_create_db'] = false; +break; + // case "sqlite": sqlite goes directly to stage8 } Modified: trunk/linpha2/install/step7_selectprefix.php =================================================================== --- trunk/linpha2/install/step7_selectprefix.php 2006-04-11 08:43:29 UTC (rev 4511) +++ trunk/linpha2/install/step7_selectprefix.php 2006-04-12 12:44:38 UTC (rev 4512) @@ -200,6 +200,24 @@ } } break; +case "oci8": + include_once('../lib/adodb/adodb.inc.php'); + $link = NewADOConnection('oci8'); + $link ->connect($_SESSION['sql_hostname'].":".$_SESSION['sql_dbport'], $_SESSION['sql_username'], $_SESSION['sql_password'], $_SESSION['sql_dbname']); + if (!$link) + { + echo failed_msg(); + echo "<br />".tr("Error Connecting To Server").":"; + $error_nr = 2; + } + else + { + echo success_msg(); + $link->close(); + } + +break; + } if(isset($error_nr)) Modified: trunk/linpha2/install/step9_createtables.php =================================================================== --- trunk/linpha2/install/step9_createtables.php 2006-04-11 08:43:29 UTC (rev 4511) +++ trunk/linpha2/install/step9_createtables.php 2006-04-12 12:44:38 UTC (rev 4512) @@ -57,7 +57,7 @@ /** * finally create tables */ - echo tr("Creating Tables")."... "; + echo tr("Creating Tables")."...<br /> "; $translation_array = array_keys($linpha_tables); // only used in error case while( list($key,$query) = each($sql_tables) ) @@ -71,6 +71,46 @@ $error_nr = 1; } } + /** + * take care of oracle seqeunces and triggers + */ + if($_SESSION['sql_dbtype'] == 'oci8') + { + + echo tr("Creating Sequences")."...<br /> "; + + /** + * create sequences + */ + while( list($key, $query) = each($sql_sequence) ) + { + $result = $linpha->db->Execute($query); + if(!$result) + { + echo tr("Failed To Create Sequence for [$key]."); + echo failed_msg(); + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } + } + + /** + * create triggers + */ + echo tr("Creating Triggers")."...<br /> "; + while( list($key, $query) = each($sql_trigger) ) + { + $result = $linpha->db->Execute($query); + if(!$result) + { + echo tr("Failed To Create Trigger for [$key]."); + echo failed_msg(); + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } + } + } + if(!isset($error_nr)) { echo success_msg(); Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-11 08:43:29 UTC (rev 4511) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2006-04-12 12:44:38 UTC (rev 4512) @@ -41,10 +41,6 @@ */ function dbConnect() { - /** - * set adodb global default to fetch ASSOC - */ - $ADODB_FETCH_MODE = 'ADODB_FETCH_ASSOC'; if(isset($_SESSION['installmode1'])) { @@ -77,8 +73,19 @@ define('PREFIX', $db_prefix); define('DB_TYPE', $db_type); - + /** + * set adodb global default to fetch ASSOC + */ + if(DB_TYPE == 'oci8') + { + $ADODB_FETCH_MODE = 'ADODB_FETCH_BOTH'; + } + else + { + $ADODB_FETCH_MODE = 'ADODB_FETCH_ASSOC'; + } + /** * connect to db and check if connection was succesfull */ include_once(LINPHA_DIR.'/lib/adodb/adodb.inc.php'); @@ -116,6 +123,12 @@ break; } + case "oci8": + { + $GLOBALS['linpha']->db->Connect($db_hostname, $db_username, $db_password, $db_name); + + break; + } } if( !isset($GLOBALS['linpha']->db) OR !$GLOBALS['linpha']->db->isConnected() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |