It looks to me like the idea behind this patch has been incorporated already, if not the methodology. As far as I can see, checking in this patch would just move some code around.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
dest.execute('create table #tbcp (a smalldatetime)') # Works for datetime
bcp = Sybase.Bulkcopy(dest, '#tbcp', Sybase.CS_BLK_IN, arraysize=2)
bcp.rowxfer(['1-jan-2000'])
For datetime columns, this works. For smalldatetime, in 0.40pre1, this fails:
Sybase version 0.40pre1 CT 0.40pre1
Traceback (most recent call last):
File "t_bcpin_smalldatetime.py", line 14, in <module>
bcp.rowxfer(['1-jan-2000'])
File "/import/development/gnb/python-sybase-0.40pre1/Sybase.py", line 1331, in rowxfer
self.bufs[i][self._nextrow] = value
TypeError: datetime expected
With my patch applied to an older 0.39 version, it works:
Sybase version 0.39.1 CT 0.39
[('Jan 1 2000 12:00AM',)]
OK.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It looks to me like the idea behind this patch has been incorporated already, if not the methodology. As far as I can see, checking in this patch would just move some code around.
Not so... consider this snipped of test case:
dest.execute('create table #tbcp (a smalldatetime)') # Works for datetime
bcp = Sybase.Bulkcopy(dest, '#tbcp', Sybase.CS_BLK_IN, arraysize=2)
bcp.rowxfer(['1-jan-2000'])
For datetime columns, this works. For smalldatetime, in 0.40pre1, this fails:
Sybase version 0.40pre1 CT 0.40pre1
Traceback (most recent call last):
File "t_bcpin_smalldatetime.py", line 14, in <module>
bcp.rowxfer(['1-jan-2000'])
File "/import/development/gnb/python-sybase-0.40pre1/Sybase.py", line 1331, in rowxfer
self.bufs[i][self._nextrow] = value
TypeError: datetime expected
With my patch applied to an older 0.39 version, it works:
Sybase version 0.39.1 CT 0.39
[('Jan 1 2000 12:00AM',)]
OK.
I believe this now works, so if it doesn't please attach an example that reproduces the problem.