Package backend :: Package server :: Package rhnSQL :: Module sql_base :: Class Database
[hide private]
[frames] | no frames]

Class Database

source code


Base class for handling database operations.

Inherited from by the backend specific classes for Oracle, PostgreSQL, etc.

Nested Classes [hide private]
  _procedure_class
Class for calling out to stored procedures.
Instance Methods [hide private]
 
__init__(self) source code
 
connect(self, reconnect=1)
Opens a connection to the database.
source code
 
check_connection(self)
Check that this connection is still valid.
source code
 
prepare(self, sql, force=0)
Prepare an SQL statement.
source code
 
commit(self)
Commit changes
source code
 
procedure(self, name)
Return a pointer to a callable instance for a given stored procedure.
source code
 
function(self, name, ret_type)
Return a pointer to a callable instance for a given stored function.
source code
 
_function(self, name, ret_type) source code
 
transaction(self, name)
set a transaction point to which we can rollback to
source code
 
rollback(self, name=None)
rollback changes, optionally to a previously set transaction point
source code
 
close(self)
Close the connection
source code
 
cursor(self)
return an empty Cursor object
source code
 
_fix_environment_vars(self)
Fix environment variables (to be redefined in subclasses)
source code
 
_read_lob(self, lob)
Reads a lob's contents
source code
 
is_connected_to(self, backend, host, port, username, password, database, sslmode)
Check if this database matches the given connection parameters.
source code
 
Date(self, year, month, day)
Returns a Date object
source code
 
DateFromTicks(self, ticks)
Returns a Date object
source code
Class Variables [hide private]
  TimestampFromTicks = None
hash(x)
Method Details [hide private]

procedure(self, name)

source code 

Return a pointer to a callable instance for a given stored procedure. The return value is a (possibly modified) copy of the arguments passed in. see cx_Oracle's Cursor.callproc for more details

function(self, name, ret_type)

source code 

Return a pointer to a callable instance for a given stored function.

The return value is the return value of the function. One has to properly define the return type for the function, since usually the database drivers do not allow for auto-discovery. See cx_Oracle's Cursor.callfunc for more details.