Skip to content

Commit

Permalink
upgrade adodbapi to version 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
vernondcole committed May 1, 2014
1 parent 1a9d320 commit 0c49678
Show file tree
Hide file tree
Showing 18 changed files with 1,723 additions and 1,551 deletions.
7 changes: 4 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ Since build 218:
Unfortunately, this means that only IExchangeManageStore::CreateStoreEntryID
is currently available in a 64-bit build. (Nick Czeczulin)

* adodbapi updated to version 2.4.3 -- new examples folder includes short programs for
reading and writing .xls spreadsheets and reading ACCESS .mdb files using SQL.
* adodbapi updated to version 2.6 -- new examples folder includes short programs for
reading and writing .xls spreadsheets and reading ACCESS .mdb files using SQL.
New functions .is64bit.Python() and .is64bit.os() to help pick the correct drivers.
New function .schema_table.names() returns a list of all tables in a database.
see adodbapi/README.txt for more information.
Ability for a Windows computer to be a database proxy for a remote (Linux or Windows) unit.
see adodbapi/README.txt for more information.

* Fix issue implementing COM objects from within a virtualenv (Kevin Smyth
via issue #3597965)
Expand Down
57 changes: 55 additions & 2 deletions adodbapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
import ado_consts
from adodbapi import *
"""adodbapi - A python DB API 2.0 (PEP 249) interface to Microsoft ADO
Copyright (C) 2002 Henrik Ekelund, version 2.1 by Vernon Cole
* http://sourceforge.net/projects/adodbapi
"""
import sys
import time

if sys.version_info < (3,0): # in Python 2, define all symbols, just like the bad old way
from apibase import *
VariantConversionMap = MultiMap # old name. Should use apibase.MultiMap
from ado_consts import *
_makeByteBuffer = buffer
else:
# but if the user is running Python 3, then keep the dictionary clean
from .apibase import apilevel, threadsafety, paramstyle
from .apibase import Warning, Error, InterfaceError, DatabaseError, DataError, OperationalError, IntegrityError
from .apibase import InternalError, ProgrammingError, NotSupportedError, FetchFailedError
from .apibase import NUMBER, STRING, BINARY, DATETIME, ROWID
_makeByteBuffer = bytes

from adodbapi import connect, Connection, __version__, dateconverter, Cursor

def Binary(aString):
"""This function constructs an object capable of holding a binary (long) string value. """
return _makeByteBuffer(aString)

def Date(year,month,day):
"This function constructs an object holding a date value. "
return dateconverter.Date(year,month,day)

def Time(hour,minute,second):
"This function constructs an object holding a time value. "
return dateconverter.Time(hour,minute,second)

def Timestamp(year,month,day,hour,minute,second):
"This function constructs an object holding a time stamp value. "
return dateconverter.Timestamp(year,month,day,hour,minute,second)

def DateFromTicks(ticks):
"""This function constructs an object holding a date value from the given ticks value
(number of seconds since the epoch; see the documentation of the standard Python time module for details). """
return Date(*time.gmtime(ticks)[:3])

def TimeFromTicks(ticks):
"""This function constructs an object holding a time value from the given ticks value
(number of seconds since the epoch; see the documentation of the standard Python time module for details). """
return Time(*time.gmtime(ticks)[3:6])

def TimestampFromTicks(ticks):
"""This function constructs an object holding a time stamp value from the given
ticks value (number of seconds since the epoch;
see the documentation of the standard Python time module for details). """
return Timestamp(*time.gmtime(ticks)[:6])

version = 'adodbapi v' + __version__
15 changes: 10 additions & 5 deletions adodbapi/ado_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ def ado_type_name(ado_type):
#adInteger 3 Indicates a four-byte signed integer (DBTYPE_I4).
#adSingle 4 Indicates a single-precision floating-point value (DBTYPE_R4).
#adDouble 5 Indicates a double-precision floating-point value (DBTYPE_R8).
#adCurrency 6 Indicates a currency value (DBTYPE_CY). Currency is a fixed-point number with four digits to the right of the decimal point. It is stored in an eight-byte signed integer scaled by 10,000.
#adDate 7 Indicates a date value (DBTYPE_DATE). A date is stored as a double, the whole part of which is the number of days since December 30, 1899, and the fractional part of which is the fraction of a day.
#adCurrency 6 Indicates a currency value (DBTYPE_CY). Currency is a fixed-point number
# with four digits to the right of the decimal point. It is stored in an eight-byte signed integer scaled by 10,000.
#adDate 7 Indicates a date value (DBTYPE_DATE). A date is stored as a double, the whole part of which is
# the number of days since December 30, 1899, and the fractional part of which is the fraction of a day.
#adBSTR 8 Indicates a null-terminated character string (Unicode) (DBTYPE_BSTR).
#adIDispatch 9 Indicates a pointer to an IDispatch interface on a COM object (DBTYPE_IDISPATCH).
#adError 10 Indicates a 32-bit error code (DBTYPE_ERROR).
Expand All @@ -185,12 +187,14 @@ def ado_type_name(ado_type):
#adUnsignedInt 19 Indicates a four-byte unsigned integer (DBTYPE_UI4).
#adBigInt 20 Indicates an eight-byte signed integer (DBTYPE_I8).
#adUnsignedBigInt 21 Indicates an eight-byte unsigned integer (DBTYPE_UI8).
#adFileTime 64 Indicates a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (DBTYPE_FILETIME).
#adFileTime 64 Indicates a 64-bit value representing the number of 100-nanosecond intervals since
# January 1, 1601 (DBTYPE_FILETIME).
#adGUID 72 Indicates a globally unique identifier (GUID) (DBTYPE_GUID).
#adBinary 128 Indicates a binary value (DBTYPE_BYTES).
#adChar 129 Indicates a string value (DBTYPE_STR).
#adWChar 130 Indicates a null-terminated Unicode character string (DBTYPE_WSTR).
#adNumeric 131 Indicates an exact numeric value with a fixed precision and scale (DBTYPE_NUMERIC). adUserDefined 132 Indicates a user-defined variable (DBTYPE_UDT).
#adNumeric 131 Indicates an exact numeric value with a fixed precision and scale (DBTYPE_NUMERIC).
# adUserDefined 132 Indicates a user-defined variable (DBTYPE_UDT).
#adUserDefined 132 Indicates a user-defined variable (DBTYPE_UDT).
#adDBDate 133 Indicates a date value (yyyymmdd) (DBTYPE_DBDATE).
#adDBTime 134 Indicates a time value (hhmmss) (DBTYPE_DBTIME).
Expand All @@ -204,7 +208,8 @@ def ado_type_name(ado_type):
#adLongVarWChar 203 Indicates a long null-terminated Unicode string value (Parameter object only).
#adVarBinary 204 Indicates a binary value (Parameter object only).
#adLongVarBinary 205 Indicates a long binary value (Parameter object only).
#adArray (Does not apply to ADOX.) 0x2000 A flag value, always combined with another data type constant, that indicates an array of that other data type.
#adArray (Does not apply to ADOX.) 0x2000 A flag value, always combined with another data type constant,
# that indicates an array of that other data type.

# Error codes to names
adoErrors= {
Expand Down
Loading

0 comments on commit 0c49678

Please sign in to comment.