Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle adapter #666

Closed
Angy999 opened this issue Jul 19, 2021 · 4 comments
Closed

Oracle adapter #666

Angy999 opened this issue Jul 19, 2021 · 4 comments

Comments

@Angy999
Copy link

Angy999 commented Jul 19, 2021

in the file oracle.py the code

cmd_fix = re.compile("[^']*('[^']*'[^']*)*\:(?P<clob>(C|B)LOB\('([^']+|'')*'\))")

def _initialize_(self, do_connect):
    super(Oracle, self)._initialize_(do_connect)
    ....

not work for me, I believe it must be the following

REGEX_CLOB = re.compile("[^']*('[^']*'[^']*)*\:(?P<clob>(C|B)LOB\('([^']+|'')*'\))")

def _initialize_(self):
    super(Oracle, self)._initialize_()
    ....

thanks

@mdipierro
Copy link
Contributor

mdipierro commented Jul 19, 2021 via email

@Angy999
Copy link
Author

Angy999 commented Jul 19, 2021

OK Massimo, on web2py there is an error and it works with the change.
Comparing old versions I have that the init class has been rewritten

Old class BaseAdapter

def __init__(self, db, uri, pool_size=0, folder=None, db_codec='UTF-8',
             credential_decoder=IDENTITY, driver_args={},
             adapter_args={}, do_connect=True, after_connection=None,
             entity_quoting=False):
    super(BaseAdapter, self).__init__()
    self._load_dependencies()
    self.db = db
    self.uri = uri
    self.pool_size = pool_size
    self.folder = folder
    self.db_codec = db_codec
    self.credential_decoder = credential_decoder
    self.driver_args = driver_args
    self.adapter_args = adapter_args
    self.expand = self._expand
    self._after_connection = after_connection
    self.connection = None
    self.find_driver()
    self._initialize_(do_connect)
    if do_connect:
        self.reconnect()

New class BaseAdapter :

def __init__(
    self,
    db,
    uri,
    pool_size=0,
    folder=None,
    db_codec="UTF-8",
    credential_decoder=IDENTITY,
    driver_args={},
    adapter_args={},
    after_connection=None,
    entity_quoting=False
):
    super(BaseAdapter, self).__init__()
    self._load_dependencies()
    self.db = db
    self.uri = uri
    self.pool_size = pool_size
    self.folder = folder
    self.db_codec = db_codec
    self.credential_decoder = credential_decoder
    self.driver_args = driver_args
    self.adapter_args = adapter_args
    self.expand = self._expand
    self._after_connection = after_connection
    self.set_connection(None)
    self.find_driver()
    self._initialize_()

And now for example I no longer see the option "do_connect = True"

Then in line 51 of the oracle.py file there is the line "
m = re.match (self.REGEX_CLOB, command) "

but it is not defined" self.REGEX_CLOB ",

it should be cmd_fix which I renamed.

However now it works for me and connects to an Oracle Rac 12.0.2

I hope to be proved helpful

ciao

@mdipierro
Copy link
Contributor

mdipierro commented Jul 20, 2021 via email

@Angy999 Angy999 closed this as completed Jul 30, 2021
@Angy999
Copy link
Author

Angy999 commented Jul 30, 2021

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants