Package omero :: Package plugins :: Module hql
[hide private]
[frames] | no frames]

Source Code for Module omero.plugins.hql

 1  #!/usr/bin/env python 
 2  """ 
 3     HQL plugin 
 4   
 5     Plugin read by omero.cli.Cli during initialization. The method(s) 
 6     defined here will be added to the Cli class for later use. 
 7   
 8     Copyright 2008 Glencoe Software, Inc. All rights reserved. 
 9     Use is subject to license terms supplied in LICENSE.txt 
10   
11  """ 
12   
13  from omero.cli import CLI, BaseControl 
14  import cmd, sys, exceptions 
15  import sys 
16   
17 -class HqlCLI(CLI):
18 19 prompt = "omero hql [%s]> " 20
21 - def __init__(self):
22 CLI.__init__(self) 23 self.queue = [] 24 self.prompt = HqlCLI.prompt % str(0)
25
26 - def invoke(self, args):
27 args = Arguments(args)
28
29 -class HqlControl(BaseControl):
30
31 - def help(self, args = None):
32 self.ctx.out(""" 33 Syntax: %(program_name)s hql param1=value1 param2=value2 select x from X ... 34 35 Executes an HQL statement with the given parameters. 36 If no query is given, then a shell is opened which 37 will run any entered query with the current parameters. 38 """)
39
40 - def __call__(self, *args):
41 args = Arguments(*args) 42 hql = HqlCLI() 43 if len(args) > 0: 44 hql.invoke(args) 45 else: 46 hql.invokeloop()
47 48 try: 49 register("hql", HqlControl) 50 except NameError: 51 HqlControl()._main() 52