Digest for jooq-user@googlegroups.com - 2 updates in 1 topic

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Digest for jooq-user@googlegroups.com - 2 updates in 1 topic

http://groups.google.com/group/jooq-user/topics mailing list
[hidden email]: Sep 25 03:57PM -0700

I am using the latest jOOQ 3.9.5.
I went through the 7 step tutorial as provided on the main website.
Configuration: mysql running on 6033, basic credentials (this is a dummy
database that I setup specifically for this task)
 
DB Schema is as follows
 
CREATE DATABASE `library`;
 
USE `library`;
 
CREATE TABLE `author` (
`id` int NOT NULL,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
);
 
 
 
 
I generated the backing code using the default settings - and the program
works
import org.jooq.*;
import org.jooq.conf.ParamType;
import org.jooq.conf.Settings;
import org.jooq.conf.StatementType;
import org.jooq.impl.DSL;
 
import static library.Tables.*;
import static org.jooq.impl.DSL.*;
 
 
import java.sql.*;
 
public class JooqTutorial {
public static void main(String[] args) {
String username = "root";
String password = "root";
String url = "jdbc:mysql://127.0.0.1:6033/library";
 
try (Connection conn = DriverManager.getConnection(url, username,
password)) {
Settings settings = new Settings();
settings.setStatementType(StatementType.STATIC_STATEMENT);
settings.setParamType(ParamType.INLINED);
DSLContext create = DSL.using(conn, SQLDialect.MYSQL, settings);
SelectConditionStep<Record> fred =
create.select().from(AUTHOR).where(
AUTHOR.FIRST_NAME.eq(inline("fred"))
);
Result<Record> result = fred.fetch();
for (Record r : result) {
Integer id = r.getValue(AUTHOR.ID);
String firstName = r.getValue(AUTHOR.FIRST_NAME);
String lastName = r.getValue(AUTHOR.LAST_NAME);
System.out.printf("Id:%d %s, %s\n", id, lastName,
firstName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
 
However, the code is not respecting the inline setting. Instead the
following statement is being generated and sent to the db
select `library`.`author`.`id`, `library`.`author`.`first_name`,
`library`.`author`.`last_name` from `library`.`author` where
`library`.`author`.`first_name` = ?
 
 
I know I have technically redundant settings and calls to inline, but I
figure at least one of them should have resulted in the query being sent
'inline' and not as a prepared statement. I am not sure why it isn't
inlining the value of 'fred' as described in the documentation.
Lukas Eder <[hidden email]>: Sep 26 09:53AM +0200

Hello,
 
How did you get this query string? I cannot reproduce this issue. The bind
variable gets correctly inlined. All of your flags are correct API usage.
 
Thanks,
Lukas
 
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].