Sorry to be slow getting back... I'm on vacation.
In attempting to make a test case as you have requested, I suddenly run in
to the following problem:

<console dump>
C:\temp>ipy ipy_bug.py

C:\temp>"c:\program files\Ironpython 2.0.2\ipy.exe" ipy_bug.py
version= adodbapi v2.2.7a1
Executing the command: "select * from Products"
result rowcount shows as= 6. (Note: -1 means "not known")

result data description is:
            NAME TypeCd DispSize IntrnlSz Prec Scale Null?
      ItemNumber      3        4        4   10   255     1
        ItemName    202       12       50  255   255     1
     UnitsOnHand      4        4        4    7   255     1
     CostPerUnit    131       19       19   14     4     1
     LastOrdered      7        8        8  255   255     1

result first ten records are:
(1, 'Widgit', 5.0, Decimal("15.1234"), datetime.datetime(2009, 1, 29, 13, 5,
30)
)
(2, 'Thingamajig, Standard', 505.0, Decimal("0.1000"),
datetime.datetime(2009, 1
, 29, 15, 5, 19))
(3, 'Left Handed Smoke Shifter', 1.0, Decimal("1000000.0000"),
datetime.datetime
(2008, 4, 1, 12, 0))
(4, 'Gravel (Bulk)', 100.25, Decimal("32.4567"), datetime.datetime(2009, 1,
29,
13, 5, 31))
(5, 'Tube, Drinking, Plastic, For cold liquids', 500000.0,
Decimal("0.0013"), da
tetime.datetime(2009, 1, 29, 13, 5, 32))
(6, 'Annoy-A-Tron', 1.0, Decimal("12.9500"), datetime.datetime(2009, 1, 29,
13,
5, 33))

C:\temp>ipy26 ipy_bug.py

C:\temp>"c:\program files\Ironpython 2.6\ipy.exe" ipy_bug.py
version= adodbapi v2.2.7a1
Traceback (most recent call last):
  File "ipy_bug.py", line 52, in ipy_bug.py
AttributeError: 'module' object has no attribute 'adodbapi'
</console dump>

The offending line is:
adodbapi.adodbapi.defaultIsolationLevel = adodbapi.adXactBrowse

I never have understood why it was necessary to use the
adodbapi.adodbapi.(whatever) construct, but smarter people than me said that
was necessary, and they are correct.  If the redundant-looking entry is not
used, the programs runs without an error message, but does not actually
perform the intended function. If, for example, the line
adodbapi.adodbapi.defaultCursorLocation = adodbapi.adUseClient
is changed to
adodbapi.defaultCursorLocation = adodbapi.adUseClient
then the program will run, but the rowcount will return as -1, rather than
6, because the cursor is not actually changed to a local cursor.

So, to make a long story short: some change in IPy 2.6 has broken a needed
(if ugly looking) feature in adodbapi.
I will file a bug in codeplex as soon as I can isolate a good example.
--
Vernon



On Mon, Aug 3, 2009 at 5:33 PM, Dino Viehland <di...@microsoft.com> wrote:

>  Ok, I’ve finally got SQL server setup in a reasonable state where I can
> try and repro this.  This is what I’m trying to do.  I have a database
> called “mydatabase” which contains a table “Table_1” which contains 1 column
> of type binary(4).  I then attempt to do:
>
>
>
> import System
>
> conn =
> System.Activator.CreateInstance(System.Type.GetTypeFromProgID("ADODB.Connection"))
>
> connstr = "driver={SQL Server};Server=localhost;Database=mydatabase;Initial
> Catalog=mydatabase;Trusted_Connection=True;"
>
> conn.ConnectionString = connstr
>
> conn.Open()
>
>
>
> rs =
> System.Activator.CreateInstance(System.Type.GetTypeFromProgID("ADODB.RecordSet"))
>
> rs.Open("Table_2", conn, 1, 2, 2)  # source, active connection, cursor type
> (adOpenKeyset), lock type (adLockPessimistic), CommmandType (adCmdTable)
>
> rs.AddNew()
>
> b = System.Array[System.Byte]((2,3,4,5))
>
> x = rs['Test1']
>
> x.AppendChunk(b)
>
>
>
> which fails with:
>
>
>
> EnvironmentError: System.Runtime.InteropServices.COMException (0x800A0C93):
> Operation is not allowed in this context.
>
>
>
> This is the same failure I get if I use Shri’s proposed work around.  Do
> you have any idea of what I’m doing wrong or any suggestions on how to tweak
> this to get the correct simple repro?
>
>
>
> *From:* users-boun...@lists.ironpython.com [mailto:
> users-boun...@lists.ironpython.com] *On Behalf Of *Vernon Cole
> *Sent:* Thursday, July 23, 2009 10:11 PM
> *To:* Discussion of IronPython
> *Subject:* Re: [IronPython] [ANN]: IronPython 2.6 Beta 2
>
>
>
> Guys:
>   Good work on the new release, and the 215 bug fixes. As usual, as soon as
> the new beta was announced I downloaded and tested it.
>
> Somehow I got the idea that the adodbapi test had been included in the
> IronPython test suite. Did you only include the tests that already pass?
> Issue 18222 is still unfixed -- so adodbapi still fails, and you still
> cannot pass a read-only buffer as a COM parameter.
>
> I realize that no one has voted up this rather obscure bug. Perhaps if it
> were titled "fully support DB API 2.0 compliant database access using ADO"
> it would have gotten more votes. Nevertheless, this issue has been
> outstanding for 11 months, and is the only remaining failure in adodbapi for
> versions 2.3 thru 3.1 of python. Please try to get to it before 2.6 final.
>
> Please !!!???
> --
> Vernon Cole
>
> P.S. -- I plan to make a version of adodbapi which uses real ADO.NET,
> rather than ADO via COM, but I want the current version to be solid before I
> start mucking it up.
>
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to