Rev 360 | Rev 511 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 360 | Rev 386 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | * See the License for the specific language governing permissions and |
16 | * See the License for the specific language governing permissions and |
17 | * limitations under the License. |
17 | * limitations under the License. |
18 | */ |
18 | */ |
19 | 19 | ||
20 | // DATABASE UPDATE 203 -> 204 |
20 | /** |
21 | // This script will be included by OIDplusDatabaseConnection.class.php inside function afterConnect(). |
21 | * This function will be called by OIDplusDatabaseConnection.class.php at method afterConnect(). |
22 | // Parameters: $this is the OIDplusDatabaseConnection class |
22 | * @param OIDplusDatabaseConnection $db is the OIDplusDatabaseConnection class |
23 | // $version is the current version (this script MUST increase the number by 1 when it is done) |
23 | * @param string $version is the current version (this script MUST increase the number by 1 when it is done) |
- | 24 | * @throws OIDplusException |
|
24 | 25 | */ |
|
25 | if (!isset($version)) throw new OIDplusException(_L('Argument "%1" is missing; was the file included in a wrong way?','version')); |
26 | function oidplus_dbupdate_203_204(OIDplusDatabaseConnection $db, string &$version) { |
26 | if (!isset($this)) throw new OIDplusException(_L('Argument "%1" is missing; was the file included in a wrong way?','this')); |
- | |
27 | - | ||
28 | if ($this->transaction_supported()) $this->transaction_begin(); |
27 | if ($db->transaction_supported()) $db->transaction_begin(); |
29 | 28 | ||
30 | if ($this->getSlang()::id() == 'mssql') { |
29 | if ($db->getSlang()::id() == 'mssql') { |
31 | $this->query("ALTER TABLE ###log_object ADD severity [int]"); |
30 | $db->query("ALTER TABLE ###log_object ADD severity [int]"); |
32 | $this->query("ALTER TABLE ###log_user ADD severity [int]"); |
31 | $db->query("ALTER TABLE ###log_user ADD severity [int]"); |
33 | } |
32 | } |
34 | else if ($this->getSlang()::id() == 'mysql') { |
33 | else if ($db->getSlang()::id() == 'mysql') { |
35 | $this->query("ALTER TABLE ###log_object ADD severity int(11)"); |
34 | $db->query("ALTER TABLE ###log_object ADD severity int(11)"); |
36 | $this->query("ALTER TABLE ###log_user ADD severity int(11)"); |
35 | $db->query("ALTER TABLE ###log_user ADD severity int(11)"); |
37 | } |
36 | } |
38 | else if ($this->getSlang()::id() == 'pgsql') { |
37 | else if ($db->getSlang()::id() == 'pgsql') { |
39 | $this->query("ALTER TABLE ###log_object ADD severity integer"); |
38 | $db->query("ALTER TABLE ###log_object ADD severity integer"); |
40 | $this->query("ALTER TABLE ###log_user ADD severity integer"); |
39 | $db->query("ALTER TABLE ###log_user ADD severity integer"); |
41 | } |
40 | } |
42 | else if ($this->getSlang()::id() == 'sqlite') { |
41 | else if ($db->getSlang()::id() == 'sqlite') { |
43 | $this->query("ALTER TABLE ###log_object ADD severity integer"); |
42 | $db->query("ALTER TABLE ###log_object ADD severity integer"); |
44 | $this->query("ALTER TABLE ###log_user ADD severity integer"); |
43 | $db->query("ALTER TABLE ###log_user ADD severity integer"); |
45 | } |
44 | } |
46 | 45 | ||
47 | $version = 204; |
46 | $version = 204; |
48 | $this->query("UPDATE ###config SET value = ? WHERE name = 'database_version'", array($version)); |
47 | $db->query("UPDATE ###config SET value = ? WHERE name = 'database_version'", array($version)); |
49 | 48 | ||
50 | if ($this->transaction_supported()) $this->transaction_commit(); |
- | |
51 | 49 | if ($db->transaction_supported()) $db->transaction_commit(); |
|
- | 50 | } |
|
- | 51 | ||
52 | 52 |