Curt Hagenlocher wrote:
It's very unlikely that this was intentional. I suspect that it's
related to a change in the way we handle interfaces -- this wouldn't
be the first unanticipated consequence of that change. :/
:-)
Michael
On Mon, Jun 23, 2008 at 8:30 AM, Michael Foord
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
Note that we can fix it by iterating over 'row.ItemArray' instead,
I just wondered if the breakage was intentional.
Michael Foord
Michael Foord wrote:
Hello all,
I'm further investigating potential compatibility issues with
moving Resolver One to IronPython 2, and I've encountered a
change in behaviour with respect to iterating over DataRows.
The script below works in IronPython 1, printing all the data
in the rows. In IronPython 2.0 B3 it raises an exception.
IronPython 1:
C:\compile>c:\Binaries\ironpython\ipy.exe test_data.py
0 System.Data.DataRow
0 A Big Boy Did It and Ran Away
1 System.Data.DataRow
0 Affective Computing
2 System.Data.DataRow
0 Clear and Present Danger
IronPython 2:
C:\compile>c:\Binaries\ironpython2\ipy.exe test_data.py
0 <System.Data.DataRow object at 0x000000000000002B
[System.Data.DataRow]>
Traceback (most recent call last):
File "test_data.py", line 29, in test_data.py
TypeError: expected IEnumerator, got DataRow
Test script:
import clr
clr.AddReference('System.Data')
from System.Data import DataSet
from System.Data.Odbc import OdbcConnection, OdbcDataAdapter
connectString = (
"DRIVER={MySQL ODBC 3.51 Driver};"
"blah blah blah"
"OPTION=3;"
)
query = "SELECT title FROM books WHERE price > 2 ORDER BY title"
connection = OdbcConnection(connectString)
adaptor = OdbcDataAdapter(query, connection)
dataSet = DataSet()
connection.Open()
adaptor.Fill(dataSet)
connection.Close()
for rowIndex, row in enumerate(dataSet.Tables[0].Rows):
print rowIndex, row
for colIndex, data in enumerate(row):
print ' ', colIndex, data
Michael Foord
http://www.ironpythoninaction.com/
_______________________________________________
Users mailing list
[email protected] <mailto:[email protected]>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected] <mailto:[email protected]>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
------------------------------------------------------------------------
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com