You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Aleksy Wróblewski (Jira)" <ji...@apache.org> on 2022/10/17 18:18:00 UTC
[jira] [Commented] (KARAF-4732) jdbc:query cannot parse wildcard % in SQL like expression
[ https://issues.apache.org/jira/browse/KARAF-4732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17619045#comment-17619045 ]
Aleksy Wróblewski commented on KARAF-4732:
------------------------------------------
It works for me in 4.4.2-SNAPSHOT.
Tested with [karaf-jdbc-example|https://github.com/apache/karaf/tree/main/examples/karaf-jdbc-example]:
{code}
karaf@root()> feature:repo-add mvn:org.apache.karaf.examples/karaf-jdbc-example-features/LATEST/xml
Adding feature url mvn:org.apache.karaf.examples/karaf-jdbc-example-features/LATEST/xml
karaf@root()> feature:install karaf-jdbc-example-provider
karaf@root()> feature:install karaf-jdbc-example
karaf@root()> booking:add Doe AF520
karaf@root()> jdbc:query jdbc/karaf-example "select * from KARAF_EXAMPLE.BOOKING where FLIGHT like '%520'"
FLIGHT │ CUSTOMER │ ID
───────┼──────────┼───
AF520 │ Doe │ 1
karaf@root()> jdbc:query jdbc/karaf-example "select * from KARAF_EXAMPLE.BOOKING where FLIGHT like 'AF%'"
FLIGHT │ CUSTOMER │ ID
───────┼──────────┼───
AF520 │ Doe │ 1
karaf@root()> jdbc:query jdbc/karaf-example "select * from KARAF_EXAMPLE.BOOKING where FLIGHT like '%AF520%'"
FLIGHT │ CUSTOMER │ ID
───────┼──────────┼───
AF520 │ Doe │ 1
{code}
> jdbc:query cannot parse wildcard % in SQL like expression
> ---------------------------------------------------------
>
> Key: KARAF-4732
> URL: https://issues.apache.org/jira/browse/KARAF-4732
> Project: Karaf
> Issue Type: Bug
> Affects Versions: 4.0.5
> Reporter: Jirka
> Priority: Major
>
> from Karaf shell
> jdbc:query myDB select * from parameters where name like '%somename'
> causes an error
> {code}
> Error executing command: bad expression: select * from parameters where name like '%somename'
> {code}
> log
> {code}
> 2016-09-26 10:15:39,815 | ERROR | nsole user karaf | ShellUtil | 44 - org.apache.karaf.shell.core - 4.0.5 | Exception caught while executing command
> org.apache.felix.gogo.runtime.SyntaxError: bad expression: select * from parameters where name like '%somename'
> at org.apache.felix.gogo.runtime.Tokenizer.expandExp(Tokenizer.java:615)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Tokenizer.expand(Tokenizer.java:516)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Tokenizer.expand(Tokenizer.java:492)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Tokenizer.expand(Tokenizer.java:561)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Tokenizer.expand(Tokenizer.java:492)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Tokenizer.expand(Tokenizer.java:476)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Closure.eval(Closure.java:271)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:342)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)[44:org.apache.karaf.shell.core:4.0.5]
> at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:270)[44:org.apache.karaf.shell.core:4.0.5]
> at java.lang.Thread.run(Thread.java:745)[:1.8.0_92]
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)