can somebody with oracle installation try this code with web.py 0.3
and let me know if works?

from web.db import DB, register_database

class OracleDB(DB):
    def __init__(self, **keywords):
        import cx_Oracle as db
        if 'pw' in keywords:
            keywords['password'] = keywords.pop('pw')
        #@@ TODO: use db.makedsn if host, port is specified
        keywords['dsn'] = keywords.pop('db')

        self.dbname = 'oracle'
        db.paramstyle = 'numeric'
        # oracle doesn't support pooling
        keywords.pop('pooling', None)
        DB.__init__(self, db, keywords)

    def _process_insert_query(self, query, tablename, seqname):
        #@@ is this the correct way to find the sequence name?
        if seqname is None:
            seqname = tablename + "_id_seq"
        return query + "; SELECT %s.currval FROM dual" % seqname

register_database('oracle', OracleDB)

# create database object
db = web.connect(dbn='oracle', user='scott', pw='tiger', db='test')

# try some queries
db.insert(...)
db.select(...)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to