Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IB5.1, ODBC and Parsing SQL string

Status
Not open for further replies.

SupaSi

Programmer
Aug 9, 2001
8
0
0
GB
I've inherited a global network of Interbase 5.1 based databases. I'm writing an application in .Net (don't worry, this isn't a cross post ;-) ) and amongst other things I'd like to incorporate a SQL string parse function that operates in a similar way to that of MS Query Analyser. I've used the SQL Server functions SET PARSEONLY and SET NOEXEC before with no problems, but I don't seem to be able to find an equivalent in Interbase. I've looked at the documentation for IB 5.5 and there is mention of a PREPARE statement that may be useful. I'm connecting to each database via ODBC using the Interbase Intersolv driver v 3.10.00.00. When I try a prepare statement, I get the following error:

Code:
Microsoft.Data.Odbc.OdbcException: ERROR [37000] [INTERSOLV][ODBC InterBase driver][InterBase]Dynamic SQL Error, SQL error code = -104, Token unknown - line 1, char 0, PREPARE
--- error message truncated

This is the same error (more or less) reported when I try running the same sql through the (awful) WISQL tool that comes with Interbase.

I'd appreciate any help received. I should say that any 'upgrade or replace' Interbase solutions are no-go as the current setup will 'have-to-do' until I can replace it with a better solution (like anything!!! ;-) can you tell I've developed a dislike for Interbase??! )

Thanks

Simon
 
I don't think that PREPARE is what you are looking for. It appears to be a DSQL statement for use in embedded SQL, not something you can use directly as part of an SQL statement.

Take a look at Interbase 6 - it's open source so you could look at the parsing code itself (if all else fails).
 
Thanks Pat, but like I said, upgrading isn't an option. Nothing like being restricted to legacy systems eh? Looks like I'm going to have to write my own parser...[mad]
 
Like I said, you can download the source code for IB6 - you don't have to implement it in your production environment - but you look in the code to see how they do the parsing and then use this info to implement your own parser.

Personally, I like Interbase as a DBMS, but the supplied UIs are awful.
 
What are you trying to accomplish? Why do you think "prepare" will solve your problem? (it doesn't because you get an error - but what IS your problem?) Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
 
Martjin,

I thought my post said it all with regard to my problem. What I want to be able to do is check a sql script against the Interbase parser without executing it. I'll be writing a number of scripts to be executed on a number of IB 5.5 instances and a parse facility would be useful. Since upgrading each of the IB instances (there are hundreds!) isn't an option and replacement with my preferred DB platform (MSDE) is a long term solution, I think I'll have to make do for now.

Incidentally, I took a look at the Interbase site and I don't think I've seen a site where information was harder to find... Ok, maybe MSDN [wink]
 
Well, "preparing" helps - but it's not a single statement. It's more of an API call. I bet the .NET classes have some kind of "Prepare" method that maps to this, or should map to this...

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top