Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsExecute SQL
https://www.eclipse.org/forums/index.php/mv/msg/278962/783040/#msg_783040
Is there a pattern or example of how to accomplish this task?]]>Timothy Vogel2012-01-24T23:42:19-00:00Re: Execute SQL
https://www.eclipse.org/forums/index.php/mv/msg/278962/783103/#msg_783103
> I need to execute SQL as part of a p2 update to modify the schema of the
> users database. I have the SQL script and the command line to execute it
> (if I was typing it on each users' computer). I don't know how to have
> p2 execute a command line program as part of it's update.
>
> Is there a pattern or example of how to accomplish this task?
IIRC, there is no general "execute system command" action in p2 (mainly
for security reasons), you have to write one yourself (or find one
written by someone else).
It is not that hard; look at the native touchpoint instructions "link"
and "chmod" which are implemented using System.execs.
You can deliver the touchpoint action using meta requirements. Here is
one message on the topic that points to various issues and questions
(many resolved since this was written). http://dev.eclipse.org/mhonarc/lists/p2-dev/msg01661.html - I spent
about 10 seconds googling, I am sure you can find better information...
One very important aspect of doing the transformation during
installation is that it is possible to uninstall/reverse the action in
case the installation fails half way through, or if user wants to return
to previous configuration. You can support this by making your action
use the Backup facility available in the actions (look at the
implementation of some of the native touchpoints).
Also search for presentation "Extending p2 for fun and Profit" (IIRC
name correctly) that should also help you.