summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorstekule <stekule@users.noreply.github.com>2015-05-04 14:50:50 +0200
committerDamien Regad <dregad@mantisbt.org>2015-05-15 01:10:45 +0200
commit067b14d9d7e68c7dc49a1a874dd566e962eb1335 (patch)
treed8029fa163eeb7975e0dc79ce5a68c863fcf5598 /drivers
parent7b2f15bba530ce6b6357a14b8496ad2d4bd05c84 (diff)
downloadadodb-067b14d9d7e68c7dc49a1a874dd566e962eb1335.tar.gz
adodb-067b14d9d7e68c7dc49a1a874dd566e962eb1335.tar.bz2
adodb-067b14d9d7e68c7dc49a1a874dd566e962eb1335.zip
MSSQL: fix fail on insert when statement contains ';'
In mssql a tick mark (') in a value string is escaped via a second one. Therefore the number of tick marks before the semicolon must be odd (since the string starts with a tick mark). Semicolons should be allowed after an odd number of tick marks. There must be a character between the odd tick mark groups. Fixes #97, see also #96
Diffstat (limited to 'drivers')
-rw-r--r--drivers/adodb-mssqlnative.inc.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/adodb-mssqlnative.inc.php b/drivers/adodb-mssqlnative.inc.php
index e17ea5ae..2afae07d 100644
--- a/drivers/adodb-mssqlnative.inc.php
+++ b/drivers/adodb-mssqlnative.inc.php
@@ -563,7 +563,7 @@ class ADODB_mssqlnative extends ADOConnection {
$insert = false;
// handle native driver flaw for retrieving the last insert ID
- if(preg_match('/^\W*(insert [^;]+);?$/i', $sql)) {
+ if(preg_match('/^\W*insert\s(?:(?:(?:\'\')*\'[^\']+\'(?:\'\')*)|[^;\'])*;?$/i', $sql)) {
$insert = true;
$sql .= '; '.$this->identitySQL; // select scope_identity()
}