datetime and 64 bit patch
Harri Pasanen <[email protected]> Thu, 12 Oct 2006 11:09:16 +0200
| Newsgroups | gmane.comp.python.sybase |
|---|---|
| Organization | Wallstreet Systems |
| Message-ID | <[email protected]> |
Hi, Please find attached the patches I use over vanilla sybase-0.37 to make it work on 64 systems, using python's native datetime type. I've tested it on Sybase 12.5 Mandriva 2006 32 and 64 bit, python 2.4.1, gcc 4.0.1 RedHat ES 4 64 bit, python 2.3.4, gcc 3.4.3 HP-UX 11.23 Itanium 64 bit, python 2.4, gcc 3.4.3 Regards, Harri Privileged or confidential information may be contained in this message. If you are not the addressee of this message please notify the sender by return and thereafter delete the message, and you may not use, copy, disclose or rely on the information contained in it. Internet e-mail may be susceptible to data corruption, interception and unauthorised amendment for which Wall Street Systems does not accept liability. Whilst we have taken reasonable precautions to ensure that this e-mail and any attachments have been swept for viruses, Wall Street Systems does not accept liability for any damage sustained as a result of viruses. Statements in this message or attachments that do not relate to the business of Wall Street Systems are neither given nor endorsed by the company or its Directors. _______________________________________________ Python-sybase mailing list [email protected] https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase
syb_datetime64.patch
(text/x-diff, 3.6 KB)
diff -c sybase-0.37/Sybase.py sybase-0.37.2/Sybase.py
*** sybase-0.37/Sybase.py Thu Apr 7 00:46:43 2005
--- sybase-0.37.2/Sybase.py Thu Oct 12 10:22:25 2006
***************
*** 3,28 ****
#
# LICENCE - see LICENCE file distributed with this software for details.
#
- try:
- import DateTime
- use_datetime = 1
- except ImportError:
- try:
- import mx.DateTime
- DateTime = mx.DateTime
- use_datetime = 1
- except ImportError:
- use_datetime = 0
import sys
import time
import string
import threading
from sybasect import *
from sybasect import __have_freetds__
set_debug(sys.stderr)
! __version__ = '0.37'
# DB-API values
apilevel = '2.0' # DB API level supported
--- 3,19 ----
#
# LICENCE - see LICENCE file distributed with this software for details.
#
import sys
import time
import string
import threading
+ import datetime as pydatetime
from sybasect import *
from sybasect import __have_freetds__
set_debug(sys.stderr)
! __version__ = '0.37.2'
# DB-API values
apilevel = '2.0' # DB API level supported
***************
*** 224,233 ****
def _column_value(val):
! if use_datetime and type(val) is DateTimeType:
! return DateTime.DateTime(val.year, val.month + 1, val.day,
! val.hour, val.minute,
! val.second + val.msecond / 1000.0)
else:
return val
--- 215,224 ----
def _column_value(val):
! if type(val) is DateTimeType:
! return pydatetime.datetime(val.year, val.month + 1, val.day,
! val.hour, val.minute,
! val.second, val.msecond*1000)
else:
return val
Common subdirectories: sybase-0.37/doc and sybase-0.37.2/doc
Common subdirectories: sybase-0.37/examples and sybase-0.37.2/examples
diff -c sybase-0.37/setup.py sybase-0.37.2/setup.py
*** sybase-0.37/setup.py Thu Apr 7 00:46:43 2005
--- sybase-0.37.2/setup.py Thu Oct 12 10:22:25 2006
***************
*** 31,36 ****
--- 31,40 ----
ocs = os.environ['SYBASE_OCS']
sybase = os.path.join(sybase, ocs)
+ have64bit = False
+ if sys.maxint > 2147483647:
+ have64bit = True
+
if os.name == 'posix': # unix
# Most people will define the location of their Sybase
# installation in their environment.
***************
*** 51,56 ****
--- 55,62 ----
else:
lib_names = ['blk', 'ct', 'cs', 'tcl', 'comn', 'intl']
for name in lib_names:
+ if have64bit:
+ name += '_r64'
lib_name = os.path.join(sybase, 'lib', 'lib%s.a' % name)
if os.access(lib_name, os.R_OK):
syb_libs.append(name)
***************
*** 96,101 ****
--- 102,111 ----
syb_macros = [('WANT_BULKCOPY', None)]
+ if have64bit:
+ syb_macros.append(('SYB_LP64', None))
+
+
# distutils does not allow -D HAVE_FREETDS=60 so I have to find this
# argument myself and remove it from sys.argv and set the macro via
# the define_macros argument to the extension module.
***************
*** 179,185 ****
sdist.run(self)
setup(name="sybase",
! version="0.37",
maintainer="Dave Cole",
maintainer_email="[email protected]",
description="Sybase Extension to Python",
--- 189,195 ----
sdist.run(self)
setup(name="sybase",
! version="0.37.2",
maintainer="Dave Cole",
maintainer_email="[email protected]",
description="Sybase Extension to Python",