Menu

#10 Allow strings for smalldatetime

closed-out-of-date
nobody
None
5
2011-12-05
2010-12-20
No

datetime types allow strings (suitably formatted) to be used to set values. Smalldatetime doesn't, due to cut-n-paste.

Discussion

  • Gregory Bond

    Gregory Bond - 2010-12-20
     
  • Robert Boehne

    Robert Boehne - 2010-12-20

    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.

     
  • Gregory Bond

    Gregory Bond - 2010-12-20

    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.

     
  • Robert Boehne

    Robert Boehne - 2011-12-05

    I believe this now works, so if it doesn't please attach an example that reproduces the problem.

     
  • Robert Boehne

    Robert Boehne - 2011-12-05
    • status: open --> closed-out-of-date
     

Log in to post a comment.

MongoDB Logo MongoDB