de.esprit.appsuite.database.dbase

## Class LocalDatabase

- java.lang.Object
- - de.esprit.appsuite.database.dbase.LocalDatabase

- All Implemented Interfaces:
    Database

      public class LocalDatabase
      extends java.lang.Object
      implements Database

  This class encapsulates the database access done by DBObjects and performs them on a local database connection.
  Author:
    Rainer Buesch
  See Also:
    `Database`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalDatabase()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `dbDelete(DBRecord... records)` Performs a database request that to delete the given record(s) from the database.
    `DBRecord` | `dbInsert(DBRecord record)` Inserts the record into the database.
    `DBRecord[]` | `dbInsertRecords(DBRecord... records)` Performs a database request to insert the given records into the database.
    `void` | `dbLoadRecords(DBRecord master, DBLoadMonitor monitor, SqlCondition condition)` Same as `Database.dbLoadRecords(DBRecord, DBLoadMonitor, SqlCondition)`.
    `void` | `dbLoadRecords(DBRecord master, DBLoadMonitor monitor, SqlCondition condition, SqlOrder order)` Performs a database request to load records of the given type with the given condition and order.
    `DBRecord` | `dbRehash(DBRecord record)` Performs a database request to rehash the given record.
    `DBRecord[]` | `dbRehashRecords(DBRecord... records)` Performs a database request that tries to rehash the given records.
    `DBRecord[]` | `dbSearchRecords(DBRecord master, SqlCondition condition, SqlOrder order)` Performs a database request to select `ComposedRecord` instances by a `SqlCondition` that may contain fields of different record parts (the composing DBObjects).
    `DBRecord` | `dbSelect(DBRecord master, java.lang.String... primaryKey)` Performs a database request to fetch a single record by primary key.
    `DBRecord[]` | `dbSelectRecords(DBRecord master, SqlCondition condition)` Same as `Database.dbSelectRecords(DBRecord, SqlCondition, SqlOrder)`.
    `DBRecord[]` | `dbSelectRecords(DBRecord master, SqlCondition condition, SqlOrder order)` Performs a database request to read records of the given type with the given condition and order.
    `DBObject` | `dbStore(DBObject record)` Performs a database request to store the given DBobject with its `DBObject.forceUpdate()` method.
    `DBObject[]` | `dbStoreRecords(DBObject... dbos)` Performs a database request to store the given records with their `DBObject.forceUpdate()` method.
    `void` | `dbUpdate(DBRecord... records)` Performs a database request to update the given record(s) in the database.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalDatabase

          public LocalDatabase()

  - ### Method Detail

    - #### dbSelect

          public DBRecord dbSelect(DBRecord master,
                          java.lang.String... primaryKey)
                            throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to fetch a single record by primary key.
      Specified by:
        `dbSelect` in interface `Database`
      Returns:
        The matching record, null if not found.
      Throws:
        `java.lang.Exception`

    - #### dbInsert

          public DBRecord dbInsert(DBRecord record)
                            throws java.lang.Exception

      Description copied from interface: `Database`
      Inserts the record into the database. Note that the inserted record may have got a primary key as well as default field values from the database
      Specified by:
        `dbInsert` in interface `Database`
      Returns:
        The inserted record, with dirty state reset to clean.
      Throws:
        `java.lang.Exception`
      See Also:
        `Database.dbInsertRecords(DBRecord[])`

    - #### dbInsertRecords

          public DBRecord[] dbInsertRecords(DBRecord... records)
                                     throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to insert the given records into the database. Note that the inserted records may have got a new primary key assigned and default field values may have been set by the database.
      Specified by:
        `dbInsertRecords` in interface `Database`
      Returns:
        An array of the inserted records, with dirty state reset to clean.
      Throws:
        `java.lang.Exception`

    - #### dbUpdate

          public void dbUpdate(DBRecord... records)
                        throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to update the given record(s) in the database.
      Specified by:
        `dbUpdate` in interface `Database`
      Throws:
        `java.lang.Exception`

    - #### dbDelete

          public void dbDelete(DBRecord... records)
                        throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request that to delete the given record(s) from the database. Note that not finding the record is not considered to be an error condition. In this case the record will just be set to dirty state.
      Specified by:
        `dbDelete` in interface `Database`
      Throws:
        `java.lang.Exception`

    - #### dbRehash

          public DBRecord dbRehash(DBRecord record)
                            throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to rehash the given record.
      Specified by:
        `dbRehash` in interface `Database`
      Returns:
        The rehashed record whereas its dirty state has been reset to clean..
      Throws:
        `java.lang.Exception`
      See Also:
        `Database.dbRehashRecords(DBRecord[])`

    - #### dbRehashRecords

          public DBRecord[] dbRehashRecords(DBRecord... records)
                                     throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request that tries to rehash the given records.
      Specified by:
        `dbRehashRecords` in interface `Database`
      Returns:
        The rehashed records whereas their dirty state has been reset to clean.
      Throws:
        `java.lang.Exception`

    - #### dbSelectRecords

          public DBRecord[] dbSelectRecords(DBRecord master,
                                   SqlCondition condition)
                                     throws java.lang.Exception

      Description copied from interface: `Database`
      Same as `Database.dbSelectRecords(DBRecord, SqlCondition, SqlOrder)`. The default order is by primary key.
      Specified by:
        `dbSelectRecords` in interface `Database`
      Returns:
        The matching records, an empty array if no records were found.
      Throws:
        `java.lang.Exception`

    - #### dbSelectRecords

          public DBRecord[] dbSelectRecords(DBRecord master,
                                   SqlCondition condition,
                                   SqlOrder order)
                                     throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to read records of the given type with the given condition and order. An empty array is returned if no records were found.
      Specified by:
        `dbSelectRecords` in interface `Database`
      Returns:
        The matching records, an empty array if no records were found.
      Throws:
        `java.lang.Exception`

    - #### dbLoadRecords

          public void dbLoadRecords(DBRecord master,
                           DBLoadMonitor monitor,
                           SqlCondition condition)
                             throws java.lang.Exception

      Description copied from interface: `Database`
      Same as `Database.dbLoadRecords(DBRecord, DBLoadMonitor, SqlCondition)`. The default order is by primary key.
      Specified by:
        `dbLoadRecords` in interface `Database`
      Throws:
        `java.lang.Exception`

    - #### dbLoadRecords

          public void dbLoadRecords(DBRecord master,
                           DBLoadMonitor monitor,
                           SqlCondition condition,
                           SqlOrder order)
                             throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to load records of the given type with the given condition and order. The `DBLoadMonitor` is responsible for collecting or processing the records.
      Specified by:
        `dbLoadRecords` in interface `Database`
      Throws:
        `java.lang.Exception`

    - #### dbSearchRecords

          public DBRecord[] dbSearchRecords(DBRecord master,
                                   SqlCondition condition,
                                   SqlOrder order)
                                     throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to select `ComposedRecord` instances by a `SqlCondition` that may contain fields of different record parts (the composing DBObjects). The statement typically performs a join on several tables. Note that classes with composed primary keys are not supported yet.
      Specified by:
        `dbSearchRecords` in interface `Database`
      Returns:
        The matching composed records, an empty array if none were found.
      Throws:
        `java.lang.Exception`

    - #### dbStore

          public DBObject dbStore(DBObject record)
                           throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to store the given DBobject with its `DBObject.forceUpdate()` method. If the record exists already it will be updated, otherwise it will be inserted.
      Specified by:
        `dbStore` in interface `Database`
      Returns:
        The stored record.
      Throws:
        `java.lang.Exception`
      See Also:
        `Database.dbStoreRecords(DBObject[])`

    - #### dbStoreRecords

          public DBObject[] dbStoreRecords(DBObject... dbos)
                                    throws java.lang.Exception

      Description copied from interface: `Database`
      Performs a database request to store the given records with their `DBObject.forceUpdate()` method. If the records exist already they will be updated, otherwise they will be inserted. Note that this only works on DBObjects and not on composed records.
      Specified by:
        `dbStoreRecords` in interface `Database`
      Returns:
        The stored DBObjects.
      Throws:
        `java.lang.Exception`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.