X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=www%2Fapi%2Flightmediascanner__db__common_8c-source.html;fp=www%2Fapi%2Flightmediascanner__db__common_8c-source.html;h=cce01703e9217e8dbec994f4c12833d268bf4153;hb=7436eda8879f146fa50e342a134db80a9e6db58d;hp=02eabde081763dc415c550481be661433b352c09;hpb=ac03e6ebd87457463f0d6facf3a810c24f3c8226;p=lms diff --git a/www/api/lightmediascanner__db__common_8c-source.html b/www/api/lightmediascanner__db__common_8c-source.html index 02eabde..cce0170 100644 --- a/www/api/lightmediascanner__db__common_8c-source.html +++ b/www/api/lightmediascanner__db__common_8c-source.html @@ -4,792 +4,789 @@ - -
- -
-
- -
-

src/lib/lightmediascanner_db_common.c

Go to the documentation of this file.
00001 #include "lightmediascanner_db_private.h"
-00002 #include <stdlib.h>
-00003 #include <stdio.h>
-00004 #include <string.h>
-00005 
-00006 #if SQLITE_VERSION_NUMBER < 3003009
-00007 int
-00008 sqlite3_prepare_v2(sqlite3 *db, const char *sql, int len, sqlite3_stmt **stmt, const char **tail)
-00009 {
-00010     return sqlite3_prepare(db, sql, len, stmt, tail);
-00011 }
-00012 #endif /* SQLITE_VERSION_NUMBER < 3003009 */
-00013 
-00014 #if SQLITE_VERSION_NUMBER < 3003007
-00015 int
-00016 sqlite3_clear_bindings(sqlite3_stmt *stmt)
-00017 {
-00018     int i, last;
-00019     int rc;
-00020 
-00021     rc = SQLITE_OK;
-00022     last = sqlite3_bind_parameter_count(stmt);
-00023     for(i = 1; rc == SQLITE_OK && i <= last; i++) {
-00024         rc = sqlite3_bind_null(stmt, i);
-00025     }
-00026     return rc;
-00027 }
-00028 #endif /* SQLITE_VERSION_NUMBER < 3003007 */
-00029 
-00030 #if SQLITE_VERSION_NUMBER < 3003008
-00031 /* Until 3.3.8 it doesn't support CREATE TRIGGER IF NOT EXISTS, so
-00032  * just ignore errors :-(
-00033  */
-00034 int
-00035 lms_db_create_trigger_if_not_exists(sqlite3 *db, const char *sql)
-00036 {
-00037     char *errmsg, *query;
-00038     int r, sql_len, prefix_len;
-00039 
-00040     prefix_len = sizeof("CREATE TRIGGER ") - 1;
-00041     sql_len = strlen(sql);
-00042     query = malloc((prefix_len + sql_len + 1) * sizeof(char));
-00043     if (!query)
-00044         return -1;
-00045 
-00046     memcpy(query, "CREATE TRIGGER ", prefix_len);
-00047     memcpy(query + prefix_len, sql, sql_len + 1);
-00048     r = sqlite3_exec(db, query, NULL, NULL, &errmsg);
-00049     free(query);
-00050     if (r != SQLITE_OK)
-00051         sqlite3_free(errmsg);
-00052     return 0;
-00053 }
-00054 #else /* SQLITE_VERSION_NUMBER < 3003008 */
-00055 int
-00056 lms_db_create_trigger_if_not_exists(sqlite3 *db, const char *sql)
-00057 {
-00058     char *errmsg, *query;
-00059     int r, sql_len, prefix_len;
-00060 
-00061     prefix_len = sizeof("CREATE TRIGGER IF NOT EXISTS ") - 1;
-00062     sql_len = strlen(sql);
-00063     query = malloc((prefix_len + sql_len + 1) * sizeof(char));
-00064     if (!query)
-00065         return -1;
-00066 
-00067     memcpy(query, "CREATE TRIGGER IF NOT EXISTS ", prefix_len);
-00068     memcpy(query + prefix_len, sql, sql_len + 1);
-00069     r = sqlite3_exec(db, query, NULL, NULL, &errmsg);
-00070     free(query);
-00071     if (r != SQLITE_OK) {
-00072         fprintf(stderr, "ERROR: could not create trigger: %s\n", errmsg);
-00073         sqlite3_free(errmsg);
-00074         return -2;
-00075     }
-00076     return 0;
-00077 }
-00078 #endif /* SQLITE_VERSION_NUMBER < 3003008 */
-00079 
-00080 sqlite3_stmt *
-00081 lms_db_compile_stmt(sqlite3 *db, const char *sql)
-00082 {
-00083     sqlite3_stmt *stmt;
-00084 
-00085     if (sqlite3_prepare_v2(db, sql, -1, &stmt, NULL) != SQLITE_OK)
-00086         fprintf(stderr, "ERROR: could not prepare \"%s\": %s\n", sql,
-00087                 sqlite3_errmsg(db));
-00088 
-00089     return stmt;
-00090 }
-00091 
-00092 int
-00093 lms_db_finalize_stmt(sqlite3_stmt *stmt, const char *name)
-00094 {
-00095     int r;
-00096 
-00097     r = sqlite3_finalize(stmt);
-00098     if (r != SQLITE_OK) {
-00099         fprintf(stderr, "ERROR: could not finalize %s statement: #%d\n",
-00100                 name, r);
-00101         return -1;
-00102     }
-00103 
-00104     return 0;
-00105 }
-00106 
-00107 int
-00108 lms_db_reset_stmt(sqlite3_stmt *stmt)
-00109 {
-00110     int r, ret;
+
+
+
Generated on Sun Oct 5 12:24:53 2008 for Light Media Scanner by  -doxygen 1.5.2
+doxygen 1.5.6