https://kotlinlang.org logo
#exposed
Title
# exposed
s

samir

02/06/2019, 10:28 AM
Is it possible to get this to work with exposed in a transaction block?
Copy code
SET @total = 2; 
PREPARE STMT FROM "SELECT * FROM my_table LIMIT ?"; 
EXECUTE STMT USING @total;
I know that this is not type safe and that it is better to use DSL/DAO but the requirements is that statements should be defined as strings from an admin interface.
Copy code
Exception in thread "main" org.jetbrains.exposed.exceptions.ExposedSQLException: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PREPARE STMT FROM "SELECT * FROM my_table LIMIT ?";
EXECUTE STMT USING @total' at line 2
SQL: [SET @total = 2;
PREPARE STMT FROM "SELECT * FROM my_table LIMIT ?";
EXECUTE STMT USING @total;]
t

tapac

02/06/2019, 6:39 PM
I'm not sure, but you can try https://stackoverflow.com/a/10804730/813981
s

samir

02/07/2019, 10:02 AM
@tapac Thanks
3 Views