Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: cpelster on May 24, 2007, 04:23:35 am

Title: SqlQuery SQL Syntax
Post by: cpelster on May 24, 2007, 04:23:35 am
Hi,

i wonder if there is any documentation on the SQLQuery query syntax, for example what SQL dialect to uses, how to escape characters and so on.
Since EA runs on many databeses i guess there is some kind of db abstraction behind this function?

regards,

 christian
Title: Re: SqlQuery SQL Syntax
Post by: mark.myers on October 16, 2007, 03:46:16 pm
Anyone got any info on this?
I'd like it too.
Title: Re: SqlQuery SQL Syntax
Post by: Eve on October 16, 2007, 06:07:16 pm
I would treat it as though you are making a direct query to the database being used.
Title: Re: SqlQuery SQL Syntax
Post by: mark.myers on October 16, 2007, 07:36:10 pm
Already tried that - doesn't work.

I've added an extra table to the repository to store some additional info and tried a query such as:

IF OBJECT_ID (N'dbo.ut_Configurations', N'U') IS NOT NULL SELECT ConfiguredValue FROM ut_Configurations WHERE ParameterName='BaseDirectory'

which is valid syntax for SQL Server and runs correctly in SQL Management Console but not via SQLQuery which returns an empty string.
Title: Re: SqlQuery SQL Syntax
Post by: bmioch on October 16, 2007, 09:06:06 pm
Personally, I would treat everything as Access.

From the EA Help for the parameter for SQLQuery: "SQL is a string containing an SQL Select Statement."

Your SQL has more than just a select statement. Does the select work on its own?
Title: Re: SqlQuery SQL Syntax
Post by: mark.myers on October 16, 2007, 09:55:12 pm
Yes the select by itself works fine. I just wanted to do a check for the existance of the table as not all repositories I connect to have it. I have worked around it by checking if it is a SQL repository (I know the EAP ones wont have it).

I needed to do this because SQLQuery displays a dialog box saying the table is not found if the table doesn't exist. I have my SQLQuery inside a try/catch but evidently SQLQuery doesn't throw an exception but rather displays the (unwanted) dialog. :(
Title: Re: SqlQuery SQL Syntax
Post by: bmioch on October 17, 2007, 03:12:04 pm
I would suggest you log the no-exception as a bug or feature request.