DB::parse() lets you generate queries without running them

This commit is contained in:
Sergey Tsalkov
2021-06-16 22:11:13 +00:00
parent c0f3a7f31d
commit 20c7acd8a4
2 changed files with 11 additions and 0 deletions

View File

@@ -413,6 +413,12 @@ class BasicTest extends SimpleTest {
$this->assert($count === '0');
}
function test_10_parse() {
$parsed_query = DB::parse("SELECT * FROM %b WHERE id=%i AND name=%s", 'accounts', 5, 'Joe');
$correct_query = "SELECT * FROM `accounts` WHERE id=5 AND name='Joe'";
$this->assert($parsed_query === $correct_query);
}
}