On Tuesday, 4 December 2018 15:09:35 UTC, Christian Hauser wrote:
>
>    
> Hi Charles
>
> Your problem is likely the way you build your test database. Your Query 
> contains a semicolon after toString() to end the Java statement, but your 
> script takes this as the end of the SQL statement which would be wrong in 
> this case. You'll have to try to escape the whole statement and not just 
> the part up to the first semicolon.
>

That is a good point, and appears to be true, as if I remove the semicolon 
after the return statement I get this error:

Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement 
"/org/h2/dynamic/NEXT_PRIME.java:6: error: ';' expected

    public static  String nextPrime(String value) { return new 
BigInteger(value).nextProbablePrime().toString() } 

                                                                           
                                    ^

1 error

"; SQL statement:

create alias next_prime as $$ String nextPrime(String value) { return new 
BigInteger(value).nextProbablePrime().toString() } $$ [42000-193]

at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) 
~[h2-1.4.193.jar:1.4.193]
 
Any suggestions how to escape the statement?  I have tried searching around 
on Google with no success so far.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to