| Home | Trees | Indices | Help |
|
|---|
|
|
1 # 2 # Copyright (c) 2005-2008 rPath, Inc. 3 # 4 # This program is distributed under the terms of the Common Public License, 5 # version 1.0. A copy of this license should have been distributed with this 6 # source file in a file called LICENSE. If it is not present, the license 7 # is always available at http://www.rpath.com/permanent/licenses/CPL-1.0. 8 # 9 # This program is distributed in the hope that it will be useful, but 10 # without any warranty; without even the implied warranty of merchantability 11 # or fitness for a particular purpose. See the Common Public License for 12 # full details. 13 # 14 15 import sys 16 import re 17 18 import sqlerrors, sqllib 19 20 # class for encapsulating binary strings for dumb drivers 29 30 # this will be derived by the backend drivers to handle schema creation32 keys = { 'PRIMARYKEY' : 'INTEGER PRIMARY KEY', 33 'BLOB' : 'BLOB', 34 'MEDIUMBLOB' : 'BLOB', 35 'STRAIGHTJOIN' : '', 36 'TABLEOPTS' : '', 37 'PATHTYPE' : 'STRING', 38 'STRING' : 'STRING', 39 'CREATEVIEW' : 'CREATE VIEW', 40 } 43 4653 54 # base Cursor class. All backend drivers are expected to provide this 55 # interface48 if val.startswith('BINARY'): 49 binLen = val[6:] 50 return self.binaryVal(int(binLen)) 51 52 return dict.__getitem__(self, val)57 binaryClass = BaseBinary 61 62 # map some attributes back to self._cursor64 if name in set(["description", "lastrowid"]): 65 return getattr(self._cursor, name) 66 raise AttributeError("'%s' attribute is invalid" % (name,))6769 # wrapper for the lastrowid attribute. 70 if hasattr(self._cursor, "lastrowid"): 71 return self._cursor.lastrowid 72 raise AttributeError("This driver does not know about `lastrowid`")73 74 # this will need to be provided by each separate driver