NEVERMIND: (solved) create table sql for object ptr

Bart Pietercil bart.pietercil at gmail.com
Wed Jun 20 01:03:21 CDT 2007


Hi Dave,

In my book this line

> "ParentPtr" OBJECTPTR CONSTRAINT Link_1 REFERENCES "Person" ON  
> DELETE SET_NULL  ...,
>

looks like trouble(SET_NULL won't work I think)

	"objptr_modified_by" OBJECTPTR CONSTRAINT "compcard_modified_by"  
REFERENCES "tbl_users" ON DELETE SET NULL INDEXED,

or
	"objptr_modified_by" OBJECTPTR CONSTRAINT "compcard_modified_by"  
REFERENCES "tbl_users" ON DELETE RESTRICT INDEXED,

or
	"objptr_modified_by" OBJECTPTR CONSTRAINT "compcard_modified_by"  
REFERENCES "tbl_users" ON DELETE CASCADE INDEXED,


do the trick.




hth


Bart Pietercil

>
>
> What is the sql syntax if I want to create an objectptr field in a  
> create table sql statement?
>
> I cannot find an example anywhere, and i am unable to figure it out  
> from the sql wiki create table page.
>
> I want to do this:
>
> 	VTable* tblPerson = [inDatabase createTable:@"Person"];
> 	[tblPerson createStringField:@"FirstName" maxLength:40];
> 	[tblPerson createObjectPtrField:@"ParentPtr" target:tblPerson  
> onDeletion:EVOnDelete_kSetNull flags:EVFlag_kNullable];
>
> only in a SQL statement:
>
> 		query = @"CREATE TABLE Person ("
> 				"ParentPtr objectptr, "  //how indicate target, on delete,  
> flags  in sql???
> 				" FirstName string (40))";
>
> 			[mDatabase sqlExecute:query];
>
> I realize this is probably in the archives, but there is no quick  
> way to search the list archives right now, so if anyone knows it  
> off-hand I would sincerely appreciate it...
>
> thanks,
> Dave
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina


More information about the Valentina mailing list