andialbrecht / crunchyfrog

Head over to RunSQLRun, the successor of CrunchyFrog
http://runsqlrun.org
GNU General Public License v3.0
5 stars 2 forks source link

Oracle plugin - querying a table results in an error #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. connect to an oracle database
2. open a new query
3. try do query a table (e.g.: "desc all_synonyms;")

What is the expected output?

- table's content

 What do you see instead?

An error message:
Query failed (0.000 seconds)
expecting None or a string

What version of the product are you using? On what operating system? Python
version?

SVN rev. 592 - the same is happening on the latest debian package.

Please provide any additional information below.

Simply querying a table was working in a previous version. I've read
crunchy's developer can't test Oracle plugin anymore. I am available to
test it in a real Oracle 11g environment, and eventually help developing
the Oracle plugin.

Test was executed on a Ubuntu Intrepid 8.10

Original issue reported on code.google.com by massimil...@gmail.com on 1 Apr 2009 at 9:55

GoogleCodeExporter commented 9 years ago
Someone reported a similar bug to the bug tracker of the underlying cx_Oracle 
module:
http://sourceforge.net/tracker/index.php?func=detail&aid=1582216&group_id=84168&
atid=571972

It seems that "desc/describe" is a SQL*Plus specific command, so the actual 
problem
reported here won't fix. Anyway the error message is wrong, it should be 
'ORA-00900:
invalid SQL statement'.

Thanks for your offer to test the Oracle plugin! It will become a builtin 
plugin with
the next release (currently it lives in a somewhat experimental place) and I 
hope to
add more meta information during a substantial rework of the meta data engine 
that's
needed to implement tab-completion (issue36).

Original comment by albrecht.andi on 1 Apr 2009 at 2:47

GoogleCodeExporter commented 9 years ago
Hi

Sorry, I just posted the wrong example: the problems is happening on any table
querying, DESC or SELECT. I haven't investigated any further. Attached is a
screenshot with a SELECT example output.

Original comment by massimil...@gmail.com on 1 Apr 2009 at 3:05

Attachments:

GoogleCodeExporter commented 9 years ago
Ah, ok. The actual problem is that the recent version of the sqlparse included 
with
the application return unicode instead of str. It seems that the cx_Oracle 
database
backend doesn't like unicode strings and instist on str or None (for whatever 
reason)
for statements.

As a workaround you can change cf/backends/__init__.py in execute() the line

self.cursor.execute(self.statement)

to

self.cursor.execute(str(self.statement))

A proper solution would be that the Oracle backend does this conversion before
executing the query (but I currently have no time to have a close look at it).

Original comment by albrecht.andi on 1 Apr 2009 at 3:27

GoogleCodeExporter commented 9 years ago
I've the change suggested: now it works (see attached Schermata-2.png 
screenshot),
but only if you omit the ";" at the end of the line: otherwise it reports an 
"invalid
charachter" error (see attached Schermata-1.png screenshot)

Original comment by massimil...@gmail.com on 1 Apr 2009 at 3:58

Attachments:

GoogleCodeExporter commented 9 years ago
Committed preparation of statements before execution in r594. Currently that's 
only
required for the Oracle backend. The Oracle implementation now converts the 
given
statement to str and removes a trailing semicolon if present.

Thanks for reporting and testing! I'm closing this issue now, but feel free to 
leave
another comment or file a new issue if other problems occur.

Original comment by albrecht.andi on 1 Apr 2009 at 7:17