org.basex.core.cmd
Class AQuery

java.lang.Object
  extended by org.basex.core.Proc
      extended by org.basex.core.Command
          extended by org.basex.core.cmd.AQuery
Direct Known Subclasses:
Cs, Find, InfoStorage, XQuery

public abstract class AQuery
extends Command

Abstract class for database queries.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Field Summary
protected  Result result
          Query result.
 
Fields inherited from class org.basex.core.Command
args, context, in, mprop, out, perf, prop
 
Fields inherited from class org.basex.core.Proc
listen, updating
 
Constructor Summary
protected AQuery(Perm p, boolean d, java.lang.String... arg)
          Protected constructor.
 
Method Summary
 void build(CmdBuilder cb)
          Builds a string representation from the command.
 void databases(LockResult lr)
          Adds the names of the databases that may be touched by the process.
protected  boolean query(java.lang.String query)
          Evaluates the specified query.
protected  void queryNodes()
          Performs the first argument as XQuery and returns a node set.
 Result result()
          Returns the result set, generated by a query command.
 boolean stoppable()
          Returns true if this command can be stopped.
 boolean updated(Context ctx)
          Checks if the command has updated any data.
 boolean updating(Context ctx)
          Checks if the command performs updates/write operations.
protected  boolean updating(Context ctx, java.lang.String qu)
          Checks if the query might perform updates.
 
Methods inherited from class org.basex.core.Command
close, databases, error, execute, execute, getOption, getOption, info, info, newData, run, run, run, setInput, setInput, supportsProg, toString
 
Methods inherited from class org.basex.core.Proc
abort, checkStop, det, detail, listen, proc, prog, progress, registered, registered, startTimeout, stop, stopTimeout, tit, title
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

result

protected Result result
Query result.

Constructor Detail

AQuery

protected AQuery(Perm p,
                 boolean d,
                 java.lang.String... arg)
Protected constructor.

Parameters:
p - required permission
d - requires opened database
arg - arguments
Method Detail

query

protected final boolean query(java.lang.String query)
Evaluates the specified query.

Parameters:
query - query
Returns:
success flag

updating

protected final boolean updating(Context ctx,
                                 java.lang.String qu)
Checks if the query might perform updates.

Parameters:
ctx - database context
qu - query
Returns:
result of check

queryNodes

protected final void queryNodes()
Performs the first argument as XQuery and returns a node set.


updating

public boolean updating(Context ctx)
Description copied from class: Command
Checks if the command performs updates/write operations.

Overrides:
updating in class Command
Parameters:
ctx - database context
Returns:
result of check

updated

public boolean updated(Context ctx)
Description copied from class: Command
Checks if the command has updated any data.

Overrides:
updated in class Command
Parameters:
ctx - database context
Returns:
result of check

databases

public void databases(LockResult lr)
Description copied from class: Proc
Adds the names of the databases that may be touched by the process.

Overrides:
databases in class Proc
Parameters:
lr - Container for lock result to pass around

build

public void build(CmdBuilder cb)
Description copied from class: Command
Builds a string representation from the command. This string must be correctly built, as commands are sent to the server as strings.

Overrides:
build in class Command
Parameters:
cb - command builder

stoppable

public boolean stoppable()
Description copied from class: Command
Returns true if this command can be stopped. This method is required by the progress dialog in the frontend.

Overrides:
stoppable in class Command
Returns:
result of check

result

public final Result result()
Description copied from class: Command
Returns the result set, generated by a query command. Will only yield results if Prop.CACHEQUERY is set, and can only be called once.

Overrides:
result in class Command
Returns:
result set