View Single Post
Old 05-23-2008, 10:42 AM   #1 (permalink)
x1hundredregrets
Reactor Zero
 
x1hundredregrets's Avatar
 
Join Date: Dec 2002
Posts: 308
-5 Internets
SQL / SQLite trigger question

Hey all,

I'm writing a server app and client app in C# to handle some file caching.

I have these two tables:

mycommand.CommandText = "CREATE TABLE IF NOT EXISTS 'cache' (id INTEGER PRIMARY KEY, md5 VARCHAR(32), filename char(255), timeAdded TIMESTAMP, timeLastRef TIMESTAMP, fileize INTEGER, filedata BLOB)";
mycommand.ExecuteNonQuery();
mycommand.CommandText = "CREATE TABLE IF NOT EXISTS 'info' (totalFiles INTEGER, totalFileSize INTEGER)";
mycommand.ExecuteNonQuery();



I want to update the 'info' table's totalFiles and totalFileSize whenever a DELETE or INSERT is done on 'cache'. I need to use triggers since they are an atomic operation as far as SQLite is concerned.

Does anyone know the correct syntax for something like that? I googled it and came up with very very little info that applies to my specific case.

Thanks in advance!
x1hundredregrets is offline   Reply With Quote

 
Uberguilds Network