[Zope-DB] DCOracle2 OracleDate and parameter sequence problem

Matthew T. Kromer matt@zope.com
Tue, 09 Oct 2001 10:37:11 -0400


This is a multi-part message in MIME format.
--------------020105010107060505050506
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Christopher Jenkins wrote:

>Thank you very much for this fix.  I have discovered a couple
>of other (related?) issues with strings and executemany().
>
>Suppose you have a table created by
>
>create table t (s char(10));
>
>Then from Python, given a cursor object object con:-
>
>>>>l1=[(None,),("hello",),(None,)]
>>>>l2=[("",),("hello",),("",)]
>>>>stmt="insert into t values (:1)"
>>>>cur.executemany(stmt,l1) 
>>>>
>4
>
>This call inserts three NULL values into the table
>(ie. "hello" does not get inserted).  Continuing
>
>>>>cur.executemany(stmt+ " ",l2) # Force reparse
>>>>
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>  File
>"/home/cjenkin1/oracle/Products/DCOracle2/DCOracle2/DCOracle2.py",
>line 921, in executemany
>    result = self._cursor.execute(batchend-batchstart)
>dco2.DatabaseError: (1480, 'ORA-01480: trailing null missing from STR
>bind
>value')
>
Using the test program I attached, I cant reproduce your error on my 
system; I did put another change into DCOracle2 yesterday; I trust you 
grabbed the CVS version?


--------------020105010107060505050506
Content-Type: text/plain;
 name="stest.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="stest.py"

#

import DCOracle2

db = DCOracle2.connect('scott/tiger')
c = db.cursor()

try:
    c.execute('drop table stest')
except DCOracle2.DatabaseError: pass


c.execute('create table stest (s char(10))')

l1 = [(None,),("hello",),(None,)]
l2 = [("",),("hello",),("",)]

stmt = "insert into stest values(:1)"

c.executemany(stmt, l1)
c.executemany(stmt, l2)

c.execute('select * from stest')
print c.fetchall()

--------------020105010107060505050506--