Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL / Oracle Conversion
Message
General information
Forum:
Microsoft SQL Server
Category:
Database design
Miscellaneous
Thread ID:
01248104
Message ID:
01248362
Views:
20
>I a building an VFP app that passes client-side queries through a .Net data access class to either MS SQL or Oracle, depending on which DB we're connected to.
>
>I would like to create a C# component that simple receives a call, such as GetClientName(), and then
>returns the data regarldless of the DB.
>
>Stored proc's are out as we don't want to maintain a different base of code in each DB.
>
>The problem then is that storing the queries in a C# class means formatting the queries and commands
>to the target DB.
>
>Can anyone point me in the right direction on this?
>
>Thanks

You see that either way you have to support multiple back ends right? So multiple bases of code are necessary or did someone have a magic wand that I didn't download?

Are your tables IDENTICAL between db servers? If so you could write the initial SQL syntax in your favorite flavor T or P SQL. Put it all in string builder objects.

then build a super function that can convert all the
select department_name, city
from department d
Left JOIN location l
ON d.location_id = l.id
to
select department_name, city
from department d
JOIN location l
ON (d.location_id = l.id)

The latest version of Oracle are much closer then that old crap of
where d.department_id = l.id(+)

sql as StringBuilder = new Stringbuilder;
// fill that beast up

now fix if necessary:
if (TsqltoP(sql))
{
// code because it's all good
}

Looks easy because this is a lie. There is no easy way to do this.
Previous
Reply
Map
View

Click here to load this message in the networking platform