Skip to content

Commit 1ea10aa

Browse files
author
rkr
committed
- Minor fix
1 parent 24b6128 commit 1ea10aa

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed

src/Databases/MySQL.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ public function quoteExpression($expression, array $arguments = array()) {
136136
$idx++;
137137
$index = $idx;
138138

139-
if(substr($oldValue[0], 0, 1) == ':') {
140-
$index = (int) substr($oldValue[0], 1);
141-
}
142-
143139
if(array_key_exists($index, $arguments)) {
144140
$argument = $arguments[$index];
145141
$value = $this->quote($argument);
@@ -148,7 +144,7 @@ public function quoteExpression($expression, array $arguments = array()) {
148144
}
149145
return $value;
150146
};
151-
$result = preg_replace_callback('/(\\?|:\\d+)/', $func, $expression);
147+
$result = preg_replace_callback('/(\\?)/', $func, $expression);
152148
return (string) $result;
153149
}
154150

tests/Builder/InsertTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,6 @@ public function testExprWithParams() {
147147
->updateExpr('b=?', 'b')
148148
->addOrUpdateExpr('c=?', 'c')
149149
->asString();
150-
$this->assertEquals("INSERT INTO\n\ttest\nSET\n\ta='a',\n\tb='b'\n", $sql);
150+
$this->assertEquals("INSERT INTO\n\ttest\nSET\n\ta='a',\n\tc='c'\nON DUPLICATE KEY UPDATE\n\tb='b',\n\tc='c'\n", $sql);
151151
}
152152
}

tests/Builder/SelectTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ public function testWhere() {
6363
->where('a < ?', 1000)
6464
->asString();
6565
$this->assertEquals("SELECT\n\ta\nFROM\n\ttest t\nWHERE\n\t(a < '1000')\n", $str);
66-
67-
$str = TestSelect::create()
68-
->field('a')
69-
->from('t', 'test')
70-
->where('a < :0', 1000)
71-
->asString();
72-
$this->assertEquals("SELECT\n\ta\nFROM\n\ttest t\nWHERE\n\t(a < '1000')\n", $str);
7366
}
7467

7568
public function testHaving() {

0 commit comments

Comments
 (0)