]> git.ipfire.org Git - pakfire.git/commitdiff
db: Drop unused type field in files table
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 23 Jun 2021 17:41:55 +0000 (17:41 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 23 Jun 2021 17:41:55 +0000 (17:41 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/db.c

index b31b68b1cd1e97cd57c0070f52b809117b3ba7e3..900e69e3a6f2327e90dfee7a80b724efa094dba7 100644 (file)
@@ -293,7 +293,6 @@ static int pakfire_db_create_schema(struct pakfire_db* db) {
                        "path           TEXT, "
                        "pkg            INTEGER, "
                        "size           INTEGER, "
-                       "type           INTEGER, "
                        "config         INTEGER, "
                        "datafile       INTEGER, "
                        "mode           INTEGER, "
@@ -768,8 +767,8 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                goto END;
        }
 
-       const char* sql = "INSERT INTO files(pkg, path, size, type, config, datafile, mode, "
-               "user, 'group', hash1, ctime, mtime, capabilities) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+       const char* sql = "INSERT INTO files(pkg, path, size, config, datafile, mode, "
+               "user, 'group', hash1, ctime, mtime, capabilities) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
        // Prepare the statement
        r = sqlite3_prepare_v2(db->handle, sql, -1, &stmt, NULL);
@@ -810,18 +809,8 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                        goto END;
                }
 
-               // Bind type - XXX this is char which isn't very helpful
-               //char type = pakfire_file_get_type(file);
-
-               r = sqlite3_bind_null(stmt, 4);
-               if (r) {
-                       ERROR(db->pakfire, "Could not bind type: %s\n", sqlite3_errmsg(db->handle));
-                       pakfire_file_unref(file);
-                       goto END;
-               }
-
                // Bind config - XXX TODO
-               r = sqlite3_bind_null(stmt, 5);
+               r = sqlite3_bind_null(stmt, 4);
                if (r) {
                        ERROR(db->pakfire, "Could not bind config: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
@@ -829,7 +818,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                }
 
                // Bind datafile - XXX TODO
-               r = sqlite3_bind_null(stmt, 6);
+               r = sqlite3_bind_null(stmt, 5);
                if (r) {
                        ERROR(db->pakfire, "Could not bind datafile: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
@@ -839,7 +828,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                // Bind mode
                mode_t mode = pakfire_file_get_mode(file);
 
-               r = sqlite3_bind_int64(stmt, 7, mode);
+               r = sqlite3_bind_int64(stmt, 6, mode);
                if (r) {
                        ERROR(db->pakfire, "Could not bind mode: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
@@ -849,7 +838,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                // Bind user
                const char* user = pakfire_file_get_user(file);
 
-               r = sqlite3_bind_text(stmt, 8, user, -1, NULL);
+               r = sqlite3_bind_text(stmt, 7, user, -1, NULL);
                if (r) {
                        ERROR(db->pakfire, "Could not bind user: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
@@ -859,7 +848,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                // Bind group
                const char* group = pakfire_file_get_group(file);
 
-               r = sqlite3_bind_text(stmt, 9, group, -1, NULL);
+               r = sqlite3_bind_text(stmt, 8, group, -1, NULL);
                if (r) {
                        ERROR(db->pakfire, "Could not bind group: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
@@ -869,7 +858,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                // Bind hash1
                const char* chksum = pakfire_file_get_chksum(file);
 
-               r = sqlite3_bind_text(stmt, 10, chksum, -1, NULL);
+               r = sqlite3_bind_text(stmt, 9, chksum, -1, NULL);
                if (r) {
                        ERROR(db->pakfire, "Could not bind hash1: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
@@ -879,7 +868,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                // Bind ctime
                time_t ctime = pakfire_file_get_ctime(file);
 
-               r = sqlite3_bind_int64(stmt, 11, ctime);
+               r = sqlite3_bind_int64(stmt, 10, ctime);
                if (r) {
                        ERROR(db->pakfire, "Could not bind ctime: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
@@ -889,7 +878,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                // Bind mtime
                time_t mtime = pakfire_file_get_mtime(file);
 
-               r = sqlite3_bind_int64(stmt, 12, mtime);
+               r = sqlite3_bind_int64(stmt, 11, mtime);
                if (r) {
                        ERROR(db->pakfire, "Could not bind mtime: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);
@@ -897,7 +886,7 @@ static int pakfire_db_add_files(struct pakfire_db* db, unsigned long id, Pakfire
                }
 
                // Bind capabilities - XXX TODO
-               r = sqlite3_bind_null(stmt, 13);
+               r = sqlite3_bind_null(stmt, 12);
                if (r) {
                        ERROR(db->pakfire, "Could not bind capabilities: %s\n", sqlite3_errmsg(db->handle));
                        pakfire_file_unref(file);