Software /
code /
prosody
Comparison
util/sql.lua @ 6748:ccf4fcfc2024
util.sql: Call onconnect, provide noop dummy if not set
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 02 Jul 2015 22:32:44 +0200 |
parent | 6735:b553a30620b2 |
child | 6758:88b89facc3c9 |
comparison
equal
deleted
inserted
replaced
6747:14c52ca661b6 | 6748:ccf4fcfc2024 |
---|---|
109 if not dbh then return nil, err; end | 109 if not dbh then return nil, err; end |
110 dbh:autocommit(false); -- don't commit automatically | 110 dbh:autocommit(false); -- don't commit automatically |
111 self.conn = dbh; | 111 self.conn = dbh; |
112 self.prepared = {}; | 112 self.prepared = {}; |
113 self:set_encoding(); | 113 self:set_encoding(); |
114 self:onconnect(); | |
114 return true; | 115 return true; |
116 end | |
117 function engine:onconnect() | |
118 -- Override from create_engine() | |
115 end | 119 end |
116 function engine:execute(sql, ...) | 120 function engine:execute(sql, ...) |
117 local success, err = self:connect(); | 121 local success, err = self:connect(); |
118 if not success then return success, err; end | 122 if not success then return success, err; end |
119 local prepared = self.prepared; | 123 local prepared = self.prepared; |