Integrating three tables

jda jda at his.com
Thu Dec 8 19:30:51 CST 2005


Hi all,

I've been playing with changing my db from a rigid one-table 
structure to a more flexible one, at Ruslan's urging. I'm running 
into some conceptual/semantic difficulties because of my ignorance, 
and don't want to badger Ruslan too much. So I thought I'd badger the 
list. :-)

I want to add more fields to an existing database. Two new tables, 
one containing a pointer to the records in the first table, the new 
data in a varcharfield, and a pointer to a table holding the field 
names. The other table contains the names of the new fields.

The new structure is basically this:

Table A
The original db, with lots of columns

Table B -- morefields, 3 columns

   refPtr = CreateObjectPtrField("refPtr", inMyDB.Table("tableA"), 
EVOnDelete.kCascade, EVFlag.fNone)
   moreFieldContent = CreateVarCharField("moreFieldContent", 1022, 
EVFlag.fNullable + EVFlag.fIndexed + EVFlag.fIndexByWords)
   labelPtr = CreateObjectPtrField("labelPtr", inMyDB.Table("labels"), 
EVOnDelete.kCascade, EVFlag.fNone


Table C -- labels, 1 column
   labelName = CreateVarCharField("labelName", 1022, EVFlag.fNullable)

So my first question is, how to store data in a field in the table 
Table B in such a way that it is linked to Table A and Table C? Right 
now I'm using a simple cursor to do this in one of the fields in 
Table A:

myCursor = myDataBase.SQLselect("SELECT " + fldName + " from 
theTableA WHERE id=" + str(refNum) EVCursorLocation.kServerSide, 
EVLockType.kReadWrite)

and then using myCursor.setString (the value id is a column in Table 
A used to track records).

Any replies (the simpler the better) much appreciated.

Thanks,

Jon


More information about the Valentina mailing list