akarshan2701 / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

SQL-Excption in Browser Console when trying to edit result from select command spanning multiple lines #183

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
# Before submitting a bug, please check the FAQ:
# http://www.h2database.com/html/faq.html
-> done.

# What steps will reproduce the problem?
# (simple SQL scripts or simple standalone applications are preferred)
1. Enter Select command spanning multiple lines - table creation at end-of-text
    Select * From ADR
    Where Lower(SURNAME) Like '%a%';

2. Press Edit button - Bearbeiten in German.
3. SQL-Excption

# What is the expected output? What do you see instead?
Syntax Fehler in SQL Befehl "SELECT * FROM ADR
<[*]BR />WHERE LOWER(SURNAME) LIKE '%a%' "
Syntax error in SQL statement "SELECT * FROM ADR
<[*]BR />WHERE LOWER(SURNAME) LIKE '%a%' "; SQL statement:
Select * From ADR
<br />Where Lower(SURNAME) Like '%a%' [42000-132] 42000/42000 (Hilfe)
org.h2.jdbc.JdbcSQLException: Syntax Fehler in SQL Befehl "SELECT * FROM ADR
<[*]BR />WHERE LOWER(SURNAME) LIKE '%a%' "
Syntax error in SQL statement "SELECT * FROM ADR
<[*]BR />WHERE LOWER(SURNAME) LIKE '%a%' "; SQL statement:
Select * From ADR
<br />Where Lower(SURNAME) Like '%a%' [42000-132]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:316)
    at org.h2.message.DbException.get(DbException.java:167)
    at org.h2.message.DbException.get(DbException.java:144)
    at org.h2.message.DbException.getSyntaxError(DbException.java:179)
    at org.h2.command.Parser.getSyntaxError(Parser.java:474)
    at org.h2.command.Parser.prepareCommand(Parser.java:238)
    at org.h2.engine.Session.prepareLocal(Session.java:420)
    at org.h2.server.TcpServerThread.process(TcpServerThread.java:224)
    at org.h2.server.TcpServerThread.run(TcpServerThread.java:135)
    at java.lang.Thread.run(Thread.java:595)

    at org.h2.engine.SessionRemote.done(SessionRemote.java:505)
    at org.h2.command.CommandRemote.prepare(CommandRemote.java:70)
    at org.h2.command.CommandRemote.<init>(CommandRemote.java:48)
    at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:401)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1070)
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:163)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:151)
    at org.h2.server.web.WebApp.getResult(WebApp.java:1258)
    at org.h2.server.web.WebApp.query(WebApp.java:974)
    at org.h2.server.web.WebApp.process(WebApp.java:214)
    at org.h2.server.web.WebApp.processRequest(WebApp.java:161)
    at org.h2.server.web.WebThread.process(WebThread.java:129)
    at org.h2.server.web.WebThread.run(WebThread.java:86)
    at java.lang.Thread.run(Thread.java:595) 

# What version of the product are you using? On what operating system, file
# system, and virtual machine?
H2 1.2.132 (2010-03-21)
WinXP pro SP3
Parallels 3 on Mac OS X 10.4

# Do you know a workaround?
Only use single line Select commands for editing.

# How important/urgent is the problem for you?
Important but not urgent. Fix in next or next but one release.

# In your view, is this a defect or a feature request?
If I read the docs and the examples correctly, SQL commands may span multiple 
lines. For using 
multiple commands they must be separated by ;
If a Select is working, then an edit should work too !

# Please provide any additional information below.
I created the table from a CSV file:

Create Table ADR As
Select rownum() "NR",*
From CSVread('C:/h2-test/aaa.csv',null,'iso-8859-1',';');
Alter Table ADR Alter NR int Not Null;
Alter Table ADR Add Primary Key (NR);

Without looking at the sources my guess is that different parser options are 
used. Should be 
easy to fix.

2010-03-26 dz

Original issue reported on code.google.com by Dirk.Zoe...@googlemail.com on 26 Mar 2010 at 5:02

GoogleCodeExporter commented 8 years ago
This is a bug at the very end of WebApp.getResultSet(..):

if (!edit && isUpdatable && allowEdit) {
    ...
    append(PageParser.escapeHtml(sql))
    ...
}

should be:

    ...
    append(PageParser.escapeHtmlData(sql))
    ...

I will fix it in the next release.

Original comment by thomas.t...@gmail.com on 26 Mar 2010 at 5:35

GoogleCodeExporter commented 8 years ago
Fixed in version 1.2.133

Original comment by thomas.t...@gmail.com on 10 Apr 2010 at 8:45