This file is indexed.

/usr/share/pyshared/adodb/adodb_mysql.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
 96
 97
 98
 99
100
101
102
103
104
105
########################################################################
# 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,re
import MySQLdb

#Thread Safety= 1 module
#Param Style  = format
 
try:
    True, False
except NameError:
    # Maintain compatibility with Python 2.2
    True, False = 1, 0
    
class adodb_mysql(adodb.ADOConnection):
    databaseType = 'mysql'
    dataProvider = 'mysql'
    metaColSQL = "SHOW COLUMNS FROM %s"
    
    sysDate = 'CURDATE()'
    sysTimeStamp = 'NOW()'
	
   
    def __init__(self):
        pass

    def Module(self):
        return MySQLdb
    
    def _connect(self,host=None,user=None,password=None,database=None):
        self._conn = MySQLdb.connect(host, user, password, database)        

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

    def BeginTrans(self):
        if self._autocommit:
            self._autocommit = False
        self.Execute('set autocommit=0')
        #self._conn.Execute('begin')
        
    def RollbackTrans(self):
        self.Execute('rollback')
        self.Execute('set autocommit=1')
        self._autocommit = True

    def SelectLimit(self,sql,limit,offset=-1,params=None):
        if (offset >= 0): offset = str(offset)+","
        else: offset = ""
        return self.Execute(sql+" LIMIT "+offset+str(limit),params)
    
    def CommitTrans(self):
        self.Execute('commit')
        self.Execute('set autocommit=1')
        self._autocommit = True

    def UpdateBlob(self,table,field,blob,where,blobtype='BLOB'):
        self.Execute("update %s set %s='%s' WHERE %s" % (table,field,self.addq(blob),where))
 
    def qstr(self,s):
        return "'%s'" % self._conn.escape_string(s)

    def MetaColumns(self, table):
        sql = self.metaColSQL % table
        rs = self.Execute(sql)
        arr = []
        reFloat = re.compile("^(.+)\\((\\d+),(\\d+)")
        reInt = re.compile("^(.+)\\((\\d+)")
        while not rs.EOF:
            typeF = rs.fields[1]
            if typeF.find('(')>=0:
                if typeF.find(',')>=0:
                    m = reFloat.search(typeF) 
                else:
                    m = reInt.search(typeF)
                if m:
                    gps = m.groups()
                    type = gps[0]
                    size = gps[1]
                else:
                    type = typeF
                    size = -1
            else:
                type = typeF
                size = -1
                
            arr.append((rs.fields[0],type,size))
            rs.MoveNext()
        return arr
            
class cursor_mysql(adodb.ADOCursor):
    def __init__(self,rs,conn):
        adodb.ADOCursor.__init__(self,rs,conn)
        #self._insertid = rs.insert_id()
        self._insertid = rs.lastrowid    
if __name__ == '__main__':
    db = adodb.NewADOConnection('mysql')
    db.Connect('localhost','root','','northwind')
    for r in db.Execute('select * from adoxyz'):
        print r
    adodb.Test(db)