diff options
| author | Christian Fowler <spider@viovio.com> | 2008-11-15 07:20:21 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2008-11-15 07:20:21 +0000 |
| commit | 000737ebe7b29559db63b742de52876c36cd59c8 (patch) | |
| tree | de60d29f3897756a5435aa3fb5412d695df3505a /BitInstaller.php | |
| parent | 6754dd921c26701127c82535527ee137e38b8997 (diff) | |
| download | install-000737ebe7b29559db63b742de52876c36cd59c8.tar.gz install-000737ebe7b29559db63b742de52876c36cd59c8.tar.bz2 install-000737ebe7b29559db63b742de52876c36cd59c8.zip | |
tuneup getTablePrefix, convertQuery to remove unnecessary ticks, etc.
Diffstat (limited to 'BitInstaller.php')
| -rw-r--r-- | BitInstaller.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/BitInstaller.php b/BitInstaller.php index e839f72..3b84e54 100644 --- a/BitInstaller.php +++ b/BitInstaller.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_install/BitInstaller.php,v 1.46 2008/10/31 08:12:23 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_install/BitInstaller.php,v 1.47 2008/11/15 07:20:21 spiderr Exp $ * @package install */ @@ -230,16 +230,17 @@ class BitInstaller extends BitSystem { case "oci8": case "postgres": // Do a little prep work for postgres, no break, cause we want default case too - $ret = preg_replace( '/`/', '"', BIT_DB_PREFIX ); if( preg_match( '/\./', $ret ) ) { // Assume we want to dump in a schema, so set the search path and nuke the prefix here. - $schema = substr( $ret, 0, strpos( $ret, '.' )); + $schema = preg_replace( '/`/', '"', substr( $ret, 0, strpos( $ret, '.' )) ); $quote = strpos( $schema, '"' ); if( $quote !== 0 ) { $schema = '"'.$schema; } - $result = $this->mDb->query( "CREATE SCHEMA $schema" ); + // set scope to current schema $result = $this->mDb->query( "SET search_path TO $schema" ); + // return everything after the prefix + $ret = substr( BIT_DB_PREFIX, strrpos( BIT_DB_PREFIX, '`' ) + 1 ); } break; } @@ -340,6 +341,7 @@ class BitInstaller extends BitSystem { foreach( $dd as $alter ) { foreach( array_keys( $alter ) as $tableName ) { $completeTableName = $tablePrefix.$tableName; + $this->mDb->convertQuery( $completeTableName ); foreach( $alter[$tableName] as $from => $flds ) { if( is_string( $flds )) { $sql = $dict->ChangeTableSQL( $completeTableName, $flds ); @@ -347,6 +349,12 @@ class BitInstaller extends BitSystem { $sql = $dict->ChangeTableSQL( $completeTableName, array( $flds )); } + if( $sql ) { + for( $sqlIdx = 0; $sqlIdx < count( $sql ); $sqlIdx++ ) { + $this->mDb->convertQuery( $sqlFoo ); + } + } + if( $sql && $dict->ExecuteSQLArray( $sql, FALSE ) > 0 ) { } else { $errors[] = 'Failed to alter '.$completeTableName.' -> '.$alter[$tableName]; |
