Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sql for VFP & Sql Server
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00619381
Message ID:
00619395
Views:
14
Hi!

If this is just for some application, it is MUCH better to do this by another way. Parsing of SQL Statement might be way too complex, so will cost a lot. Even if you will find third-party tool, I doubt it will be reliable enough to cover all cases that might occur in VFP application. More, some things that exists in VFP do not exist in SQL Server and vise versa.

The better solution is to create a table that will store all SQL Select statements in your application. There will be 2 query texts in a single row - one for VFP and one for SQL Server. Then you will have a generic program/function that will run a query depended on a global setting that determine where is a database. This generic routine can serve also a lot of otehr tasks - create an updatabale SPT cursor when needed, options for which also could be store in mentioned table. THis table could be used to re-create local and remote views in the databas eusing queries stored and parameters for them. And you still have a very flexible and simple approach for scalability for database server - when moving to Oracle, for example, you will just add a new column in that table and fix that generic routine slightly, and all will work... In the code you will have to use that routine instead of the direct query. Just identify query by some string. Only one place where problems could occur is creating WHERE conditions dynamically for filtering the query result. In such case you can do also a generic class for that that accepts filtering expression parts (fields, values etc.) and operator, after what it returne a string ready fo WHERE condition that is in the format appropriate to the server.

As you see, there is very little need in the parser like you mentioned.

HTH.

>Hi folks
>
>I need to be able to throw sql statements at either VFP or Sql Server and am toying with the idea of writing some sort of 'parser' routine which will handle syntax differences between the 2 eg INLIST for IN, .t./.f., dates etc etc
>
>Before I dive in, does anyone know of any third party software that could do this ?
>
>Regards
>
>Kal
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform