Hi Daniel,
I am not an MySQL expert, but generally you should not execute two statements
at once.
Hence you need to split it up like this:
db.executeSQL("SET @a:=-1", null, conn);
db.executeSQL("UPDATE EDGE SET id=( SELECT @a := @a + 1 ) WHERE GRAPH_ID=?
ORDER BY ID ASC",new Object[] { graphId }, conn);
BTW:
Last time you asked for batch execution which we have now added in version
2.4.4.
You can do it like this
DBSQLScript script = new DBSQLScript();
script.addStmt("SET @a:=-1");
script.addStmt("UPDATE EDGE SET id=( SELECT @a := @a + 1 ) WHERE GRAPH_ID=?
ORDER BY ID ASC", new Object[] { graphId });
script.executeBatch(db.getDriver(), conn);
Regards,
Rainer
from: [email protected] [mailto:[email protected]] Im Auftrag von
Daniel Weidele
to: [email protected]
re: MySQL with Variables
Hi friends,
is anyone aware of how to correctly use something like
db.executeSQL("SET @a:=0; UPDATE EDGE SET id=@a:=@a+1 WHERE GRAPH_ID=?;", new
Object[] { graphId }, conn);
I only receive syntax errors from within JDBC, so this isn't necessarily an
EmpireDB issue - however, I wouldn't know what to tell JDBC either.
Submitting the statement (without parameter ?, but the actual value) directly
in the data base's admin GUI works perfectly (MySQL).
Do you have any ideas whether I need to escape/configure something?
Cheers & thanks,
Daniel
--
Daniel K.I. Weidele, M.Sc. B.Sc.
PhD student
ERC Synergy-NEXUS 1492<http://www.nexus1492.eu/>
Algorithmics Group
Department of Computer & Information Science
University of Konstanz
PO Box 67
78457 Konstanz
mobile. +49 (0)174 7275725
office. +49 (0)7531 88-4571