Software /
code /
prosody
Changeset
4247:6a372135b4c4
tools/migration/migrator/prosody_sql.lua: Fix compatibility with PostgreSQL (thanks Timo)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 11 Apr 2011 17:01:06 +0100 |
parents | 4244:19c9bf88ec89 |
children | 4248:d79d1255fd40 4253:96a30cddef7a |
files | tools/migration/migrator/prosody_sql.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/migration/migrator/prosody_sql.lua Wed Apr 06 14:45:44 2011 +0100 +++ b/tools/migration/migrator/prosody_sql.lua Mon Apr 11 17:01:06 2011 +0100 @@ -149,7 +149,11 @@ assert(stmt:execute()); local stmt = assert(dbh:prepare("DELETE FROM prosody")); assert(stmt:execute()); - local insert = assert(dbh:prepare("INSERT INTO `prosody` (`host`,`user`,`store`,`key`,`type`,`value`) VALUES (?,?,?,?,?,?)")); + local insert_sql = "INSERT INTO `prosody` (`host`,`user`,`store`,`key`,`type`,`value`) VALUES (?,?,?,?,?,?)"; + if output.driver == "PostgreSQL" then + insert_sql = insert_sql:gsub("`", "\""); + end + local insert = assert(dbh:prepare(insert_sql)); return function(item) if not item then assert(dbh:commit()) return dbh:close(); end -- end of input