Skip to content

Commit

Permalink
(REVERT) Quick hack for SQL escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Mar 26, 2024
1 parent fcb5d2b commit 01318ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CRM/Core/I18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CRM_Core_I18n {
* @param string $mode
* @return string
*/
protected static function escape($text, $mode) {
public static function escape($text, $mode) {
switch ($mode) {
case 'sql':
if (self::$SQL_ESCAPER == NULL) {
Expand Down
4 changes: 2 additions & 2 deletions mixin/lib/civimix-schema/src/SqlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function generateCreateTableSql(array $entity): string {
}
$fieldSql .= self::getDefaultSql($field);
if (!empty($field['description'])) {
$fieldSql .= " COMMENT '" . \CRM_Core_DAO::escapeString($field['description']) . "'";
$fieldSql .= " COMMENT '" . \CRM_Core_I18n::escape($field['description'], 'sql') . "'";
}
$definition[] = $fieldSql;
}
Expand Down Expand Up @@ -157,7 +157,7 @@ private static function getDefaultSql(array $field): string {
$default = $field['default'];
}
else {
$default = "'" . \CRM_Core_DAO::escapeString($field['default']) . "'";
$default = "'" . \CRM_Core_I18n::escape($field['default'], 'sql') . "'";
}
return ' DEFAULT ' . $default;
}
Expand Down

0 comments on commit 01318ca

Please sign in to comment.