File: adodb_vfp.py

package info (click to toggle)
python-adodb 2.02b-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 172 kB
  • ctags: 290
  • sloc: python: 1,143; makefile: 47
file content (33 lines) | stat: -rw-r--r-- 1,198 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
########################################################################
# Vers 2.02 21 May 2007, (c)2004-2007 John Lim (jlim#natsoft.com.my) All Rights Reserved
# Released under a BSD-style license. See LICENSE.txt.
# Download: http://adodb.sourceforge.net/#pydownload
########################################################################

import adodb,adodb_mxodbc,datetime

try:
    True, False
except NameError:
    # Maintain compatibility with Python 2.2
    True, False = 1, 0
        
class adodb_vfp(adodb_mxodbc.adodb_mxodbc):
    databaseType = 'vfp'
    dataProvider = 'mxodbc'
    sysDate = 'date()'
    sysTimeStamp = 'datetime()'
    replaceQuote = "'+chr(39)+'"
        
    def _newcursor(self,rs):
        return cursor_vfp(rs,self)    
        
class cursor_vfp(adodb_mxodbc.cursor_mxodbc):
    def __init__(self,rs,conn):
        adodb_mxodbc.cursor_mxodbc.__init__(self,rs,conn)
        self._rowcount = rs.rowcount

if __name__ == '__main__':
    db = adodb_vfp()
    db.Connect("Driver=Microsoft Visual FoxPro Driver;UID=;PWD=;SourceDB=D:\\inetpub\\adodb\\adoxyz.DBC;SourceType=DBC;Exclusive=No;BackgroundFetch=No;Collate=Machine;Null=Yes;Deleted=Yes;")
    adodb.Test(db)