Mark Hammond wrote: > Robert Brewer wrote: > > The small demo script below makes ADO calls to a Microsoft > > Access (Jet) > > database via win32com. But it fails in a potentially dangerous way; > > "SELECT int * int;" can return None with no warning if the result is > > large enough. This can also occur if one or both of the > > operands is a column reference. > > > > The same SQL run as a Query inside the Access GUI works as expected. > > Manually changing one of the ints to a Single by appending > > ".0" works as expected. > > > > Any ideas about where I need to look next to find the cause > > of, and then fix, this behavior? > > I'd suggest using VB to see if the behaviour is different > than with Python. If it is and we can narrow a test case to > a very small snippet, then we can probably sort out why. If > VB works the same, it is likely to be a "feature" of ADO as > implemented, and not much we can do.
Below is a VB 4 demo (wow, that takes me back! :). The return value on overflow is a zero-length string. Robert Brewer System Architect Amor Ministries [EMAIL PROTECTED] ' demo_access_overflow.bas Attribute VB_Name = "Module1" Option Explicit Const adOpenForwardOnly = 0 Const adLockReadOnly = 1 Const dbname = "test.mdb" Sub create_db() Dim cat As New ADOX.Catalog cat.Create "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbname cat.ActiveConnection.Close End Sub Function fetch(query, conn) As String Dim res As New ADODB.Recordset res.Open query, conn, adOpenForwardOnly, adLockReadOnly, -1 Dim Data As Variant Data = res.GetRows(1, 0) fetch = Data(0, 0) res.Close End Function Sub Main() create_db Dim conn As New ADODB.Connection conn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source='" & dbname & "'", "", "", -1 ' This works fine. Dim Data As String Data = fetch("SELECT 86400;", conn) If Data <> 86400 Then MsgBox (Data) ' This fails because data is "" Data = fetch("SELECT 62647 * 86400;", conn) If Data <> CStr(CSng(62647) * CSng(86400)) Then MsgBox (Data & " (len " & Len(Data) & ")") End If conn.Close Kill dbname End Sub _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32