Package pysql :: Module pysqldb :: Class PysqlDb
[hide private]
[frames] | no frames]

Class PysqlDb

source code

Handles database interface

Instance Methods [hide private]
 
__init__(self, connectString, mode="") source code
 
startup(self, mode="normal")
Starts up Oracle instance
source code
 
shutdown(self, mode="normal")
Shuts down Oracle instance
source code
 
commit(self)
Commit pending transaction
source code
 
rollback(self)
Rollback pending transaction
source code
 
executeAll(self, sql, param=[])
Executes the request given in parameter and returns a list of record (a cursor.fetchall()) Use a private cursor not to pollute execute on.
source code
 
execute(self, sql, fetch=True, cursorSize=None)
Executes the request given in parameter.
source code
 
validate(self, sql)
Validates the syntax of the DML query given in parameter.
source code
 
getCursor(self)
Returns the cursor of the current query
source code
 
getDescription(self, short=True)
Returns header description of cursor with column name and type If short is set to false, the type is given after the column name
source code
 
getRowCount(self)
Returns number of line processed with last request
source code
 
fetchNext(self, nbLines=0)
Fetches nbLines from current cursor.
source code
 
getServerOuput(self)
Gets the server buffer output filled with dbms_output.put_line dbms_output should be enabled (should we do this automatically at cursor creation ?) Return list of string or empty list [] if there's nothing to get.
source code
 
getUsername(self)
Gets the name of the user connected to the database
source code
 
getDSN(self)
Gets the database service name
source code
 
getConnectString(self)
Gets the connection string used to create this instance
source code
 
getVersion(self)
Gets the version number of the database server
source code
 
close(self)
Releases object connection
source code
 
encodeSql(self, sql)
Encode sql request in the proper encoding.
source code
 
decodeData(self, data)
Encode data fetch out database to unicode
source code
Class Variables [hide private]
  MAXIMUM_FETCH_SIZE = 10000
  FETCHALL_FETCH_SIZE = 30
Method Details [hide private]

executeAll(self, sql, param=[])

source code 

Executes the request given in parameter and returns a list of record (a cursor.fetchall()) Use a private cursor not to pollute execute on. So the getDescription does not work for executeAll

execute(self, sql, fetch=True, cursorSize=None)

source code 

Executes the request given in parameter.

For a select request, returns a list of record and a flag to indicate if there's more record For insert/update/delete, return the number of record processed

Parameters:
  • fetch - for select queries, start fetching (default is true)
  • cursorSize - if defined, overide the config cursor size

validate(self, sql)

source code 

Validates the syntax of the DML query given in parameter.

Parameters:
  • sql - SQL query to validate
Returns:
None but raise PysqlException if sql cannot be validated

fetchNext(self, nbLines=0)

source code 

Fetches nbLines from current cursor. Returns a list of record and a flag to indicate if there's more record

getUsername(self)

source code 

Gets the name of the user connected to the database

Returns:
username (unicode)

getDSN(self)

source code 

Gets the database service name

Returns:
databse service name (unicode)

getConnectString(self)

source code 

Gets the connection string used to create this instance

Returns:
connect string (unicode)

getVersion(self)

source code 

Gets the version number of the database server

Returns:
db server version (unicode)

encodeSql(self, sql)

source code 

Encode sql request in the proper encoding.

Parameters:
  • sql - sql request in unicode format or list of unicode string
Returns:
sql text encoded

decodeData(self, data)

source code 

Encode data fetch out database to unicode

Parameters:
  • data - str or list or str
Returns:
encoded data