HaxeFoundation / record-macros

Macro-based ORM (object-relational mapping)
MIT License
49 stars 24 forks source link

fixed: string concatenation did not work with SQLite #29

Closed ProPuke closed 4 years ago

ProPuke commented 6 years ago

fixes #28

record-macros was attempting to use the MySQL CONCAT function for string concatenation, which is not supported in SQLite, resulting in sql errors.

This change switches to using the slightly more standard string concat pipe operator (||) which is supported on both platforms. However, in order to use this feature in MySQL the PIPES_AS_CONCAT sql_mode must be enabled, thus this is done automatically in sys.db.Manager.set_cnx upon MySQL assignment.

This does mean we're altering the sys.db.Connection upon assignment. Alternatively we could just use differing syntax depending on connection type, but I'm not sure the best way of performing this check within RecordMacros, as we're in compiletime land, there.

jonasmalacofilho commented 4 years ago

Thank you.