summaryrefslogtreecommitdiffstats
path: root/database/sqlite/sqlite.c
Commit message (Collapse)AuthorAgeFilesLines
* sqlite3: Improve error handling if memory alloc fails for SQL query stringDavid Sommerseth2012-10-191-2/+8
| | | | | Signed-off-by: David Sommerseth <dazo@users.sourceforge.net> (cherry picked from commit 2613675111387fb0753d31be74b5e0a362389ef8)
* Updated copyright datesDavid Sommerseth2012-10-081-1/+1
| | | | Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* sqlite: Added SQL function to convert datetime timestamps from UTC/GMT to ↵David Sommerseth2012-10-081-5/+76
| | | | | | | | | | | | | | localtime All CURRENT_TIMESTAMP calls are returned in UTC/GMT, and this value is stored in the database. When using eurephiadm to look at these datetime fields the UTC/GMT value is used, and needs to be taken in consideration when looking at the reports. This patch is the first step to handle the local time zone better. This patch also fixes the 'debug' program in sqlite.c, making use of the eurephia_log_init() and eurephia_log_close() calls for log preparations. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Implemented better error handling in the SQLite3 frameworkDavid Sommerseth2011-12-191-18/+100
| | | | | | | | | | | | | | | | The core sqlite_query() function will now always return a pointer to a dbresult structure. This structure now contains a query status and the error message from the sqlite3 backend if something went wrong. This means that error checking from now on should use the sqlite_query_status() macro and not to check if sqlite_query() returns NULL. Another fundamental change is that sqlite_free_results() must always be called on the dbresult structure now, to free the memory used by either data from the query or the error message. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
* Updated Copyright dates to include 2010David Sommerseth2010-07-301-1/+1
|
* Add support for ft_STRING_LOWER in the sqlite3 driverDavid Sommerseth2009-11-121-7/+17
| | | | Also fixed some wrong tab/space issues
* Fixed memory leak when sqlite_query() failsDavid Sommerseth2009-09-261-0/+1
|
* Rewrote sqlite_get_num_tuples() and sqlite_get_affected_rows() as macrosDavid Sommerseth2009-09-261-24/+0
|
* Fixed SEGV error when calling sqlite_dump_result() on dbresults from other ↵David Sommerseth2009-09-261-2/+3
| | | | queries than SELECT
* Only add table alias in SQL 'WHERE' sectionsDavid Sommerseth2009-09-261-1/+1
|
* Moved the useful append_str() macro from sqlite.c to eurephia_nullsafe.hDavid Sommerseth2009-09-251-11/+0
|
* Removed usage of a global result pointerDavid Sommerseth2009-09-171-54/+50
| | | | | | | | The callback function do now get a pointer to the query results directly instead of using a global result pointer. This makes queries done in parallel a lot safer. Made the SQLITE_DEBUG main() function more generic and removed memwatch references which is no longer in use, as valgrind is much better and easier to use.
* Added comments to sqlite.[ch]David Sommerseth2009-09-081-13/+139
|
* Added debug logging of free_nullsafe() calls as wellDavid Sommerseth2009-09-071-16/+16
|
* Moved all malloc() operations over to a calloc wrapper, malloc_nullsafe()David Sommerseth2009-09-071-11/+5
| | | | This also improves debugging as well, if debug logging is enabled and log level is >= 40.
* Removed header file which is no longer neededDavid Sommerseth2009-09-051-1/+0
|
* Added missing #include statementsDavid Sommerseth2009-09-021-0/+1
|
* Only populate XML nodes if we have a value to populate it withDavid Sommerseth2009-09-011-13/+14
|
* SQLite3 - Added support for "affected rows" count on INSERT/UPDATE/DELETE ↵David Sommerseth2009-09-011-0/+10
| | | | queries
* Added improved filtering support to SQLite3 driverDavid Sommerseth2009-04-051-1/+17
| | | | Follow up of commit ff744b48fdc0665b620339d51424892def8d8071
* Fixed some possible issues with the XML implementation, regarding UTF-8David Sommerseth2009-03-291-5/+20
| | | | | | Do proper conversion from char * to xmlChar *. Need to figure out a better way how to return xmlChar * to char * when returning strings which may contain UTF-8.
* Made the licence explicit GPLv2 onlyDavid Sommerseth2009-03-261-1/+1
|
* Cleaned up the code a little bitDavid Sommerseth2009-03-261-4/+2
| | | | | Made sure we only include needed include files and checked that the copyright headers are equal and correct
* sqlite3: Make sqlite_query_mapped(...) work with empty WHERE clauseDavid Sommerseth2008-12-261-3/+10
|
* sqlite3 - Added saving last_insert_id on INSERT INTO queriesDavid Sommerseth2008-12-221-0/+3
|
* sqlite3 - Added sortkeys as argument to sqlite_query_mapped(...)David Sommerseth2008-12-201-2/+6
| | | | | The last argument to the function can contain a list over field names which will be used in the ORDER BY clause when doing SELECT queries.
* Fixed more memory leaks and missing memory initialisation.David Sommerseth2008-12-191-2/+4
|
* sqlite - BUGFIX: Fixed INSERT INTO statements when using ↵David Sommerseth2008-12-181-2/+8
| | | | sqlite_query_mapped(...)
* sqlite: Fixed segfault int SQLreservedWord(...)David Sommerseth2008-12-181-1/+1
|
* Added sqlite functions for populating an XML document directlyDavid Sommerseth2008-12-131-0/+19
|
* Enhanced table/field mapping and eDBmkMapping_USERINFO(...) to include ↵David Sommerseth2008-12-111-0/+4
| | | | possibility for table aliases
* Do not encapsulate key-value pairs with () in UPDATE modeDavid Sommerseth2008-12-081-3/+13
| | | | | And added support for setting fields to NULL if flagged via the field type value ft_SETNULL
* Added possibility to also set NULL values in UPDATEDavid Sommerseth2008-12-081-1/+2
|
* Update field mapping to include data type. Improved ↵David Sommerseth2008-12-081-22/+151
| | | | | | | | | | | | | | sqlite_query_mapped(...) function The new sqlite_query_mapped(...) function will now consider the field type when formatting the data values for SQLite. In addition reserved words on the DATETIME data type will be preserved without quote encapsulation. Improved the sqlite_query_mapped(...) to also handle UPDATE, INSERT and DELETE in addition to SELECT. The function now needs two eDBfieldMap mappings. The first one will contain update/insert values, while the last one defines search criteria.
* Extended sqlite.[ch] with sqlite_query_mapped(...)David Sommerseth2008-12-071-0/+33
| | | | | | | This functions does almost the same as sqlite_query(...), it takes an SQL statement without the WHERE clause. The where clause is built up based on the fields sent in via the eDBfieldMap struct, containing the fields and values to look for.
* Added context_type into eurephiaCTX struct. Database queries limited due to ↵David Sommerseth2008-11-291-0/+4
| | | | context type.
* Log review - changed log levels for all DEBUG(...) callsDavid Sommerseth2008-10-041-1/+1
|
* Improved code security. LOG_DEBUG statements are only compiled if DEBUG=1 ↵David Sommerseth2008-09-191-1/+1
| | | | | | | | | | | | | is sent to make. Since several parts of the code where LOG_DEBUG was used with eurephia_log(...) contains security sensitive information (like logging password retrieved with get_env(...)), all debug logging is now done via the DEBUG macro. This macro will not produce any security relevant eurephia_log(...) statements unless the source is compiled with -DENABLE_DEBUG. This is activated via make by adding DEBUG=1 before the make targets. When not enabled, the binaries will not do any debug logging at all.
* Changed to using sqlite3_vmprintf() function instead of vsnprintf()David Sommerseth2008-09-101-3/+4
|
* Added GPLv2 licence, updated *.[ch] files to include license, with exception ↵David Sommerseth2008-08-081-0/+14
| | | | of memwatch and sha1
* Imported eurephia into gitDavid Sommerseth2008-08-061-0/+325