Closed Akdmeh closed 2 years ago
hi, yes this is a mistake https://clickhouse.tech/docs/en/sql-reference/syntax/#syntax-string-literal
UP. new result
/** @var \kak\clickhouse\Connection $clickhouse */
$clickhouse = Yii::$app->clickhouse;
$sql = $clickhouse->getQueryBuilder()
->batchInsert('test_table', ['browser_version'], [
["its '"]
]);
echo $sql;
INSERT INTO
test_table(
browser_version) VALUES ('its \'')
Yes, I've updated code from dev-master via Composer, now it's work correctly. Thank you!
Hello! I'm trying to batch insert some value with single quote sign using batchInsert command, f.e.:
What I expect? The value inside DB should be: value with single ' quote inside But instead I get: value with single '' quote inside (two single quotes in DB value!) I found in Schema.php next code:
First we doubling single quote with this code: str_replace("'", "''", $str) but after we adding backslashes to single quotes because of listing single quote sign in octal form: \047 So we get \'\' as the result, but we need \' OR '' [two single quote signs together].
I'm not so experienced in GitHub things and want to consult with you: I'm not sure, is it bug or I'm missing some important behaviour in escaping? I think the right function should be:
or
Am I right and can you fix this? Thank you a lot for this library, it's very helpful!