Hi Vernon,

Yes, you're right on both counts, it's likely to be a bug in the
provider, and given that VFP is no longer in development, I doubt that
a patch for such bugs will be made available.

While implementing executedirect() will definitely help fix my issue
here, but will it also mean that adodbapi will be less DB-API 2.0
compliant? If executedirect() is going to be like skipping Refresh()
and building the parameter list directly, may I suggest to have some
sort of variables like cursor.cmd, e.g. "cursor.refresh = True
(default) | False" so that cursor.execute() still behaves the same way
using Refresh() all normal cases and for cases like my buggy provider
I can simply configure "cursor.refresh = False" before invoking
cursor.execute(). That way the meanings of the execute() family can
remain consistent.

Regards,
Kenneth

On Mon, Aug 27, 2012 at 12:56 PM, Vernon Cole <vernondc...@gmail.com> wrote:
> Kenneth:
>
>   Sounds like a bug in the provider, doesn't it.  I would not expect to see
> a patch, so it's a good thing you found a work-around.
>
> You asked if there might be a way to always build the parameter list
> manually.  Perhaps we can add one.  I happily adopt features from other db
> api implementations, and happily noticed in the latest version of mxodbc
> that they adopted one of mine. Mxodbc has a cursor method which might be
> some use here.  From their current documentation:
>
> <quote>
> .executedirect(sqlcmd, parameters=())
> This method works just like .execute(), except that no prepare step is
> issued and the sqlcmd is not cached. This can result in better performance
> with some ODBC driver setups, but also implies that Python type binding mode
> is used to bind the parameters.
> </quote>
>
> I guess that "Python type binding mode" means that the parameter list is
> built the same way as when .refresh() fails in ._buildADOparameterList().
> -----------------------------------------------------------------------------------------------------
> Dear Group:
>
> What are your thoughts about adding an .executedirect() method?
>
> What about a .prepare() method, too?
> --
> Vernon
>
>
> On Sun, Aug 26, 2012 at 10:32 AM, Kenneth Chin <kenneth.c...@codebless.com>
> wrote:
>>
>> Hi,
>>
>> I have developed a Windows app using Python to access Visual FoxPro
>> database using OLE DB Provider. Whenever I use parameterized query, it
>> failed with the following error:
>>
>> (-2147352567, 'Exception occurred.', (0, u'ADODB.Parameters', u'Item
>> cannot be found in the collection corresponding to the requested name
>> or ordinal.', u'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240649, -2146825023),
>> None)
>>
>> I noticed that adodbapi._buildADOparameterList() invokes
>> self.cmd.Parameters.Refresh(). After Refresh() is called, the
>> Parameters.Count() becomes 0. When I comment out this and forced
>> adodbapi to manually build the parameter list, it works.
>>
>> Can adodbapi provide some ways to configure so that it has an option
>> to always build the parameter list manually?
>>
>> As an additional note, the original adodbapi (i.e. with Refresh())
>> works fine with the OLEDB for Access 2007
>> [Provider=Microsoft.ACE.OLEDB.12.0], it just failed with OLEDB for VFP
>> [Provider=VFPOLEDB.1] unless Refresh() is not called.
>>
>> Thanks.
>>
>> Regards,
>> Kenneth Chin
>>
>> -----
>>
>> Environment: Windows XP Pro SP3, Python 2.7.3, pywin32-217, adodbapi
>> 2.4.2.2, OLEDB for VFP 9.0 [1]
>>
>> [1] Microsoft OLE DB Provider for Visual FoxPro 9.0
>> http://www.microsoft.com/en-us/download/details.aspx?id=14839
>> _______________________________________________
>> python-win32 mailing list
>> python-win32@python.org
>> http://mail.python.org/mailman/listinfo/python-win32
>
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to