View Single Post
Old 05-23-2008, 10:53 AM   #3 (permalink)
x1hundredregrets
Reactor Zero
 
x1hundredregrets's Avatar
 
Join Date: Dec 2002
Posts: 306
-5 Internets
I got that much done, lol. I'm wondering how I access the filesize column from the row being INSERTED or DELETED? Heres what I have so far, but it's throwing an exception because the syntax is wrong somehow:

mycommand.CommandText = "CREATE TRIGGER IF NOT EXISTS 'updateInfoOnDelete' DELETE ON 'cache' BEGIN UPDATE 'info' SET 'totalFiles'=totalFiles-1; UPDATE 'info' SET 'totalFileSize'=totalFileSize-old.filesize; END";
mycommand.ExecuteNonQuery();
mycommand.CommandText = "CREATE TRIGGER IF NOT EXISTS 'updateInfoOnInsert' INSERT ON 'cache' BEGIN UPDATE 'info' SET 'totalFiles'=totalFiles+1; UPDATE 'info' SET 'totalFileSize'=totalFileSize+old.filesize; END";
mycommand.ExecuteNonQuery();

Thanks again for the quick reply.
x1hundredregrets is offline   Reply With Quote

 
Uberguilds Network