Source code for pydal.adapters.informix
from .base import SQLAdapter
from . import adapters, with_connection_or_raise
@adapters.register_for('informix')
[docs]class Informix(SQLAdapter):
dbengine = 'informix'
drivers = ('informixdb',)
def _initialize_(self, do_connect):
super(Informix, self)._initialize_(do_connect)
ruri = self.uri.split('://', 1)[1]
m = self.REGEX_URI.match(ruri)
if not m:
raise SyntaxError("Invalid URI string in DAL")
user = self.credential_decoder(m.group('user'))
if not user:
raise SyntaxError('User required')
password = self.credential_decoder(m.group('password'))
if not password:
password = ''
host = m.group('host')
if not host:
raise SyntaxError('Host name required')
db = m.group('db')
if not db:
raise SyntaxError('Database name required')
self.dsn = '%s@%s' % (db, host)
self.driver_args.update(user=user, password=password)
[docs] def after_connection(self):
self.dbms_version = int(self.connection.dbms_version.split('.')[0])
@with_connection_or_raise
def execute(self, *args, **kwargs):
command = self.filter_sql_command(args[0])
if command[-1:] == ';':
command = command[:-1]
handlers = self._build_handlers_for_execution()
for handler in handlers:
handler.before_execute(command)
rv = self.cursor.execute(command, *args[1:], **kwargs)
for handler in handlers:
handler.after_execute(command)
return rv
@adapters.register_for('informix-se')