[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7627 - in trunk/gnue-common/src/datasources: . drivers/Base driv
From: |
reinhard |
Subject: |
[gnue] r7627 - in trunk/gnue-common/src/datasources: . drivers/Base drivers/DBSIG2 drivers/file drivers/other drivers/sql/interbase drivers/sql/maxdb drivers/sql/msado drivers/sql/mysql drivers/sql/oracle drivers/sql/postgres drivers/sql/sqlite |
Date: |
Mon, 20 Jun 2005 08:28:02 -0500 (CDT) |
Author: reinhard
Date: 2005-06-20 08:28:00 -0500 (Mon, 20 Jun 2005)
New Revision: 7627
Modified:
trunk/gnue-common/src/datasources/GDataSource.py
trunk/gnue-common/src/datasources/drivers/Base/Connection.py
trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py
trunk/gnue-common/src/datasources/drivers/file/Base.py
trunk/gnue-common/src/datasources/drivers/file/csvfile.py
trunk/gnue-common/src/datasources/drivers/file/dbffile.py
trunk/gnue-common/src/datasources/drivers/file/inifile.py
trunk/gnue-common/src/datasources/drivers/other/appserver.py
trunk/gnue-common/src/datasources/drivers/sql/interbase/kinterbasdb.py
trunk/gnue-common/src/datasources/drivers/sql/maxdb/maxdb.py
trunk/gnue-common/src/datasources/drivers/sql/msado/adodbapi.py
trunk/gnue-common/src/datasources/drivers/sql/mysql/mysqldb.py
trunk/gnue-common/src/datasources/drivers/sql/oracle/Base.py
trunk/gnue-common/src/datasources/drivers/sql/oracle/cxoracle.py
trunk/gnue-common/src/datasources/drivers/sql/oracle/dcoracle.py
trunk/gnue-common/src/datasources/drivers/sql/postgres/Base.py
trunk/gnue-common/src/datasources/drivers/sql/postgres/psycopg.py
trunk/gnue-common/src/datasources/drivers/sql/postgres/pygresql.py
trunk/gnue-common/src/datasources/drivers/sql/postgres/pypgsql.py
trunk/gnue-common/src/datasources/drivers/sql/sqlite/pysqlite.py
Log:
Cleanup.
Modified: trunk/gnue-common/src/datasources/GDataSource.py
===================================================================
--- trunk/gnue-common/src/datasources/GDataSource.py 2005-06-20 12:05:13 UTC
(rev 7626)
+++ trunk/gnue-common/src/datasources/GDataSource.py 2005-06-20 13:28:00 UTC
(rev 7627)
@@ -263,16 +263,16 @@
login = True)
# Remember the result set class to use
- self.__resultSetClass = self._connection._resultSetClass
+ self.__resultSetClass = self._connection._resultSetClass_
# Check if the connection has a fixed primary key name
- primarykeyFields = self._connection._primarykeyFields
+ primarykeyFields = self._connection._primarykeyFields_
if primarykeyFields:
self._primarykeyFields = primarykeyFields
self.referenceFields (self._primarykeyFields)
# Include the rowid in list of field references
- rowidField = self._connection._rowidField
+ rowidField = self._connection._rowidField_
if rowidField:
# TODO: checks if the rowid is available and should be used go here:
# 1. if primary key should be prefered, don't set self._rowidField
Modified: trunk/gnue-common/src/datasources/drivers/Base/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/Connection.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/Base/Connection.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -37,15 +37,17 @@
This class must be subclassed by all database drivers. It represents a
connection to the backend.
- @cvar _resultSetClass: implementation of the ResultSet class to be used with
+ @cvar _resultSetClass_: implementation of the ResultSet class to be used with
the connection. Must be overwritten by descendants.
- @cvar defaultBehaviour: Standard schema introspector class for this type of
- connection. Must be overwritten by descendants.
- @cvar defaultCreator: Standard schema creator class for this type of
- connection. Must be overwritten by descendants.
- @cvar _rowidField: Field name of the rowid generated by the backend. Can be
+ @cvar _behavior_: Schema introspector class for this type of connection. If a
+ descendants overwrites this, the behavior cannot be set in
+ connections.conf.
+ @cvar _defaultBehaviour_: Standard schema introspector class for this type of
+ connection. Can be overwritten by descendants to provide a default in case
+ the behavior can be set in connections.conf.
+ @cvar _rowidField_: Field name of the rowid generated by the backend. Can be
overwritten by descendants if the backend supports rowids.
- @cvar _primarykeyFields: Field names of the primary key. Can be overwritten
+ @cvar _primarykeyFields_: Field names of the primary key. Can be overwritten
by descendants if the backend has a fixed fieldname for the primary key.
@ivar name: Name of the connection from connections.conf.
@@ -54,11 +56,11 @@
for this connection.
"""
- _resultSetClass = None
- defaultBehaviour = None
- defaultCreator = None
- _rowidField = None
- _primarykeyFields = None
+ _resultSetClass_ = None
+ _behavior_ = None
+ _defaultBehaviour_ = None
+ _rowidField_ = None
+ _primarykeyFields_ = None
# ---------------------------------------------------------------------------
@@ -71,10 +73,38 @@
self.name = name
self.parameters = parameters
self.__pending = False
- self.behavior = self._getBehavior_ ()
+ # Find out Behavior class to use
+ if self._behavior_ is not None:
+ behaviorClass = self._behavior_
+
+ elif self.parameters.get ('behavior') is not None:
+ behaviorClass = plugin.find (self.parameters ['behavior'],
+ 'gnue.common.datasources.drivers', 'Behavior')
+
+ elif self._defaultBehavior_ is not None:
+ behaviorClass = self._defaultBehavior_
+
+ else:
+ behaviorClass = None
+
+ if behaviorClass is not None:
+ self.__behavior = behaviorClass (self)
+ else:
+ self.__behavior = None
+
+
# ---------------------------------------------------------------------------
+ # Nice string representation
+ # ---------------------------------------------------------------------------
+
+ def __repr__ (self):
+
+ return "<Connection to %s>" % self.name
+
+
+ # ---------------------------------------------------------------------------
# Define fields necessary for login
# ---------------------------------------------------------------------------
@@ -101,7 +131,7 @@
"""
gEnter (8)
- return gLeave (8, self._getLoginFields ())
+ return gLeave (8, self._getLoginFields_ ())
# ---------------------------------------------------------------------------
@@ -117,8 +147,8 @@
"""
gEnter (8)
- self._connect (connectData)
- self._beginTransaction ()
+ self._connect_ (connectData)
+ self._beginTransaction_ ()
gLeave (8)
@@ -136,7 +166,7 @@
"""
gEnter (8)
- return gLeave (8, self._initialize (table, fields))
+ return gLeave (8, self._initialize_ (table, fields))
# ---------------------------------------------------------------------------
@@ -155,7 +185,7 @@
"""
gEnter (8)
- rowid = self._insert (table, newfields, recno)
+ rowid = self._insert_ (table, newfields, recno)
self.__pending = True
return gLeave (8, rowid)
@@ -176,7 +206,7 @@
"""
gEnter (8)
- self._update (table, oldfields, newfields, recno)
+ self._update_ (table, oldfields, newfields, recno)
self.__pending = True
gLeave (8)
@@ -196,7 +226,7 @@
"""
gEnter (8)
- self._delete (table, oldfields, recno)
+ self._delete_ (table, oldfields, recno)
self.__pending = True
gLeave (8)
@@ -217,7 +247,7 @@
"""
gEnter (8)
- return gLeave (8, self._requery (table, oldfields, fields))
+ return gLeave (8, self._requery_ (table, oldfields, fields))
# ---------------------------------------------------------------------------
@@ -237,7 +267,7 @@
"""
gEnter (8)
- result = self._call (table, oldfields, methodname, parameters)
+ result = self._call_ (table, oldfields, methodname, parameters)
# FIXME: Some calls should not make the connection pending, like requesting
# the generated form. Most others should.
# self.__pending = True
@@ -269,9 +299,9 @@
"""
gEnter (8)
- self._commit ()
+ self._commit_ ()
self.__pending = False
- self._beginTransaction ()
+ self._beginTransaction_ ()
gLeave (8)
@@ -285,9 +315,9 @@
"""
gEnter (8)
- self._rollback ()
+ self._rollback_ ()
self.__pending = False
- self._beginTransaction ()
+ self._beginTransaction_ ()
gLeave (8)
@@ -301,7 +331,7 @@
"""
gEnter (8)
- self._close ()
+ self._close_ ()
# Make sure to release the reference to the connection manager as well as
# the introspector's instance (if available). This makes garbage collection
# behave nice :)
@@ -323,8 +353,8 @@
@return: GSchema object tree with the current schema or None
"""
- if self.behavior is not None:
- return self.behavior.readSchema ()
+ if self.__behavior is not None:
+ return self.__behavior.readSchema ()
else:
return None
@@ -347,8 +377,8 @@
commands = []
- if self.behavior is not None:
- commands = self.behavior.writeSchema (schema, simulate)
+ if self.__behavior is not None:
+ commands = self.__behavior.writeSchema (schema, simulate)
return commands
@@ -359,15 +389,15 @@
def createDatabase (self):
- if self.behavior is not None:
- self.behavior.createDatabase ()
+ if self.__behavior is not None:
+ self.__behavior.createDatabase ()
# ---------------------------------------------------------------------------
# Virtual methods to be implemented by descendants
# ---------------------------------------------------------------------------
- def _getLoginFields (self):
+ def _getLoginFields_ (self):
"""
Return information about the necessary login parameters for the L{connect}
method (to be implemented by descendants).
@@ -381,7 +411,7 @@
# ---------------------------------------------------------------------------
- def _connect (self, connectData):
+ def _connect_ (self, connectData):
"""
Connect to the backend (to be implemented by descendants).
@@ -395,7 +425,7 @@
# ---------------------------------------------------------------------------
- def _beginTransaction (self):
+ def _beginTransaction_ (self):
"""
Start a new transaction (to be implemented by descendants).
@@ -407,7 +437,7 @@
# ---------------------------------------------------------------------------
- def _initialize (self, table, fields):
+ def _initialize_ (self, table, fields):
"""
Return default values for new records (can be overwritten by descendants).
@@ -426,7 +456,7 @@
# ---------------------------------------------------------------------------
- def _insert (self, table, newfields, recno):
+ def _insert_ (self, table, newfields, recno):
"""
Insert a new record in the backend (to be implemented by descendants).
@@ -444,7 +474,7 @@
# ---------------------------------------------------------------------------
- def _update (self, table, oldfields, newfields, recno):
+ def _update_ (self, table, oldfields, newfields, recno):
"""
Update an existing record in the backend.
@@ -461,7 +491,7 @@
# ---------------------------------------------------------------------------
- def _delete (self, table, oldfields, recno):
+ def _delete_ (self, table, oldfields, recno):
"""
Delete a record from the backend (to be implemented by descendants).
@@ -477,7 +507,7 @@
# ---------------------------------------------------------------------------
- def _requery (self, table, oldfields, fields):
+ def _requery_ (self, table, oldfields, fields):
"""
Requery an existing record to reflect changes done by the backend (to be
implemented by descendants).
@@ -497,7 +527,7 @@
# ---------------------------------------------------------------------------
- def _call (self, table, oldfields, methodname, parameters):
+ def _call_ (self, table, oldfields, methodname, parameters):
"""
Call a function of the backend (to be implemented by descendants).
@@ -515,7 +545,7 @@
# ---------------------------------------------------------------------------
- def _commit (self):
+ def _commit_ (self):
"""
Commit pending changes in the backend (to be implemented by descendants).
@@ -526,7 +556,7 @@
# ---------------------------------------------------------------------------
- def _rollback (self):
+ def _rollback_ (self):
"""
Undo any uncommitted changes in the backend (to be implemented by
descendants).
@@ -538,7 +568,7 @@
# ---------------------------------------------------------------------------
- def _close (self):
+ def _close_ (self):
"""
Close the connection to the backend (to be implemented by descendants).
@@ -546,42 +576,3 @@
connection to the backend. If it is not overwritten, it does nothing.
"""
pass
-
- # ---------------------------------------------------------------------------
-
- def _getBehavior_ (self):
- """
- Create an apropriate behavior instance. If the connection defines a
- '_behavior' attribute this class will be instanciated. If the connection's
- parameters contain the key 'behavior' this class will be used. If no such
- parameter is defined but the connection has a 'defaultBehavior' attribute
- set, this class will be used.
-
- @return: behavior instance or None if no such class is available
- """
-
- aClass = None
-
- if hasattr (self, '_behavior'):
- aClass = self._behavior
-
- elif self.parameters.get ('behavior') is not None:
- aClass = plugin.find (self.parameters ['behavior'],
- 'gnue.common.datasources.drivers', 'Behavior')
-
- elif self.defaultBehavior is not None:
- aClass = self.defaultBehavior
-
- if aClass:
- return aClass (self)
- else:
- return None
-
-
- # ---------------------------------------------------------------------------
- # Nice string representation
- # ---------------------------------------------------------------------------
-
- def __repr__ (self):
-
- return "<Connection to %s>" % self.name
Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -44,33 +44,33 @@
Python module.
Driver plugins derived from this driver must subclass this class and
- overwrite at least the L{_drivername} class variable and implement the
- L{_getConnectParams} method.
+ overwrite at least the L{_drivername_} class variable and implement the
+ L{_getConnectParams_} method.
- @cvar _drivername: The Python module name of the DBSIG2 driver. Must be
+ @cvar _drivername_: The Python module name of the DBSIG2 driver. Must be
overwritten by descendants.
- @cvar _boolean_false: Value to post to the database for boolean FALSE
+ @cvar _boolean_false_: Value to post to the database for boolean FALSE
(defaults to False). Can be overwritten by descendants.
- @cvar _boolean_true: Value to post to the database for boolean TRUE
+ @cvar _boolean_true_: Value to post to the database for boolean TRUE
(defaults to True). Can be overwritten by descendants.
- @cvar _broken_fetchmany: Can be set to True by descendants if the DBSIG2
+ @cvar _broken_fetchmany_: Can be set to True by descendants if the DBSIG2
module raises an exception if fetchmany() is called when no records are
left.
- @cvar _broken_rowcount: Can be set to True by descendants if the DBSIG2
+ @cvar _broken_rowcount_: Can be set to True by descendants if the DBSIG2
module does not return a correct value for cursor.rowcount.
- @cvar _named_as_sequence: If paramstyle = 'named' pass parameters as
+ @cvar _named_as_sequence_: If paramstyle = 'named' pass parameters as
sequence (True) or as mapping (False). Can be overwritten by descendants.
"""
- _resultSetClass = ResultSet
+ _resultSetClass_ = ResultSet
- _drivername = None # DBSIG2 compatible driver module
- _boolean_false = False # value to pass for boolean FALSE
- _boolean_true = True # value to pass for boolean TRUE
- _broken_fetchmany = False # Does fetchmany () raise an exception
+ _drivername_ = None # DBSIG2 compatible driver module
+ _boolean_false_ = False # value to pass for boolean FALSE
+ _boolean_true_ = True # value to pass for boolean TRUE
+ _broken_fetchmany_ = False # Does fetchmany () raise an exception
# when no records are left?
- _broken_rowcount = False # Is cursor.rowcount unusable?
- _named_as_sequence = False # Pass 'named' parameters as sequence
+ _broken_rowcount_ = False # Is cursor.rowcount unusable?
+ _named_as_sequence_ = False # Pass 'named' parameters as sequence
# ---------------------------------------------------------------------------
@@ -82,10 +82,10 @@
Base.Connection.__init__ (self, connections, name, parameters)
try:
- self._driver = __import__ (self._drivername, None, None, '*')
+ self._driver = __import__ (self._drivername_, None, None, '*')
except ImportError:
raise Exceptions.ConnectError, u_(
- "The '%s' python module is not installed.") % self._drivername
+ "The '%s' python module is not installed.") % self._drivername_
# Encoding used to communicate with the database (not used by all drivers)
if parameters.has_key ('encoding'):
@@ -114,9 +114,9 @@
elif isinstance (value, bool):
# Booleans
if value:
- return self._boolean_true
+ return self._boolean_true_
else:
- return self._boolean_false
+ return self._boolean_false_
elif isinstance (value, mx.DateTime.DateTimeType):
# mx.DateTime
@@ -188,7 +188,7 @@
s = s [:start] + (':%s' % key) + s [end+2:]
values.append (parameters [key])
- return (s, self._named_as_sequence and values or parameters)
+ return (s, self._named_as_sequence_ and values or parameters)
# ---------------------------------------------------------------------------
@@ -389,7 +389,7 @@
# This method has to be overwritten by descendants
# ---------------------------------------------------------------------------
- def _getConnectParams (self, connectData):
+ def _getConnectParams_ (self, connectData):
"""
Return a tuple with a list and a dictionary, being the parameters and
keyword arguments to be passed to the connection function of the DBSIG2
@@ -404,14 +404,14 @@
# Implementations of virtual methods
# ---------------------------------------------------------------------------
- def _getLoginFields (self):
+ def _getLoginFields_ (self):
return [(u_('User Name'), '_username', 'string', None, None, []),
(u_('Password'), '_password', 'password', None, None, [])]
# ---------------------------------------------------------------------------
- def _connect (self, connectData):
- (params, kwargs) = self._getConnectParams (connectData)
+ def _connect_ (self, connectData):
+ (params, kwargs) = self._getConnectParams_ (connectData)
gDebug (3, 'DBSIG2 Connect')
try:
self._native = self._driver.connect (*params, **kwargs)
@@ -420,7 +420,7 @@
# ---------------------------------------------------------------------------
- def _insert (self, table, newfields, recno):
+ def _insert_ (self, table, newfields, recno):
fields = []
values = []
parameters = {}
@@ -436,7 +436,7 @@
# ---------------------------------------------------------------------------
- def _update (self, table, oldfields, newfields, recno):
+ def _update_ (self, table, oldfields, newfields, recno):
(where, parameters) = self.__where (oldfields)
updates = []
for (field, value) in newfields.items ():
@@ -450,14 +450,14 @@
# ---------------------------------------------------------------------------
- def _delete (self, table, oldfields, recno):
+ def _delete_ (self, table, oldfields, recno):
(where, parameters) = self.__where (oldfields)
statement = 'DELETE FROM %s WHERE %s' % (table, where)
self.__execute (statement, parameters, recno)
# ---------------------------------------------------------------------------
- def _requery (self, table, oldfields, fields):
+ def _requery_ (self, table, oldfields, fields):
(where, parameters) = self.__where (oldfields)
statement = "SELECT %s FROM %s WHERE %s" % (string.join (fields, ', '),
table, where)
@@ -479,7 +479,7 @@
# ---------------------------------------------------------------------------
- def _commit (self):
+ def _commit_ (self):
gDebug (3, 'DBSIG2 Commit')
try:
self._native.commit ()
@@ -488,14 +488,14 @@
# ---------------------------------------------------------------------------
- def _rollback (self):
+ def _rollback_ (self):
gDebug (3, 'DBSIG2 Rollback')
if hasattr (self._native, 'rollback'):
self._native.rollback ()
# ---------------------------------------------------------------------------
- def _close (self):
+ def _close_ (self):
gDebug (3, 'DBSIG2 Close')
if self._native:
self._native.close ()
Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/ResultSet.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -94,7 +94,7 @@
# If the connection has a broken row count, query for the number of records
# first. This avoids conflicts with some drivers not supporting multiple
# open cursors (like adodbapi).
- if connection._broken_rowcount:
+ if connection._broken_rowcount_:
if distinct:
self.__count = 0
else:
@@ -104,7 +104,7 @@
query = self.__buildQuery (table, what, where, sortorder)
self.__cursor = connection.makecursor (query, params)
- if not connection._broken_rowcount:
+ if not connection._broken_rowcount_:
self.__count = self.__cursor.rowcount
self.__connection = connection
@@ -119,7 +119,7 @@
self.__cursor = connection.makecursor (sql)
- if connection._broken_rowcount:
+ if connection._broken_rowcount_:
self.__count = 0 # No chance to find it out
else:
self.__count = self.__cursor.rowcount
@@ -148,7 +148,7 @@
while True:
# fetch next records from the backend
- if self.__connection._broken_fetchmany:
+ if self.__connection._broken_fetchmany_:
try:
rows = self.__cursor.fetchmany (cachesize)
except:
Modified: trunk/gnue-common/src/datasources/drivers/file/Base.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/file/Base.py 2005-06-20
12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/file/Base.py 2005-06-20
13:28:00 UTC (rev 7627)
@@ -57,7 +57,7 @@
filename = self.__connection.getFilename ('*')
for fname in glob.glob (filename):
- tables = self.__connection._listTables (fname)
+ tables = self.__connection._listTables_ (fname)
if tables is not None:
master = parent.findChildOfType ('GSTables')
if master is None:
@@ -70,10 +70,10 @@
# Add all fields, indices and constraints to the tables
for table in parent.findChildrenOfType ('GSTable', False, True):
- for item in [self.__connection._listFields (table),
- self.__connection._listPrimaryKey (table),
- self.__connection._listIndices (table),
- self.__connection._listConstraints (table)]:
+ for item in [self.__connection._listFields_ (table),
+ self.__connection._listPrimaryKey_ (table),
+ self.__connection._listIndices_ (table),
+ self.__connection._listConstraints_ (table)]:
if item is not None:
table.addChild (item)
item.setParent (table)
@@ -125,8 +125,8 @@
Generic Connection class for file based backends.
"""
- _resultSetClass = ResultSet
- _behavior = Behavior
+ _resultSetClass_ = ResultSet
+ _behavior_ = Behavior
# ---------------------------------------------------------------------------
@@ -154,7 +154,7 @@
# Implementation of (some) virtual methods
# ---------------------------------------------------------------------------
- def _requery (self, table, oldfields, fields):
+ def _requery_ (self, table, oldfields, fields):
for row in self.getFile (table):
found = True
for (fieldname, value) in oldfields:
@@ -182,14 +182,14 @@
def getFile (self, table):
- return self._loadFile (self.getFilename (table), table)
+ return self._loadFile_ (self.getFilename (table), table)
# ---------------------------------------------------------------------------
# Virtual methods (to be implemented by descendants)
# ---------------------------------------------------------------------------
- def _listTables (self, filename):
+ def _listTables_ (self, filename):
"""
List all the table names contained in the given file.
@@ -229,7 +229,7 @@
# ---------------------------------------------------------------------------
- def _listFields (self, table):
+ def _listFields_ (self, table):
"""
List all the field names available for a table.
@@ -249,7 +249,7 @@
# ---------------------------------------------------------------------------
- def _listIndices (self, table):
+ def _listIndices_ (self, table):
"""
List all available indices for a table.
@@ -267,7 +267,7 @@
# ---------------------------------------------------------------------------
- def _listPrimaryKey (self, table):
+ def _listPrimaryKey_ (self, table):
"""
List the primary key for a table.
@@ -285,7 +285,7 @@
# ---------------------------------------------------------------------------
- def _listConstraints (self, table):
+ def _listConstraints_ (self, table):
"""
List all available constraints for a table.
@@ -303,7 +303,7 @@
# ---------------------------------------------------------------------------
- def _loadFile (self, filename, table):
+ def _loadFile_ (self, filename, table):
"""
Load data from a file.
Modified: trunk/gnue-common/src/datasources/drivers/file/csvfile.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/file/csvfile.py 2005-06-20
12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/file/csvfile.py 2005-06-20
13:28:00 UTC (rev 7627)
@@ -104,7 +104,7 @@
# Iterate through the list of field names
# ---------------------------------------------------------------------------
- def _listFields (self, table):
+ def _listFields_ (self, table):
result = GSchema.GSFields (None)
(f, dialect, fieldnames) = self.__prepareFile (table.filename)
@@ -123,7 +123,7 @@
# Load the file
# ---------------------------------------------------------------------------
- def _loadFile (self, filename, table):
+ def _loadFile_ (self, filename, table):
(f, dialect, fieldnames) = self.__prepareFile (filename)
Modified: trunk/gnue-common/src/datasources/drivers/file/dbffile.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/file/dbffile.py 2005-06-20
12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/file/dbffile.py 2005-06-20
13:28:00 UTC (rev 7627)
@@ -88,7 +88,7 @@
# Iterate through the list of field names
# ---------------------------------------------------------------------------
- def _listFields (self, table):
+ def _listFields_ (self, table):
result = GSchema.GSFields (None)
@@ -114,6 +114,6 @@
# Load the file
# ---------------------------------------------------------------------------
- def _loadFile (self, filename, table):
+ def _loadFile_ (self, filename, table):
return dbf.dbf (filename)
Modified: trunk/gnue-common/src/datasources/drivers/file/inifile.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/file/inifile.py 2005-06-20
12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/file/inifile.py 2005-06-20
13:28:00 UTC (rev 7627)
@@ -94,8 +94,9 @@
Connection class for INI style configuration file backends.
"""
- _primarykeyFields = ['_section_name']
+ _primarykeyFields_ = ['_section_name']
+
# ---------------------------------------------------------------------------
# Constructor
# ---------------------------------------------------------------------------
@@ -125,7 +126,7 @@
# Iterate through the list of field names
# ---------------------------------------------------------------------------
- def _listFields (self, table):
+ def _listFields_ (self, table):
result = GSchema.GSFields (None)
parser = self.__getParser (table.filename, table.name)
@@ -151,7 +152,7 @@
# Load the file
# ---------------------------------------------------------------------------
- def _loadFile (self, filename, table):
+ def _loadFile_ (self, filename, table):
parser = self.__getParser (filename, table)
@@ -160,7 +161,7 @@
# ---------------------------------------------------------------------------
- # Set fields (used by _insert and _update)
+ # Set fields (used by _insert_ and _update_)
# ---------------------------------------------------------------------------
def __setFields (self, parser, section, fields):
@@ -177,7 +178,7 @@
# Insert new record
# ---------------------------------------------------------------------------
- def _insert (self, table, newfields, recno):
+ def _insert_ (self, table, newfields, recno):
parser = self.__getParser (self.getFilename (table), table)
@@ -200,7 +201,7 @@
# Update existing record
# ---------------------------------------------------------------------------
- def _update (self, table, oldfields, newfields, recno):
+ def _update_ (self, table, oldfields, newfields, recno):
parser = self.__getParser (self.getFilename (table), table)
@@ -235,7 +236,7 @@
# Delete record
# ---------------------------------------------------------------------------
- def _delete (self, table, oldfields, recno):
+ def _delete_ (self, table, oldfields, recno):
parser = self.__getParser (self.getFilename (table), table)
@@ -250,7 +251,7 @@
# Write changes back to the file
# ---------------------------------------------------------------------------
- def _commit (self):
+ def _commit_ (self):
for table in self.__dirty.keys ():
f = open (self.getFilename (table), "w+")
@@ -264,7 +265,7 @@
# Undo changes
# ---------------------------------------------------------------------------
- def _rollback (self):
+ def _rollback_ (self):
# Just clean the cache; will cause each file to be re-read on next access
self.__parsers = {}
Modified: trunk/gnue-common/src/datasources/drivers/other/appserver.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/other/appserver.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/other/appserver.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -308,9 +308,9 @@
Connection class for GNUe-AppServer backends.
"""
- _resultSetClass = ResultSet
- _primarykeyFields = [u'gnue_id']
- _behavior = Behavior
+ _resultSetClass_ = ResultSet
+ _behavior_ = Behavior
+ _primarykeyFields_ = [u'gnue_id']
# ---------------------------------------------------------------------------
@@ -394,7 +394,7 @@
# Implementations of virtual methods
# ---------------------------------------------------------------------------
- def _getLoginFields (self):
+ def _getLoginFields_ (self):
result = []
dbauth = self.parameters.get ('authentication', 'False')
@@ -445,7 +445,7 @@
# ---------------------------------------------------------------------------
- def _connect (self, connectData):
+ def _connect_ (self, connectData):
self.__getSessionManager ()
self.__updateFilters (connectData)
try:
@@ -458,33 +458,33 @@
# ---------------------------------------------------------------------------
- def _initialize (self, table, fields):
+ def _initialize_ (self, table, fields):
id = self._sm.store (self._sess_id, table, [None], [], [[]]) [0]
return self.requery (table, {u'gnue_id': id}, fields)
# ---------------------------------------------------------------------------
- def _insert (self, table, newfields, recno):
+ def _insert_ (self, table, newfields, recno):
f = newfields.copy ()
id = f.pop (u'gnue_id')
self._sm.store (self._sess_id, table, [id], f.keys (), [f.values ()])
# ---------------------------------------------------------------------------
- def _update (self, table, oldfields, newfields, recno):
+ def _update_ (self, table, oldfields, newfields, recno):
f = newfields
id = oldfields [u'gnue_id']
self._sm.store (self._sess_id, table, [id], f.keys (), [f.values ()])
# ---------------------------------------------------------------------------
- def _delete (self, table, oldfields, recno):
+ def _delete_ (self, table, oldfields, recno):
id = oldfields [u'gnue_id']
self._sm.delete (self._sess_id, table, [id])
# ---------------------------------------------------------------------------
- def _requery (self, table, oldfields, fields):
+ def _requery_ (self, table, oldfields, fields):
id = oldfields [u'gnue_id']
rows = self._sm.load (self._sess_id, table, [id], fields)
if len (rows):
@@ -498,23 +498,23 @@
# ---------------------------------------------------------------------------
- def _call (self, table, oldfields, methodname, parameters):
+ def _call_ (self, table, oldfields, methodname, parameters):
id = oldfields [u'gnue_id']
return self._sm.call (self._sess_id, table, [id], methodname,
parameters) [0]
# ---------------------------------------------------------------------------
- def _commit (self):
+ def _commit_ (self):
self._sm.commit (self._sess_id)
# ---------------------------------------------------------------------------
- def _rollback (self):
+ def _rollback_ (self):
self._sm.rollback (self._sess_id)
# ---------------------------------------------------------------------------
- def _close (self):
+ def _close_ (self):
if self._sm is not None:
self._sm.close (self._sess_id, False)
Modified: trunk/gnue-common/src/datasources/drivers/sql/interbase/kinterbasdb.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/interbase/kinterbasdb.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/interbase/kinterbasdb.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -100,10 +100,10 @@
Connection class for Interbase backends using the KinterbasDB DBSIG2 module.
"""
- _drivername = 'kinterbasdb'
- _behavior = Behavior.Behavior
+ _drivername_ = 'kinterbasdb'
+ _behavior_ = Behavior.Behavior
- _broken_rowcount = True
+ _broken_rowcount_ = True
# ---------------------------------------------------------------------------
@@ -127,7 +127,7 @@
# Get connection parameters
# ---------------------------------------------------------------------------
- def _getConnectParams (self, connectData):
+ def _getConnectParams_ (self, connectData):
# mandatory parameters
kwargs = {'database': connectData ['dbname'],
@@ -150,7 +150,7 @@
# Start a new transaction
# ---------------------------------------------------------------------------
- def _beginTransaction (self):
+ def _beginTransaction_ (self):
self._native.begin ()
Modified: trunk/gnue-common/src/datasources/drivers/sql/maxdb/maxdb.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/maxdb/maxdb.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/maxdb/maxdb.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -102,17 +102,17 @@
Connection class for MaxDB backends.
"""
- _drivername = 'sapdb.dbapi'
- _behavior = Behavior.Behavior
+ _drivername_ = 'sapdb.dbapi'
+ _behavior_ = Behavior.Behavior
- _named_as_sequence = True
+ _named_as_sequence_ = True
# ---------------------------------------------------------------------------
# Get connection parameters
# ---------------------------------------------------------------------------
- def _getConnectParams (self, connectData):
+ def _getConnectParams_ (self, connectData):
# mandatory parameters
# FIXME: would it be possible to use kwargs for these parameters, too?
Modified: trunk/gnue-common/src/datasources/drivers/sql/msado/adodbapi.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/msado/adodbapi.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/msado/adodbapi.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -127,18 +127,18 @@
Connection class for MS ADO backends using the adodbapi DBSIG2 module.
"""
- _drivername = 'adodbapi'
+ _drivername_ = 'adodbapi'
- _broken_rowcount = True
+ _broken_rowcount_ = True
- defaultBehavior = Behavior.Behavior
+ _defaultBehavior_ = Behavior.Behavior
# ---------------------------------------------------------------------------
# Build up parameters for connect method
# ---------------------------------------------------------------------------
- def _getConnectParams (self, connectData):
+ def _getConnectParams_ (self, connectData):
import adodbapi
Modified: trunk/gnue-common/src/datasources/drivers/sql/mysql/mysqldb.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/mysql/mysqldb.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/mysql/mysqldb.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -101,18 +101,18 @@
Connection class for MySQL backends using the MySQLdb DBSIG2 module.
"""
- _drivername = 'MySQLdb'
- _behavior = Behavior.Behavior
+ _drivername_ = 'MySQLdb'
+ _behavior_ = Behavior.Behavior
- _boolean_true = 1
- _boolean_false = 0
+ _boolean_true_ = 1
+ _boolean_false_ = 0
# ---------------------------------------------------------------------------
# Get connection parameters
# ---------------------------------------------------------------------------
- def _getConnectParams (self, connectData):
+ def _getConnectParams_ (self, connectData):
# mandatory parameters
kwargs = {'db' : connectData ['dbname'],
@@ -131,7 +131,7 @@
# Start a new transaction
# ---------------------------------------------------------------------------
- def _beginTransaction (self):
+ def _beginTransaction_ (self):
# only available if MySQL is compiled with transaction support
try:
self._native.begin ()
Modified: trunk/gnue-common/src/datasources/drivers/sql/oracle/Base.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/oracle/Base.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/oracle/Base.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -44,10 +44,10 @@
"""
# TODO: Test if it would work with the default (True/False), too
- _boolean_false = 0
- _boolean_true = 1
+ _boolean_false_ = 0
+ _boolean_true_ = 1
- _behavior = Behavior.Behavior
+ _behavior_ = Behavior.Behavior
# ---------------------------------------------------------------------------
@@ -66,7 +66,7 @@
# Get connection parameters
# ---------------------------------------------------------------------------
- def _getConnectParams (self, connectData):
+ def _getConnectParams_ (self, connectData):
connectstring = "%s/address@hidden" % (connectData ['_username'],
connectData ['_password'],
Modified: trunk/gnue-common/src/datasources/drivers/sql/oracle/cxoracle.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/oracle/cxoracle.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/oracle/cxoracle.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -100,4 +100,4 @@
Connection class for Oracle backends using the cxOracle DBSIG2 module.
"""
- _drivername = 'cx_Oracle'
+ _drivername_ = 'cx_Oracle'
Modified: trunk/gnue-common/src/datasources/drivers/sql/oracle/dcoracle.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/oracle/dcoracle.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/oracle/dcoracle.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -103,4 +103,4 @@
Connection class for Oracle backends using the DCOracle DBSIG2 module.
"""
- _drivername = 'DCOracle2'
+ _drivername_ = 'DCOracle2'
Modified: trunk/gnue-common/src/datasources/drivers/sql/postgres/Base.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/postgres/Base.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/postgres/Base.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -42,8 +42,8 @@
Generic Connection class for PostgreSQL backends.
"""
- _rowidField = 'oid'
- _behavior = Behavior.Behavior
+ _rowidField_ = 'oid'
+ _behavior_ = Behavior.Behavior
# ---------------------------------------------------------------------------
@@ -67,7 +67,7 @@
# Get connection parameters
# ---------------------------------------------------------------------------
- def _getConnectParams (self, connectData):
+ def _getConnectParams_ (self, connectData):
# mandatory parameters
kwargs = {'database': connectData ['dbname'],
@@ -87,7 +87,7 @@
# Done at the start of each transaction
# ---------------------------------------------------------------------------
- def _beginTransaction (self):
+ def _beginTransaction_ (self):
# Must set CLIENT_ENCODING per transaction as it is reset on COMMIT or
# ROLLBACK.
Modified: trunk/gnue-common/src/datasources/drivers/sql/postgres/psycopg.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/postgres/psycopg.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/postgres/psycopg.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -101,4 +101,4 @@
Connection class for PostgreSQL backends using the psycopg DBISG2 module.
"""
- _drivername = 'psycopg'
+ _drivername_ = 'psycopg'
Modified: trunk/gnue-common/src/datasources/drivers/sql/postgres/pygresql.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/postgres/pygresql.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/postgres/pygresql.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -95,4 +95,4 @@
Connection class for PostgreSQL backends using the PyGreSQL DBSIG2 module.
"""
- _drivername = 'pgdb'
+ _drivername_ = 'pgdb'
Modified: trunk/gnue-common/src/datasources/drivers/sql/postgres/pypgsql.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/postgres/pypgsql.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/postgres/pypgsql.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -100,7 +100,7 @@
Connection class for PostgreSQL backends using the pyPgSQL DBSIG2 module.
"""
- _drivername = 'pyPgSQL.PgSQL'
- _rowidField = None # PyPgSQL doesn't support rowid's!!
- _broken_fetchmany = True
- _broken_rowcount = True
+ _drivername_ = 'pyPgSQL.PgSQL'
+ _rowidField_ = None # PyPgSQL doesn't support rowid's!!
+ _broken_fetchmany_ = True
+ _broken_rowcount_ = True
Modified: trunk/gnue-common/src/datasources/drivers/sql/sqlite/pysqlite.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sql/sqlite/pysqlite.py
2005-06-20 12:05:13 UTC (rev 7626)
+++ trunk/gnue-common/src/datasources/drivers/sql/sqlite/pysqlite.py
2005-06-20 13:28:00 UTC (rev 7627)
@@ -112,12 +112,12 @@
Connection class for SQLite backends using the pysqlite DBSIG2 module.
"""
- _drivername = 'sqlite'
- _behavior = Behavior.Behavior
+ _drivername_ = 'sqlite'
+ _behavior_ = Behavior.Behavior
# SQLite doesn't like boolean type in SQL parameters
- _boolean_true = 1
- _boolean_false = 0
+ _boolean_true_ = 1
+ _boolean_false_ = 0
# ---------------------------------------------------------------------------
@@ -135,7 +135,7 @@
# Return a sequence of required login fields
# ---------------------------------------------------------------------------
- def _getLoginFields (self):
+ def _getLoginFields_ (self):
"""
This function returns an empty sequence since SQLite doesn't use any user
authentication.
@@ -147,7 +147,7 @@
# Get connection parameters
# ---------------------------------------------------------------------------
- def _getConnectParams (self, connectData):
+ def _getConnectParams_ (self, connectData):
# mandatory parameters
kwargs = {'db' : connectData ['dbname'],
@@ -161,9 +161,9 @@
# Commit a pending transactiona pending transaction
# ---------------------------------------------------------------------------
- def _commit (self):
+ def _commit_ (self):
"""
This function performs a commit depending on the current transaction-flag.
"""
if not self.__noTransactions:
- DBSIG2.Connection._commit (self)
+ DBSIG2.Connection._commit_ (self)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7627 - in trunk/gnue-common/src/datasources: . drivers/Base drivers/DBSIG2 drivers/file drivers/other drivers/sql/interbase drivers/sql/maxdb drivers/sql/msado drivers/sql/mysql drivers/sql/oracle drivers/sql/postgres drivers/sql/sqlite,
reinhard <=