Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

PDO was not escaping strings for SET as array

  • Loading branch information...
commit a00f90c2973111f0d95ac129eba967e8269ea0d6 1 parent eae17d1
@philsturgeon philsturgeon authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  system/database/DB_forge.php
View
2  system/database/DB_forge.php
@@ -762,7 +762,7 @@ protected function _process_fields($create_table = FALSE)
$attributes['CONSTRAINT'] = $this->db->escape($attributes['CONSTRAINT']);
default:
$field['length'] = is_array($attributes['CONSTRAINT'])
- ? '('.implode(',', $attributes['CONSTRAINT']).')'
+ ? '("'.implode('","', $attributes['CONSTRAINT']).'")'
: '('.$attributes['CONSTRAINT'].')';
break;
}

4 comments on commit a00f90c

@narfbg
Owner

Shouldn't single quotes be used here? The double ones are the standard field escape character.

@philsturgeon
@narfbg
Owner

On one point I agree - It is a good starting point, indeed.:)

Otherwise, in Postgre you need to use a separate CREATE TYPE statement in order to use ENUM (no SET data type, AFAIK) and while MySQL, CUBRID and MSSQL might use backticks and square brackets, all of them can also use the double quotes (configurable). I don't know of a database that doesn't use single quotes to start and close strings. :)

356d4f4

@philsturgeon
Please sign in to comment.
Something went wrong with that request. Please try again.