Compare Schema classes to database

Phil (OmnisList) phil at pgpotter.co.uk
Thu Sep 15 21:37:11 UTC 2022


Hi Andrew,

We have code in our software, which looks for schema changes compared to 
the SQL database, so that it can modify the database and keep it up to 
date with the current library schemas layout...

For starters you can use this Omnis command to fetch the SQL tables on 
the database:

DotSession.$newstatement(#CT)Returns loStatObj

DoloStatObj.$tables(kStatementServerTable)

and then for columns within that table:

DotSession.$newstatement(#CT)Returns loStatObj

DoloStatObj.$columns(pcTableName)

 From this information, you can compare your internal schemas, with 
those held on the database.

If you need to go further and check each column matches the format 
within the Omnis Schema

DolrLocalRow.$createnames()


Will provide you with the matching format your schema would create upon 
this server...
So you can then compare column by column for changes.

I believe these are standard DAM methods, so should work with most, if 
not all SQL back ends.

Phil.

On 15/09/2022 17:39, Andrew Stolarz wrote:
> Hi All,
>
> Is there an easy way to compare my Schema classes in Omnis to my MySQL
> schema?
>
> Anyone else do something like this?
>
>
> Andrew
> _____________________________________________________________
> Manage your list subscriptions athttps://lists.omnis-dev.com
> Start a new message ->mailto:omnisdev-en at lists.omnis-dev.com  


More information about the omnisdev-en mailing list