This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Invalid query with STRFTIME

Tags: None
(comma "," separated)
flightsixteen
Registered Member
Posts
11
Karma
0

Invalid query with STRFTIME

Thu Aug 20, 2015 6:00 am
I'm trying to use the following query

SELECT STRFTIME('%W', '2015-01-01') as weeknum FROM mytable;

It works when I open the kexi project in sqlite3. When I try to enter it in the query editor I get the error "The query is incorrect". Error near "datatracker".

I thought Kexi uses sqlite under the hood. What's the issue? Is there any way to get access to strftime and other sqlite3-specific functions in queries?
User avatar
jstaniek
Moderator
Posts
1027
Karma
2
OS

Re: Invalid query with STRFTIME  Topic is solved

Wed Aug 26, 2015 6:49 am
Hi flightsixteen,
Kexi parses query statements in order to be able to apply best solution available.

Support status is collected for functions at: https://community.kde.org/Kexi/Plugins/ ... _Functions
Unfortunately strftime() isn't supported.
We recently addes substr() to 2.9.1. I see STRFTIME() is not that custom as we think, it's in PostgreSQL too.

The idea of adding support for special 'native', not-portable SQL is a very good one, would solve the general issue quickly. A wish from 2012: https://bugs.kde.org/show_bug.cgi?id=298149
Just linked to bountysource: https://www.bountysource.com/issues/261 ... in-queries

It's not a matter of a few lines of code though. Without parser we don't know what columns are there in the query, of what types and what constraints. Each database backend has own way to inform about this and SQLite lacked that completely when we started with it (it's one reason for having kexi__* metadata tables).


Best regards,
Jarosław Staniek
• Qt Certified Specialist
KEXI - Open Source Visual DB Apps Builder
• Request a feature or fix for KEXI here
May I help you? Please mention your app's version and OS when asking for help


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, sandyvee, Sogou [Bot]