I need to run an update query from Servoy on a mySQL table. I am using mySQL 4.x so stored procedures are not possible at this time.
I have written a method but the only thing I could find to run a query is “getDataSetByQuery” Is there another way to execute a SQL query from Servoy? or am I going to have to loop through records in Servoy to do this update? If that is the case I can, but I was hoping to run an update query for speed.
Servoy doesn’t support custom update queries, due to the fact that servoy does datachange braodcasting.
When you would be able to run any custom update query yourself, the cached data would become updated, 'causing who know what kind of trouble.
First option would be: Try using the FoundSet updater (look under the DatabaseManager node). This allows updating multiple records at the same time.
If that doesn’t work for you, I guess you have to loop through the records yourself.
Running updates from DB Stored Procedures is the third option. Then you have to take care of refreshing cached data yourself after executing the SP. But, I guess you say mySQL 4.x doesn’t support running updates from SP’s? mySQL 4.x is not my cup of tea, so I wouldn’t know.
A fourth option would be building a plugin to get a connection to the database and perform the update over that. Still then you have to take care of the cached data refresh in Servoy.
Hope this gives you some ideas of the options available.
Paul
Thanks Paul. I think the foundSet updater will do what I need.
There are so many options that often times I have difficulty finding the “right” way to do something.