This file is indexed.

/usr/share/pyshared/adodb/adodb_odbc.py is in python-adodb 2.10-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
########################################################################
# Vers 2.10 16 July 2008, (c)2004-2008 John Lim (jlim#natsoft.com) All Rights Reserved
# Released under a BSD-style license. See LICENSE.txt.
# Download: http://adodb.sourceforge.net/#pydownload
########################################################################

import adodb
import odbc,time,re,datetime

#Thread Safety= ? undefined
#Param Style  = ? undefined
try:
    True, False
except NameError:
    # Maintain compatibility with Python 2.2
    True, False = 1, 0
        
class adodb_odbc(adodb.ADOConnection):
    databaseType = 'odbc'
    databaseProvider = 'odbc'
    hasRowCount = False
    replaceQuote = "''"
        
    def __init__(self):
        pass

    def Module(self):
        return odbc
    
    #host=host1 user=user1 password=secret port=4341    
    def _connect(self,host=None,user=None,password=None,database=None):
        if user == None and password == None and database == None:
            dsn = host
        else:
            dsn = 'dsn='+self.addq(host)
            if (user != None): dsn += '; uid='+self.addq(user)
            if (password != None): dsn += '; pwd='+self.addq(password)
            if (database != None): dsn += '; database='+self.addq(database)
        
        self._conn = odbc.odbc(dsn)
        self._conn.setautocommit(1)

    def _newcursor(self,rs):
        return cursor_odbc(rs,self)

    
    hasTop = 'TOP'
    _retop = None
    
    def SelectLimit(self,sql,limit,offset=-1,params=None):
        if self._retop == None:
            self._retop = re.compile(r'(^\s*select\s+(distinctrow|distinct)?)',re.IGNORECASE)
            
        sql = self._retop.sub('\\1 '+self.hasTop+' '+str(limit)+' ',sql)
        return self.Execute(sql)

    def BeginTrans(self):
        if self._autocommit:
            self._autocommit = False
        self._conn.setautocommit(0)

    def RollbackTrans(self):
        self._conn.rollback()
        self._autocommit = True
        
    def CommitTrans(self):
        self._conn.commit()
        self._autocommit = True

    # (1997, 12, 19, 1, 51, 53)
    def Date(self,d):
        return datetime.datetime(long(d[0]),long(d[1]),long(d[2]))
    
    def TimeStamp(self,d):
        d = time.localtime(d)
        return datetime.datetime(long(d[0]),long(d[1]),long(d[2]),long(d[3]),long(d[4]),long(d[5]))

    def MetaColumns(self, table):
        rs = self.Execute("select * from "+table)
        arr = []
        cnt = 0
        for ff in rs.fields:
            f = rs.FetchField(cnt)
            arr.append((f[0], self.MetaType(f[1]), f[2]))
            cnt += 1
        return arr
            
class cursor_odbc(adodb.ADOCursor):
    def __init__(self,rs,conn):
        adodb.ADOCursor.__init__(self,rs,conn,norowcount=True)
            
if __name__ == '__main__':
    db = adodb_odbc()
    db.Connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\\inetpub\\adodb\\northwind.mdb;Uid=Admin;Pwd=;")
    adodb.Test(db)