Enlightenment CVS committal

Author  : titan
Project : e17
Module  : proto

Dir     : e17/proto/ephoto/src/bin


Modified Files:
        ephoto.h ephoto_database.c 


Log Message:
Add the final databasing touch... Removal of albums and images.

===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ephoto.h    26 Jan 2007 08:26:57 -0000      1.9
+++ ephoto.h    27 Jan 2007 02:28:07 -0000      1.10
@@ -24,8 +24,10 @@
 /* Ephoto Databasing */
 sqlite3 *ephoto_db_init(void);
 void ephoto_db_add_album(sqlite3 *db, char *name, char *description);
+void ephoto_db_delete_album(sqlite3 *db, char *name);
 Ecore_List *ephoto_db_list_albums(sqlite3 *db);
 void ephoto_db_add_image(sqlite3 *db, char *album, char *name, char *path);
+void ephoto_db_delete_image(sqlite3 *db, char *album, char *path);
 Ecore_List *ephoto_db_list_images(sqlite3 *db, char *album);
 void ephoto_db_close(sqlite3 *db);
 
===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto_database.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ephoto_database.c   26 Jan 2007 09:22:50 -0000      1.2
+++ ephoto_database.c   27 Jan 2007 02:28:07 -0000      1.3
@@ -82,6 +82,18 @@
        return;
 }
 
+/*Deleate an album from the album table*/
+void ephoto_db_delete_album(sqlite3 *db, char *name)
+{
+       char command[PATH_MAX];
+
+       snprintf(command, PATH_MAX, "DELETE FROM albums WHERE name = '%s';", 
name);
+
+       sqlite3_exec(db, command, 0, 0, 0);
+
+       return;
+}
+
 /*Add a new image to a particular album*/
 void ephoto_db_add_image(sqlite3 *db, char *album, char *name, char *path)
 {
@@ -107,6 +119,20 @@
 
        return;
 }
+
+/*Delete an image from a particular album*/
+void ephoto_db_delete_image(sqlite3 *db, char *album, char *path)
+{
+       char command[PATH_MAX];
+
+       snprintf(command, PATH_MAX, "SELECT id FROM albums WHERE name = '%s';", 
album);
+       sqlite3_exec(db, command, get_album_id, 0, 0);
+       snprintf(command, PATH_MAX, "SELECT id FROM images WHERE path = '%s';", 
path);
+       sqlite3_exec(db, command, get_image_id, 0, 0);
+       snprintf(command, PATH_MAX, "DELETE FROM album_images WHERE "
+                                   "album_id = '%s' AND image_id = '%s';", 
album_id, image_id);
+       return;
+}      
 
 /*Populate a list the albums in the albums table*/
 static int list_albums(void *notused, int argc, char **argv, char **col)



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to