Subversion Repositories oidplus

Rev

Rev 1219 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1219 Rev 1231
Line 25... Line 25...
25
 * @return int new version set
25
 * @return int new version set
26
 * @throws \ViaThinkSoft\OIDplus\OIDplusException
26
 * @throws \ViaThinkSoft\OIDplus\OIDplusException
27
 */
27
 */
28
function oidplus_dbupdate_1001(OIDplusDatabaseConnection $db): int {
28
function oidplus_dbupdate_1001(OIDplusDatabaseConnection $db): int {
29
        if ($db->transaction_supported()) $db->transaction_begin();
29
        if ($db->transaction_supported()) $db->transaction_begin();
30
 
30
        try {
31
        // Change collation so that objects like FourCC can be case-sensitive
31
                // Change collation so that objects like FourCC can be case-sensitive
32
        if ($db->getSlang()->id() == 'mysql') {
32
                if ($db->getSlang()->id() == 'mysql') {
33
                $db->query("ALTER TABLE ###asn1id     CHANGE `oid`    `oid`    varchar(255) NOT NULL     COLLATE utf8_bin;");
33
                        $db->query("ALTER TABLE ###asn1id     CHANGE `oid`    `oid`    varchar(255) NOT NULL     COLLATE utf8_bin;");
34
                $db->query("ALTER TABLE ###iri        CHANGE `oid`    `oid`    varchar(255) NOT NULL     COLLATE utf8_bin;");
34
                        $db->query("ALTER TABLE ###iri        CHANGE `oid`    `oid`    varchar(255) NOT NULL     COLLATE utf8_bin;");
35
                $db->query("ALTER TABLE ###objects    CHANGE `id`     `id`     varchar(255) NOT NULL     COLLATE utf8_bin;");
35
                        $db->query("ALTER TABLE ###objects    CHANGE `id`     `id`     varchar(255) NOT NULL     COLLATE utf8_bin;");
Line 62... Line 62...
62
 
62
 
63
        $version = 1001;
63
                $version = 1001;
64
        $db->query("UPDATE ###config SET value = ? WHERE name = 'database_version'", array("$version"));
64
                $db->query("UPDATE ###config SET value = ? WHERE name = 'database_version'", array("$version"));
65
 
65
 
66
        if ($db->transaction_supported()) $db->transaction_commit();
66
                if ($db->transaction_supported()) $db->transaction_commit();
-
 
67
        } catch (\Exception $e) {
-
 
68
                if ($db->transaction_supported()) $db->transaction_rollback();
-
 
69
                throw new $e;
-
 
70
        }
67
 
71
 
68
        return $version;
72
        return $version;
69
}
73
}