diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-04-11 17:01:06 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-04-11 17:01:06 +0100 |
commit | 32c59705844af149a3b9fa29d82b7579f4536c42 (patch) | |
tree | 55409281a42ed34c41319c965eb8161318638398 /tools | |
parent | 2d8a08de123cb93d21bd7015d90b8e5887e2ed54 (diff) | |
download | prosody-32c59705844af149a3b9fa29d82b7579f4536c42.tar.gz prosody-32c59705844af149a3b9fa29d82b7579f4536c42.zip |
tools/migration/migrator/prosody_sql.lua: Fix compatibility with PostgreSQL (thanks Timo)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/migration/migrator/prosody_sql.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/migration/migrator/prosody_sql.lua b/tools/migration/migrator/prosody_sql.lua index b1f836be..50ae8c40 100644 --- a/tools/migration/migrator/prosody_sql.lua +++ b/tools/migration/migrator/prosody_sql.lua @@ -149,7 +149,11 @@ function writer(output, iter) 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 |