Software / code / prosody
Comparison
plugins/mod_storage_sql.lua @ 12723:4cfd09343947
mod_storage_sql: Strip timestamp precision in queries to fix error (thanks muppeth)
Fixes
Error in SQL transaction: Error executing statement parameters: ERROR: invalid input syntax for integer
This was handled for INSERT in 9524bb7f3944 but not SELECT.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 07 Sep 2022 12:27:12 +0200 |
| parent | 12631:9524bb7f3944 |
| child | 12824:735bf601b78d |
comparison
equal
deleted
inserted
replaced
| 12722:cd993fd7b60d | 12723:4cfd09343947 |
|---|---|
| 353 | 353 |
| 354 -- Helpers for building the WHERE clause | 354 -- Helpers for building the WHERE clause |
| 355 local function archive_where(query, args, where) | 355 local function archive_where(query, args, where) |
| 356 -- Time range, inclusive | 356 -- Time range, inclusive |
| 357 if query.start then | 357 if query.start then |
| 358 args[#args+1] = query.start | 358 args[#args+1] = math.floor(query.start); |
| 359 where[#where+1] = "\"when\" >= ?" | 359 where[#where+1] = "\"when\" >= ?" |
| 360 end | 360 end |
| 361 | 361 |
| 362 if query["end"] then | 362 if query["end"] then |
| 363 args[#args+1] = query["end"]; | 363 args[#args+1] = math.floor(query["end"]); |
| 364 if query.start then | 364 if query.start then |
| 365 where[#where] = "\"when\" BETWEEN ? AND ?" -- is this inclusive? | 365 where[#where] = "\"when\" BETWEEN ? AND ?" -- is this inclusive? |
| 366 else | 366 else |
| 367 where[#where+1] = "\"when\" <= ?" | 367 where[#where+1] = "\"when\" <= ?" |
| 368 end | 368 end |