[IronPython] Database Engine for Django on IronPython

Vernon Cole vernondcole at gmail.com
Sat Oct 24 00:36:27 CEST 2009


Good question. It made me look up the documentation. The answer is a
definite "sometimes".  I have always used the OleDb client, so I have only
experienced the qmark.  I quote from the Microsoft documentation........
V V V V V V V V V V V V V V V V V V V V V

The syntax for parameter placeholders depends on the data source. The .NET
Framework data providers handle naming and specifying parameters and
parameter placeholders differently. This syntax is customized to a specific
data source, as described in the following table.

Data provider

Parameter naming syntax

System.Data.SqlClient<http://msdn.microsoft.com/en-us/library/system.data.sqlclient%28lightweight%29.aspx>

Uses named parameters in the format @parametername.

System.Data.OleDb<http://msdn.microsoft.com/en-us/library/system.data.oledb%28lightweight%29.aspx>

Uses positional parameter markers indicated by a question mark (?).

System.Data.Odbc<http://msdn.microsoft.com/en-us/library/system.data.odbc%28lightweight%29.aspx>

Uses positional parameter markers indicated by a question mark (?).

System.Data.OracleClient<http://msdn.microsoft.com/en-us/library/system.data.oracleclient%28lightweight%29.aspx>

Uses named parameters in the format :parmname (or parmname).I
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^

So it would appear that if I always use the OleDb provider, then I always
have qmark parameter style, even if I am opening an Oracle data base. The
conversion from pyformat to qmark would be done programatically in adodbapi.
There may still be a problem with differences in dialect between different
SQL engines. I think many of those are coded in to the various database
front ends, so that an "interchangable" adapter would still need to know
what engine it is using and make some changes to adapt itself.  For example,
do you use "TOP" or "LIMIT" to restrict the number of rows requested? MS-SQL
uses "TOP" while MySQL uses "LIMIT", both through the OleDb provider. I
definitely do not want to be restricted to only MS-SQL from
IronPython/django. The existing django-mssql code is engine specific.  I
would like to remove that restriction, but do not know (yet) if that is
possible. adodbapi itself is engine agnostic.
--
Vernon

On Fri, Oct 23, 2009 at 2:43 PM, Josh <josh at globalherald.net> wrote:

> Vernon Cole wrote:
>
> "The big thing will be paramstyle format convertion. MS-SQL uses qmark. I
> am told that django wants pyformat."
>
> Quick question.  Is this new database driver going to be specific to
> MS-SQL, or does the ADO.NET specification specify qmark in place of
> Pyformat?
>
> The reason I ask is it would be really slick to be able to use any ADO.NETdata source on the back end.  It would be even slicker if we could do this
> interchangeably.  For example, suppose you have a Django site running under
> RHEL + Apache + PostgreSQL.  It would be nifty if you could take the same
> code, with little or no modification, and run it under IIS + IronPython
> against that same PostgreSQL database using one of the PostgreSQL .NET data
> providers.
>
> Cheers,
> -Josh
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20091023/d0a63d89/attachment.html>


More information about the Ironpython-users mailing list