org.basex.core.proc
Class CreateDB

java.lang.Object
  extended by org.basex.core.Progress
      extended by org.basex.core.Proc
          extended by org.basex.core.proc.CreateDB

public final class CreateDB
extends Proc

Evaluates the 'create db' command and creates a new database.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen

Field Summary
 
Fields inherited from class org.basex.core.Proc
DATAREF, flags, STANDARD
 
Constructor Summary
CreateDB(String input)
          Constructor.
CreateDB(String input, String name)
          Default constructor.
 
Method Summary
static Data empty(Context ctx, String name)
          Creates an empty database.
 String toString()
          Returns a string representation of the process.
static Data xml(Context ctx, IO io, String name)
          Creates a database for the specified file.
static Data xml(Context ctx, Parser p, String db)
          Creates a database instance from the specified parser.
static Data xml(IO io, Prop pr)
          Creates a main memory database from the specified input reference.
static Data xml(Parser p)
          Creates a main memory database for the specified parser.
static Data xml(SAXSource s, Prop pr)
          Creates a main memory database from the specified SAX source.
 
Methods inherited from class org.basex.core.Proc
exec, exec, execute, execute, info, result, updating
 
Methods inherited from class org.basex.core.Progress
abort, checkStop, det, detail, prog, progress, progress, stop, tit, title
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CreateDB

public CreateDB(String input,
                String name)
Default constructor.

Parameters:
input - input XML file or XML string
name - name of database

CreateDB

public CreateDB(String input)
Constructor. The file name, excluding the suffix, is used as database name.

Parameters:
input - input file or XML string
Method Detail

empty

public static Data empty(Context ctx,
                         String name)
                  throws IOException
Creates an empty database.

Parameters:
ctx - database context
name - name of the database
Returns:
database instance
Throws:
IOException - I/O exception

xml

public static Data xml(Context ctx,
                       IO io,
                       String name)
                throws IOException
Creates a database for the specified file.

Parameters:
ctx - database context
io - file reference
name - name of the database
Returns:
database instance
Throws:
IOException - I/O exception

xml

public static Data xml(Context ctx,
                       Parser p,
                       String db)
                throws IOException
Creates a database instance from the specified parser.

Parameters:
ctx - database context
p - xml parser
db - name of the database
Returns:
database instance
Throws:
IOException - I/O exception

xml

public static Data xml(Parser p)
                throws IOException
Creates a main memory database for the specified parser.

Parameters:
p - xml parser
Returns:
database instance
Throws:
IOException - I/O exception

xml

public static Data xml(IO io,
                       Prop pr)
                throws IOException
Creates a main memory database from the specified input reference.

Parameters:
io - file reference
pr - database properties
Returns:
database instance
Throws:
IOException - I/O exception

xml

public static Data xml(SAXSource s,
                       Prop pr)
                throws IOException
Creates a main memory database from the specified SAX source.

Parameters:
s - sax source
pr - database properties
Returns:
database instance
Throws:
IOException - I/O exception

toString

public String toString()
Description copied from class: Proc
Returns a string representation of the process. In the client/server architecture, this string is sent to and reparsed by the server.

Overrides:
toString in class Proc
Returns:
string representation