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 202 -> 203 |
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_202_203(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("CREATE FUNCTION [dbo].[getOidArc] (@strList varchar(512), @maxArcLen int, @occurence int) |
30 | $db->query("CREATE FUNCTION [dbo].[getOidArc] (@strList varchar(512), @maxArcLen int, @occurence int) |
32 | RETURNS varchar(512) AS |
31 | RETURNS varchar(512) AS |
33 | BEGIN |
32 | BEGIN |
34 | DECLARE @intPos int |
33 | DECLARE @intPos int |
35 | 34 | |
|
36 | DECLARE @cnt int |
35 | DECLARE @cnt int |
Line 66... | Line 65... | ||
66 | RETURN REPLICATE('0', @maxArcLen) |
65 | RETURN REPLICATE('0', @maxArcLen) |
67 | END"); |
66 | END"); |
68 | } |
67 | } |
69 | 68 | ||
70 | $version = 203; |
69 | $version = 203; |
71 | $this->query("UPDATE ###config SET value = ? WHERE name = 'database_version'", array($version)); |
70 | $db->query("UPDATE ###config SET value = ? WHERE name = 'database_version'", array($version)); |
72 | 71 | ||
73 | if ($this->transaction_supported()) $this->transaction_commit(); |
- | |
74 | 72 | if ($db->transaction_supported()) $db->transaction_commit(); |
|
- | 73 | } |
|
- | 74 | ||
75 | 75 |