########################################################################

from SkunkWeb import Configuration
import MySQL
from SkunkExcept import SkunkStandardError
from requestHandler.requestHandler import CleanupRequest

Configuration.mergeDefaults(MySQLConnectParams={},
                            MySQLRollback=0,
                            MySQLTestFunc=None)

# add test function (used by MySQL connection cache to test
# connections before handing them out)
MySQL.connection_test = Configuration.MySQLTestFunc

for u, p in Configuration.MySQLConnectParams.items():
    MySQL.initUser(u, p)


# optional rollback
def rollback(*args):
    for v in MySQL._connections.values():
        try:
            v.rollback()
        except:
            pass


if Configuration.MySQLRollback:
    CleanupRequest.addFunction(rollback)
Beispiel #2
0
#      GNU General Public License for more details.
#  
#      You should have received a copy of the GNU General Public License
#      along with this program; if not, write to the Free Software
#      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
#   
from SkunkWeb import Configuration, LogObj, ServiceRegistry
from requestHandler.requestHandler import CleanupRequest
import Oracle

ServiceRegistry.registerService('oracle')

Configuration.mergeDefaults(
    OracleConnectStrings = {},
    OracleProcedurePackageLists = {}
    )

for u, str in Configuration.OracleConnectStrings.items():
    LogObj.DEBUG(ServiceRegistry.ORACLE, 'initializing user %s' % u)
    Oracle.initUser(u, str)

for u, pkglist in Configuration.OracleProcedurePackageLists:
    Oracle.loadSignatures(u, pkglist, LogObj.LOG,
                       lambda x: LogObj.DEBUG(ServiceRegistry.ORACLE, x))

def rollbackConnection(*args):
    for v in Oracle._connections.values():
        v.rollback()

CleanupRequest.addFunction(rollbackConnection)