Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » Execute SQL
Execute SQL [message #783040] Tue, 24 January 2012 18:42 Go to next message
Timothy Vogel is currently offline Timothy Vogel
Messages: 71
Registered: July 2009
Member
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?
Re: Execute SQL [message #783103 is a reply to message #783040] Tue, 24 January 2012 23:03 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2499
Registered: July 2009
Senior Member
On 2012-25-01 24:42, Timothy Vogel wrote:
> 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.

For an entry point into touchpoints, look at
http://wiki.eclipse.org/Equinox/p2/Engine/Touchpoint_Instructions_35

and

http://wiki.eclipse.org/Equinox/p2/Customizing_Metadata

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.

Regards
- henrik
Re: Execute SQL [message #783220 is a reply to message #783103] Wed, 25 January 2012 05:00 Go to previous message
Timothy Vogel is currently offline Timothy Vogel
Messages: 71
Registered: July 2009
Member
Thanks for the helpful reply and the links. I will do some research along the lines you suggest.
Previous Topic:Creating a customized Eclipse CDT distribution
Next Topic:Problem with feature patch
Goto Forum:
  


Current Time: Sat Aug 30 22:34:19 EDT 2014

Powered by FUDForum. Page generated in 0.05303 seconds