Updated: 25/03/2003; 11:27:05 p.m..
Andres Aguiar's Weblog
Right here, right now
        

Viernes, 01 de Noviembre de 2002

ADO.NET does not specify a standard way to set parameter markers in a SQL statement. For example, if you use the SQL Server Data Provider, you have to write:

Select CustomerName from Customers Where CustomerId = @CustomerId

But in Microsoft's Oracle Data Provider, you write:

Select CustomerName from Customers Where CustomerId = :CustomerId

If you decide to pay the performance price and write ANSI SQL to be able to access both databases, you will have to abstract the way the parameters are used, and write something like:

statement = "Select CustomerName from Customers Where CustomerId = " + AddParameter("CustomerId");

Where AddParameter adds a ":' or a "@" to the parameter name.

If you are writing code for one database and you don't care about the other databases, you are affected by this issue anyway. If you want to use, for example, Data Direct's .NET Provider for Oracle, you have to write:

Select CustomerName from Customers Where CustomerId = ?

So, if you don't abstract the way to add parameter markers, you are really coding against a specific Data Provider...

Do I like this behavior? Of course!! DeKlarit generates the Data Access Layer, so you just select the Data Provider and we generate the right sentences. The more difficult the things are for the programmer, the best for us ;).


6:51:54 PM    comment []

When less is more [IUnknown.com: John Lam's weblog on software developer]

We've being doing code-generation tools for more than 10 years. Needless to say, I totally agree with John.

 


10:38:47 AM    comment []

© Copyright 2003 Andres Aguiar.
 
November 2002
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Oct   Dec



Click here to visit the Radio UserLand website.

Subscribe to "Andres Aguiar's Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.