Commit graph

56 commits

Author SHA1 Message Date
Kim Alvefur
c904d1e28d util: Ignore some Lua 5.1 vs 5.2 compat things [luacheck] 2017-11-10 17:47:11 +01:00
Kim Alvefur
1438a38845 util: Various minor changes to please [luacheck] 2017-11-10 05:42:32 +01:00
Kim Alvefur
bd1b01460c util.sql: Discard useless substitution count from string.gsub in SQL debug logs 2017-11-08 10:45:58 +01:00
Kim Alvefur
eb07e55b14 util.sql: Return an error message when a SQL commit fails (LuaDBI doesn't) (Thanks Ge0rG) 2017-11-07 09:26:48 +01:00
Matthew Wild
1e9b966c59 util.sql: Don't log at error level if a transaction failed and was retried ok 2017-10-04 10:16:42 +01:00
Matthew Wild
c5af3aee3e util.sql: Greedily read all rows so we can close queries early (fixes #391) 2017-08-04 18:52:15 +01:00
Kim Alvefur
656c5d45a1 util.sql: Produce more SQL-standard-like debug messages 2017-04-13 22:37:35 +02:00
Kim Alvefur
b3cd19063f util.sql: Strip indentation from queries for debug logging 2017-04-12 18:57:40 +02:00
Kim Alvefur
f2c30c688f util.sql: Apply quote transform in engine:execute so it is applied to eg encoding checks in mod_storage_sql (thanks Martin) 2017-04-12 17:26:44 +02:00
Kim Alvefur
91baabfede SQL: Use standard quotes for columns and other identifiers, rewrite to grave accents for MySQL only (fixes #885) 2017-04-10 23:13:39 +02:00
Anton Shestakov
8e2e80c3f3 util.sql: remove unused one-letter loop variables [luacheck] 2016-07-23 18:22:05 +08:00
Kim Alvefur
8d720b7bfb util.sql: Import type too (fix global access) 2016-05-22 14:37:52 +02:00
Matthew Wild
8a32b7f2c3 util.sql: Import pcall (fixes #677) 2016-05-22 02:16:11 +01:00
Kim Alvefur
c24be27b2f util.sql: Log errors in transaction to error level with traceback but return only error message (fixes #464) 2016-03-25 16:09:34 +01:00
Matthew Wild
c50a32df40 util.sql: Charset should be innocent until proven guilty (initialize charset_ok to true), fixes bug introduced in 187ba2e9c012 2016-03-23 12:17:28 +00:00
Kim Alvefur
c00adb21f4 util.sql: Catch errors from LuaDBI connect (Fixes #568) 2016-03-21 09:50:52 +01:00
Kim Alvefur
f46a677512 util.sql: Remove unused arguments [luacheck] 2016-03-13 18:35:00 +01:00
Kim Alvefur
2b1ff306c3 util.sql: Don't break out of result retreival loops 2016-03-13 18:31:53 +01:00
Kim Alvefur
b65ec4aebe util.sql: Move per-driver (currenly only PostgreSQL) query transform into its own method 2016-03-13 17:38:49 +01:00
Kim Alvefur
58a6a4b140 util.sql: Localize unpack() in Lua 5.2 compatible way 2016-02-22 17:30:12 +01:00
Kim Alvefur
a729f9553c util.sql: Raw query debug logging (needs to be explicitly enabled by a plugin) 2016-02-21 19:25:01 +01:00
Kim Alvefur
28202ed1c9 util.sql: Export db2uri (mod_storage_sql2 command uses it) (thanks mike) 2015-09-02 14:14:22 +02:00
Kim Alvefur
90f5cf4cc1 util.sql: Log when transactions begin 2015-08-30 13:45:36 +02:00
Kim Alvefur
eaa823a597 util.*: Remove use of module() function, make all module functions local and return them in a table at the end 2015-02-21 10:36:37 +01:00
Kim Alvefur
97ed1aed6c util.{interpolation,prosodyctl,sql}: Trim trailing whitespace 2015-07-17 12:43:04 +02:00
Matthew Wild
376dd43396 util.sql: Add safety check to ensure our chosen connection charset is actually being used (MySQL) 2015-07-08 15:25:42 +01:00
Matthew Wild
c23293f382 util.sql: Fix log level of debug message 2015-07-08 15:16:17 +01:00
Matthew Wild
5a90847cd7 util.sql: Log debug message when connecting to database 2015-07-08 15:15:32 +01:00
Matthew Wild
eed81c2f94 util.sql: Make set_encoding() return failure of SET NAMES 2015-07-08 15:14:24 +01:00
Matthew Wild
9f5bd334c5 util.sql: Return failure if set_encoding() fails 2015-07-08 15:10:25 +01:00
Matthew Wild
eeb1c1be54 util.sql: Use appropriate collation for the chosen character set - fixes MySQL silently ignoring our SET NAMES command when we use utf8mb4 2015-07-08 15:06:20 +01:00
Matthew Wild
7a4ec3c57c util.sql: Create table with same charset as the charset we selected for our connection, also use corresponding _bin collation 2015-07-08 15:04:23 +01:00
Matthew Wild
137f763966 util.sql: Allow onconnect callback to fail connection to the DB by returning false, err 2015-07-07 17:43:14 +01:00
Kim Alvefur
3dd49f5620 util.sql: Call onconnect, provide noop dummy if not set 2015-07-02 22:32:44 +02:00
Matthew Wild
3edc813e77 util.sql: Remove built-in engine caching. This is the wrong layer to do this, and unintentionally sharing connections could cause problems (e.g. when interleaving multiple queries and result fetching) 2015-06-03 15:57:46 +01:00
Matthew Wild
41996240ed util.sql: Expose db2uri helper function 2015-06-03 15:55:43 +01:00
Matthew Wild
15e84d4ec5 util.sql: Rename some variable to match conventions 2015-06-03 15:54:52 +01:00
Matthew Wild
bfba36b194 util.sql: Remove unused functions and unused commented code 2015-05-30 22:23:19 +01:00
Kim Alvefur
655e1cde09 mod_storage_sql2, util.sql: Set character encoding on every connect 2014-12-11 09:18:39 +01:00
Kim Alvefur
0dce82a095 util.sql: Fix previous commit 2013-11-12 11:38:52 +01:00
Kim Alvefur
a9e2cb510a util.sql: Get character set info from the correct database. 2013-11-12 11:13:45 +01:00
Kim Alvefur
95457cb25b util.sql: Rewrite auto increment columns to SERIAL for PostgreSQL 2013-11-11 23:09:18 +01:00
Matthew Wild
a80e00e16f util.sql: Fix to call execute on 'self' rather than 'engine' (thanks eisensheng) 2013-11-10 23:10:27 +00:00
Kim Alvefur
1bcfdab54f util.sql: Rewrite MEDIUMTEXT to TEXT for drivers other than MySQL 2013-10-30 10:24:35 +01:00
Kim Alvefur
29988cfa70 util.sql: Check what encoding SQLite3 uses 2013-10-29 11:43:49 +01:00
Kim Alvefur
a0d18144ed util.sql: Find out if MySQL supports utf8mb4 and use that 2013-10-29 11:42:55 +01:00
Kim Alvefur
22be283187 util.sql: Support incrementing columns 2013-10-28 23:20:25 +01:00
Kim Alvefur
136139f068 util.sql: Allow columns to be marked the primary key 2013-10-28 23:19:47 +01:00
Kim Alvefur
6c769838e9 util.sql: Allow creating unique indices 2013-10-28 23:18:54 +01:00
Kim Alvefur
e993570759 mod_storage_sql2, util.sql: Move code for setting encoding to util.sql 2013-10-28 22:07:16 +01:00