[pywin32-checkins] pywin32/adodbapi adodbapi.py, 1.4, 1.5 readme.txt, 1.4, 1.5
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Vernon C. <kf...@us...> - 2008-11-11 23:54:33
|
Update of /cvsroot/pywin32/pywin32/adodbapi In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32365 Modified Files: adodbapi.py readme.txt Log Message: Index: adodbapi.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/adodbapi/adodbapi.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** adodbapi.py 5 Sep 2008 18:49:30 -0000 1.4 --- adodbapi.py 11 Nov 2008 23:54:29 -0000 1.5 *************** *** 1,3 **** ! """adodbapi v2.2.1 - A python DB API 2.0 interface to Microsoft ADO Copyright (C) 2002 Henrik Ekelund --- 1,3 ---- ! """adodbapi v2.2.2 - A python DB API 2.0 interface to Microsoft ADO Copyright (C) 2002 Henrik Ekelund *************** *** 18,25 **** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! version 2.1 by Vernon Cole -- update for Decimal data type (requires Python 2.4 or above or or Python 2.3 with "import win32com.decimal_23") all uses of "verbose" below added by Cole for v2.1 """ import string --- 18,30 ---- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! version 2.1 (and later) by Vernon Cole -- update for Decimal data type (requires Python 2.4 or above or or Python 2.3 with "import win32com.decimal_23") all uses of "verbose" below added by Cole for v2.1 """ + # N.O.T.E.:... + # if you have been using an older version of adodbapi and are getting errors because + # numeric and monitary data columns are now returned as Decimal data, + # try adding the following line to get that data as strings: ... + #adodbapi.variantConversions[adodbapi.adoExactNumericTypes]=adodbapi.cvtString # get currency as strings import string *************** *** 45,49 **** DateTime = types.NotImplementedType #impossible value except ImportError: # implies running on IronPython ! from System import Activator, Type, DBNull, DateTime from clr import Reference def Dispatch(dispatch): --- 50,55 ---- DateTime = types.NotImplementedType #impossible value except ImportError: # implies running on IronPython ! from System import Activator, Type, DBNull, DateTime, Array, Byte ! from System import Decimal as SystemDecimal from clr import Reference def Dispatch(dispatch): *************** *** 315,326 **** class Connection(object): def __init__(self,adoConn): self.adoConn=adoConn self.supportsTransactions=False ! for indx in range(adoConn.Properties.Count): ! if adoConn.Properties[indx].Name == 'Transaction DDL': ! if adoConn.Properties[indx].Value != 0: #v2.1 Albrecht ! self.supportsTransactions=True ! break self.adoConn.CursorLocation = defaultCursorLocation #v2.1 Rose if self.supportsTransactions: --- 321,343 ---- class Connection(object): + from adodbapi import Warning, Error, InterfaceError, DataError, \ + DatabaseError, OperationalError, IntegrityError, InternalError, \ + NotSupportedError, ProgrammingError #required by api definition def __init__(self,adoConn): self.adoConn=adoConn self.supportsTransactions=False ! if win32: ! for indx in range(adoConn.Properties.Count): ! if adoConn.Properties[indx].Name == 'Transaction DDL': ! if adoConn.Properties[indx].Value != 0: #v2.1 Albrecht ! self.supportsTransactions=True ! break ! else: # Iron Python ! for indx in range(adoConn.Properties.Count): ! name = adoConn.Properties.Item[indx].Name ! if name == 'Transaction DDL': ! if adoConn.Properties.Item[indx].Value != 0: #v2.1 Albrecht ! self.supportsTransactions=True ! break self.adoConn.CursorLocation = defaultCursorLocation #v2.1 Rose if self.supportsTransactions: *************** *** 442,446 **** self.adoConn=None - class Cursor(object): description=None --- 459,462 ---- *************** *** 500,505 **** def _returnADOCommandParameters(self,adoCommand): retLst=[] ! for i in range(adoCommand.Parameters.Count): ! p=adoCommand.Parameters[i] if verbose > 2: print 'return', p.Name, p.Type, p.Direction, repr(p.Value) --- 516,524 ---- def _returnADOCommandParameters(self,adoCommand): retLst=[] ! for i in range(adoCommand.Parameters.Count): ! if win32: ! p=adoCommand.Parameters[i] ! else: ! p=adoCommand.Parameters.Item[i] if verbose > 2: print 'return', p.Name, p.Type, p.Direction, repr(p.Value) *************** *** 528,532 **** self.description=[] for i in range(nOfFields): ! f=rs.Fields[i] name=f.Name type_code=f.Type --- 547,554 ---- self.description=[] for i in range(nOfFields): ! if win32: ! f = rs.Fields[i] ! else: # Iron Python ! f=rs.Fields.Item[i] name=f.Name type_code=f.Type *************** *** 617,621 **** if cnt<>len(parameters): for i in range(cnt): ! if self.cmd.Parameters[i].Direction == adParamReturnValue: returnValueIndex=i break --- 639,647 ---- if cnt<>len(parameters): for i in range(cnt): ! if win32: ! dir = self.cmd.Parameters[i].Direction ! else: ! dir = self.cmd.Parameters.Item[i].Direction ! if dir == adParamReturnValue: returnValueIndex=i break *************** *** 624,628 **** if parmIndx == returnValueIndex: parmIndx+=1 ! p=self.cmd.Parameters[parmIndx] if verbose > 2: print 'Parameter %d ADOtype %d, python %s' % (parmIndx,p.Type,type(elem)) --- 650,657 ---- if parmIndx == returnValueIndex: parmIndx+=1 ! if win32: ! p=self.cmd.Parameters[parmIndx] ! else: # Iron Python ! p=self.cmd.Parameters.Item[parmIndx] if verbose > 2: print 'Parameter %d ADOtype %d, python %s' % (parmIndx,p.Type,type(elem)) *************** *** 657,660 **** --- 686,692 ---- p.Value = s p.Size = len(s) + elif isinstance(elem, long) and not win32: # Iron Python Long + s = SystemDecimal(elem) + p.Value = s else: p.Value=elem *************** *** 1215,1218 **** --- 1247,1256 ---- raise + def cvtBuffer(variant): + return buffer(variant) + + def cvtUnicode(variant): + return unicode(variant) + def identity(x): return x *************** *** 1237,1244 **** def convertVariantToPython(variant, adType): ! #if verbose > 2: ! # print 'Converting type_code=%s, val=%s'%(adType,repr(variant)) ! # print ' str=%s'%str(variant) ! # print 'conversion=',repr(variantConversions[adType]) if isinstance(variant,DBNull): return None --- 1275,1282 ---- def convertVariantToPython(variant, adType): ! if verbose > 3: ! print 'Converting type_code=%s, val=%s'%(adType,repr(variant)) ! print 'conversion function=',repr(variantConversions[adType]) ! print ' output=%s'%repr(variantConversions[adType](variant)) if isinstance(variant,DBNull): return None *************** *** 1255,1259 **** adoRowIdTypes: int, adoStringTypes: identity, ! adoBinaryTypes: identity, ! adoRemainingTypes: identity ! }) --- 1293,1296 ---- adoRowIdTypes: int, adoStringTypes: identity, ! adoBinaryTypes: cvtBuffer, ! adoRemainingTypes: identity }) Index: readme.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/adodbapi/readme.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** readme.txt 5 Sep 2008 18:49:30 -0000 1.4 --- readme.txt 11 Nov 2008 23:54:29 -0000 1.5 *************** *** 20,24 **** Note: as of 2.1.1, adodbapi is included in pywin32 versions 211 and later. or ! Iron Python 2.0b4 or higher. Whats new in version 2.2.1 --- 20,40 ---- Note: as of 2.1.1, adodbapi is included in pywin32 versions 211 and later. or ! Iron Python 2.0 or higher. ! ! NOTE: ........... ! If you do not like the new default operation of returning Numeric columns as decimal.Decimal, ! you can select other options by the user defined convertion feature. ! Try: ! adodbapi.variantConversions[adodbapi.adNumeric] = adodbapi.cvtString ! or: ! adodbapi.variantConversions[adodbapi.adNumeric] = adodbapi.cvtFloat ! or: ! adodbapi.variantConversions[adodbapi.adNumeric] = my_convertion_function ! ............ ! ! whats new in version 2.2.2 ! 1. Works with Iron Python 2.0RC1 (passes all tests except BINARY columns and old python time date conversion.) ! 2. Passes all dbapi20 tests (All errors and warnings are now defined for the connection object.) ! 3. Adds predefined conversion functions cvtBuffer and cvtUnicode if you want to use them. Whats new in version 2.2.1 *************** *** 77,81 **** Bjorn Pettersen. ! Authors (version 2.1) ------- Vernon Cole --- 93,97 ---- Bjorn Pettersen. ! Author (version 2.1 and later) ------- Vernon Cole *************** *** 100,103 **** --- 116,122 ---- Relase history -------------- + 2.2.2 Iron Python support complete. + 2.2.1 Bugfix for string truncation + 2.2 Code cleanup. added feature: "adodbapi.variantConversions[adodbapi.adNumeric] = adodbapi.cvtString" 2.1.1 Bugfix to CoIninialize() and nextset() 2.1 Python 2.4 version |