Class DbState

  • All Implemented Interfaces:
    DbInterface

    public class DbState
    extends java.lang.Object
    implements DbInterface
    Represents a connection to a simulated database.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void commit()
      Commit a pending transaction.
      void connect()
      Connect to the database.
      void createIndex​(Index index)
      Create an index.
      void createTable​(org.h2.test.synth.sql.Table table)
      Create the specified table.
      org.h2.test.synth.sql.Result delete​(org.h2.test.synth.sql.Table table, java.lang.String condition)
      Delete a number of rows.
      void disconnect()
      Disconnect from the database.
      void dropIndex​(Index index)
      Drop an index.
      void dropTable​(org.h2.test.synth.sql.Table table)
      Drop the specified table.
      void end()
      Close the connection and the database.
      org.h2.test.synth.sql.Result insert​(org.h2.test.synth.sql.Table table, org.h2.test.synth.sql.Column[] c, Value[] v)
      Insert a row into a table.
      void reset()
      Drop all objects in the database.
      void rollback()
      Roll back a pending transaction.
      org.h2.test.synth.sql.Result select​(java.lang.String sql)
      Execute a query.
      void setAutoCommit​(boolean b)
      Enable or disable autocommit.
      java.lang.String toString()  
      org.h2.test.synth.sql.Result update​(org.h2.test.synth.sql.Table table, org.h2.test.synth.sql.Column[] columns, Value[] values, java.lang.String condition)
      Update the given table with the new values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • reset

        public void reset()
        Description copied from interface: DbInterface
        Drop all objects in the database.
        Specified by:
        reset in interface DbInterface
      • connect

        public void connect()
        Description copied from interface: DbInterface
        Connect to the database.
        Specified by:
        connect in interface DbInterface
      • disconnect

        public void disconnect()
        Description copied from interface: DbInterface
        Disconnect from the database.
        Specified by:
        disconnect in interface DbInterface
      • createTable

        public void createTable​(org.h2.test.synth.sql.Table table)
        Description copied from interface: DbInterface
        Create the specified table.
        Specified by:
        createTable in interface DbInterface
        Parameters:
        table - the table to create
      • dropTable

        public void dropTable​(org.h2.test.synth.sql.Table table)
        Description copied from interface: DbInterface
        Drop the specified table.
        Specified by:
        dropTable in interface DbInterface
        Parameters:
        table - the table to drop
      • createIndex

        public void createIndex​(Index index)
        Description copied from interface: DbInterface
        Create an index.
        Specified by:
        createIndex in interface DbInterface
        Parameters:
        index - the index to create
      • dropIndex

        public void dropIndex​(Index index)
        Description copied from interface: DbInterface
        Drop an index.
        Specified by:
        dropIndex in interface DbInterface
        Parameters:
        index - the index to drop
      • insert

        public org.h2.test.synth.sql.Result insert​(org.h2.test.synth.sql.Table table,
                                                   org.h2.test.synth.sql.Column[] c,
                                                   Value[] v)
        Description copied from interface: DbInterface
        Insert a row into a table.
        Specified by:
        insert in interface DbInterface
        Parameters:
        table - the table
        c - the column list
        v - the values
        Returns:
        the result
      • select

        public org.h2.test.synth.sql.Result select​(java.lang.String sql)
        Description copied from interface: DbInterface
        Execute a query.
        Specified by:
        select in interface DbInterface
        Parameters:
        sql - the SQL statement
        Returns:
        the result
      • delete

        public org.h2.test.synth.sql.Result delete​(org.h2.test.synth.sql.Table table,
                                                   java.lang.String condition)
        Description copied from interface: DbInterface
        Delete a number of rows.
        Specified by:
        delete in interface DbInterface
        Parameters:
        table - the table
        condition - the condition
        Returns:
        the result
      • update

        public org.h2.test.synth.sql.Result update​(org.h2.test.synth.sql.Table table,
                                                   org.h2.test.synth.sql.Column[] columns,
                                                   Value[] values,
                                                   java.lang.String condition)
        Description copied from interface: DbInterface
        Update the given table with the new values.
        Specified by:
        update in interface DbInterface
        Parameters:
        table - the table
        columns - the columns to update
        values - the new values
        condition - the condition
        Returns:
        the result of the update
      • setAutoCommit

        public void setAutoCommit​(boolean b)
        Description copied from interface: DbInterface
        Enable or disable autocommit.
        Specified by:
        setAutoCommit in interface DbInterface
        Parameters:
        b - the new value
      • commit

        public void commit()
        Description copied from interface: DbInterface
        Commit a pending transaction.
        Specified by:
        commit in interface DbInterface
      • rollback

        public void rollback()
        Description copied from interface: DbInterface
        Roll back a pending transaction.
        Specified by:
        rollback in interface DbInterface
      • end

        public void end()
        Description copied from interface: DbInterface
        Close the connection and the database.
        Specified by:
        end in interface DbInterface
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object