Subject Re: [IBO] Update components
Author Lee Jenkins
----- Original Message -----
From: "rodbracher" <rod@...>
To: <IBObjects@yahoogroups.com>
Sent: Saturday, May 08, 2004 3:10 AM
Subject: [IBO] Update components


> Are there IBO components to assist with database metadata compare and
> update/syncronize?
>
> I found a VCL database comparer by CleverComponents but this is ony
> supported with IBX or FBPlus.
>
> It would be a mission to have to maintain two IB connectivity
> packages (And I already use IBO).
>
> Any ideas?


Hopefully, CleverComponents will port over to IBO as well. I always thought
that a component that did this accurately would sell.

I have done something like this using the IBOScript component. In my
database, I have a field (double) that holds the current "database version".
Whenever I make updates to my software that requires metadata changes to the
database, I post the changes to a .sql text file on my website in the form
of:

#4.5%
ALTER TABLE PRODUCTS
ADD NOCACHE BLANKSMALLINT;
&UPDATE Products SET NoChache = 0;
#4.6%
ALTER TABLE Poop
ADD STINKY BLANKSMALLINT;
&UPDATE Poop SET Stinky = 1;
*End*


On the customer site, my utility downloads the .sql file, parses it into two
TStringLists. One for metadata changes, the other for DML. For instance,
the example above, if my "database version" was 4.5, I would skip over the
first part. On the second part, I would add the ALTER statement to my first
stringlist and the UPDATE (denoted by the "&") to my second stringlist.

After parsing the whole file, I start a tranny for the metadata script/s,
asign the first stringlist to the text property of the the IBOScript
component, run it and either commit or rollback the tranny depending on if
there are errors, etc. If everything goes well, I run the second script
held in the second stringlist in a transaction as well.

I run the DML separately from the metadata scripts because I would get
transaction errors/conflicts by running everything together sometimes. So
now, I run the metadata script and the DML script separately and its worked
very well so far.

If you want to see the source for it, just send me a private email. I used
sunisoft theme components with this project, but if you don't have them, you
can still check out the source/flow anyway.

Warm Regards,

Lee