Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Create DB using code
Wed, Oct 1 2008 7:12 PMPermanent Link

Pierre du Plessis
Good Day,

I'm sure this question has been answered, but I can't find it.  Once a database has been
reverse engineered, what's the best way to create the database(s) using code when the
application are deployed, considering they may already exists?  With DBISAM, I used the
"IF NOT EXISTS" clause at a table/index level, and would like to accomplish more or less
the same using EDB 2.

Many thanks,
Pierre
Wed, Oct 1 2008 7:45 PMPermanent Link

"David Cornelius"
> I'm sure this question has been answered, but I can't find it.  Once
> a database has been reverse engineered, what's the best way to create
> the database(s) using code when the application are deployed,
> considering they may already exists?  With DBISAM, I used the "IF NOT
> EXISTS" clause at a table/index level, and would like to accomplish
> more or less the same using EDB 2.

You'll need to query the Information database and the Tables table.
For frequent usage, you'll probably want to write a function to do this
so the resulting SQL could like this:

 IF    NOT TableExists('TableName') THEN
   EXECUTE IMMEDIATE 'CREATE TABLE "TableName" ...';
 END IF;

For an example of this function, check out the thread in the extensions
newsgroup with the subject "TableExists function."

--
David Cornelius
CorneliusConcepts.com
Thu, Oct 2 2008 4:01 AMPermanent Link

Pierre du Plessis
Thanks David, this was helpful.

Best regards,
Pierre
Image