DB2 Plugin SQL Generation

2011-04-20 Thread Jeffrey Simpson
Thanks for the responses from my previous email DB2 Plugin testing.

I am working on the SQL Generation and so I looked at the sql generated from 
the MySql Plugin and the Postgress plugin.  I have a question related to PK 
generation support.  Here is a sample of the generated sql:

CREATE SEQUENCE Employee_seq;

CREATE TEMP TABLE EOF_TMP_TABLE AS SELECT SETVAL('Employee_seq', (SELECT 
MAX(id) FROM Employee));

DROP TABLE EOF_TMP_TABLE;

ALTER TABLE Employee ALTER COLUMN id SET DEFAULT nextval( 'Employee_seq' );


In the Create table and alter table scripts there is are 2 function calls  
setval and nextval.  Are these user defined functions?  If they are are there 
any examples?



Jeffrey Simpson
Senior Software Engineer
Telephone: 240.235.2144
Fax: 240.235.2174
simp...@yfu.org

Youth For Understanding (YFU) prepares young people for their responsibilities 
and opportunities in a changing, interdependent world.
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: DB2 Plugin SQL Generation

2011-04-20 Thread Chuck Hill
Hi Jeffrey,


On Apr 20, 2011, at 11:13 AM, Jeffrey Simpson wrote:

 Thanks for the responses from my previous email DB2 Plugin testing.
 
 I am working on the SQL Generation and so I looked at the sql generated from 
 the MySql Plugin and the Postgress plugin.  I have a question related to PK 
 generation support.  Here is a sample of the generated sql:
 
 CREATE SEQUENCE Employee_seq;
 
 CREATE TEMP TABLE EOF_TMP_TABLE AS SELECT SETVAL('Employee_seq', (SELECT 
 MAX(id) FROM Employee));
 
 DROP TABLE EOF_TMP_TABLE;
 
 ALTER TABLE Employee ALTER COLUMN id SET DEFAULT nextval( 'Employee_seq' );
 
 In the Create table and alter table scripts there is are 2 function calls  
 setval and nextval.  Are these user defined functions?  If they are are there 
 any examples?


I think those are db specific.  You need to figure out what you want it to emit 
for DB2, then look at 
com.webobjects.eoaccess.synchronization.EOSchemaSynchronizationFactory

You will want a sub-class of this in your plugin, see public 
EOSchemaSynchronizationFactory createSchemaSynchronizationFactory() in 
JDCBPlugin.  You can override the methods to produce appropriate SQL for DB2.


Chuck

-- 
Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects









smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com