Skip to content
Snippets Groups Projects
Commit dcdabac0 authored by Jörn Friedrich Dreyer's avatar Jörn Friedrich Dreyer
Browse files

oracle does not need sequence suffix, manually set database name to allow...

oracle does not need sequence suffix, manually set database name to allow fetching db schema, don't shutdown db - we are using utf8 to connect
parent 8edb56de
No related branches found
No related tags found
No related merge requests found
...@@ -460,7 +460,7 @@ class OC_DB { ...@@ -460,7 +460,7 @@ class OC_DB {
$row = $result->fetchRow(); $row = $result->fetchRow();
self::raiseExceptionOnError($row, 'fetching row for insertid failed'); self::raiseExceptionOnError($row, 'fetching row for insertid failed');
return $row['id']; return $row['id'];
} else if( $type === 'mssql') { } else if( $type === 'mssql' || $type === 'oci') {
if($table !== null) { if($table !== null) {
$prefix = OC_Config::getValue( "dbtableprefix", "oc_" ); $prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
$table = str_replace( '*PREFIX*', $prefix, $table ); $table = str_replace( '*PREFIX*', $prefix, $table );
...@@ -594,6 +594,11 @@ class OC_DB { ...@@ -594,6 +594,11 @@ class OC_DB {
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
self::connectScheme(); self::connectScheme();
if(OC_Config::getValue('dbtype', 'sqlite')==='oci') {
//set dbname, it is unset because oci uses 'service' to connect
self::$schema->db->database_name=self::$schema->db->dsn['username'];
}
// read file // read file
$content = file_get_contents( $file ); $content = file_get_contents( $file );
...@@ -617,6 +622,12 @@ class OC_DB { ...@@ -617,6 +622,12 @@ class OC_DB {
$content = str_replace( '<default>0000-00-00 00:00:00</default>', $content = str_replace( '<default>0000-00-00 00:00:00</default>',
'<default>CURRENT_TIMESTAMP</default>', $content ); '<default>CURRENT_TIMESTAMP</default>', $content );
} }
if(OC_Config::getValue('dbtype', 'sqlite')==='oci') {
unset($previousSchema['charset']); //or MDB2 tries SHUTDOWN IMMEDIATE
$oldname = $previousSchema['name'];
$previousSchema['name']=OC_Config::getValue( "dbuser", $oldname );
//TODO check identifiers are at most 30 chars long
}
file_put_contents( $file2, $content ); file_put_contents( $file2, $content );
$op = self::$schema->updateDatabase($file2, $previousSchema, array(), false); $op = self::$schema->updateDatabase($file2, $previousSchema, array(), false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment