Currently we are using MySQL and the JDBC connector for our application. In some cases we are doing :
ResultSet rset ....
rset.moveToInsertRow();
...
...
rset.updateInt(...).
I have a simple question, is there a easy way to get the SQL generated by this statement programatically? We are looking at implementing MySQL bin-log alternatives for the app.
Not too likely. The SQL would look something like this:
UPDATE table SET field = value WHERE primarykey = value
Most of that could be done, but your code doesn't know which column is the primary key. MySQL does (if there isn't one, it will complain) but your code doesn't. Unless perhaps you had a convention where the primary key is the first column, or something like that.
Basically I am trying to implement a MySQL bin-log that saved in the database. The alternative is to write bridge code that will move the log to a table.
Or remove the updatable resultsets. IMHO, updatable resultsets are slower than a straight insert or update.
The whole idea was not exposing db architecture to the client.
Let me tell you a story about a man named Jed. He made this tiny ad:
Gift giving made easy with the permaculture playing cards