mod_storage_sql2, util.sql: Set character encoding on every connect
authorKim Alvefur <zash@zash.se>
Thu, 11 Dec 2014 08:18:39 +0000 (09:18 +0100)
committerKim Alvefur <zash@zash.se>
Thu, 11 Dec 2014 08:18:39 +0000 (09:18 +0100)
plugins/mod_storage_sql2.lua
util/sql.lua

index 0531c90500cc79b54c381a19b05d672219b5bbae..d5e0494faf5636f18a0dc0eb43fca331332a57b8 100644 (file)
@@ -113,8 +113,6 @@ do -- process options to get a db connection
        --local dburi = db2uri(params);
        engine = mod_sql:create_engine(params);
 
-       engine:set_encoding();
-
        if module:get_option("sql_manage_tables", true) then
                -- Automatically create table, ignore failure (table probably already exists)
                create_table();
index 5a1dda5d41d3261885a0a8f5f919b42c76bc2202..453597da3f117ded9c1f06ef4df5017afdb839eb 100644 (file)
@@ -156,6 +156,7 @@ function engine:connect()
        dbh:autocommit(false); -- don't commit automatically
        self.conn = dbh;
        self.prepared = {};
+       self:set_encoding();
        return true;
 end
 function engine:execute(sql, ...)