Struggling With Deletion Control

Ian Devaney idevaney at mac.com
Fri Oct 31 17:27:34 CST 2003


I am struggling with how best to handle deletion and sql queries.

Here is an example query that links several tables:

   s = s+ "SELECT "
   s = s+ "gifts.*, "
   s = s+ "gifts.gift_id, "
   s = s+ "stores.*, "
   s = s+ "stores.store_id "

   s = s+ "FROM gifts, stores WHERE gifts.person_ptr = "
   s = s+ str(personID)
   s = s+ " AND "
   s = s+"stores.recID = gifts.store_ptr"

The "gifts" table uses "kv_setNull" on its store pointer so that when a 
store is deleted the value is set to "0".

The query above works fine until I delete a store - then, of course, 
the query fails because

"stores.recID = gifts.store_ptr"

would mean "stores.recID = 0"

How do I structure this so I can also get items whose "store_ptr" has 
been nulled?

Cheers,

Ian



More information about the Valentina mailing list