Class CreateDB


public final class CreateDB extends ACreate
Evaluates the 'create db' command and creates a new database.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • CreateDB

      public CreateDB(String name)
      Default constructor. Input can be set via Command.setInput(InputStream).
      Parameters:
      name - name of database
    • CreateDB

      public CreateDB(String name, String input)
      Constructor, specifying an initial database input.
      Parameters:
      name - name of database
      input - input reference (local/remote file path or XML string; can be null)
  • Method Details

    • setParser

      public void setParser(Parser prsr)
      Attaches a parser.
      Parameters:
      prsr - input parser
    • run

      protected boolean run()
      Description copied from class: Command
      Executes the command and serializes the result (internal call).
      Specified by:
      run in class Command
      Returns:
      success of operation
    • addLocks

      public void addLocks()
      Description copied from class: Job
      Adds the strings (databases, special identifiers) for which locks need to be acquired.
      Overrides:
      addLocks in class ACreate
    • create

      public static Data create(String name, Parser parser, Context ctx, MainOptions options) throws IOException
      Returns a database instance from the specified parser.
      Parameters:
      name - name of the database
      parser - input parser
      ctx - database context
      options - main options
      Returns:
      new database instance
      Throws:
      IOException - I/O exception
    • create

      public static Data create(String name, Parser parser, Context ctx, MainOptions options, boolean mem) throws IOException
      Creates a new database instance, using the specified parser.
      Parameters:
      name - name of the database
      parser - input parser
      ctx - database context
      options - main options
      mem - create main-memory instance
      Returns:
      new database instance
      Throws:
      IOException - I/O exception
    • 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