logo

const class

haven::HavenService

sys::Obj
  sys::Thread
    sql::SqlService
      haven::HavenService

HavenService provides a CRUD interface for managing persistence of objects in a relational database.

See docLib::Haven.

Slots

create

Uri create(Obj obj)

Add the specified object to the database.

Source

createTable

Void createTable(Type type)

Create a table for the specified type.

Source

delete

Bool delete(Obj obj)

Delete the specified object from the database.

Source

deleteAll

Void deleteAll(Type objType)

Delete all objects of the specified type.

Source

deleteById

Bool deleteById(Type objType, Obj id)

Delete the object with the specified id.

Source

deleteTable

Void deleteTable(Type type)

Delete the table for the specified type.

Source

havenLog

static Log havenLog := Log.get("haven")

Standard log for haven service

Source

indexName

Str indexName(Type type, Str indexName)

Get the full name for the specified index on the specified type.

Source

listObjs

Obj[] listObjs(Type objType)

List all objects of the specified type.

Source

make

new make(Str threadName := null, Str connection := "", Str username := "", Str password := "", Dialect dialect := null)

Make a new instance that uses the specified database for persistence.

  • threadName is the unique name used to identify the thread.
  • connection is the connection string. For java this is the jdbc url. For .Net this is the connection string.
  • username is the username for the database login.
  • password is the password for the database login.
  • dialect is the database specific dialect implementation.

Source

makeColumn

virtual ColDef makeColumn(Field field)

Make a column for the specified field. This method examines the field type and invokes the appropriate type specific factory.

Source

ns

const HavenNamespace ns

The namespace for the objects managed by this instance.

Source

process

Obj process(Str:TableDef tables, Obj msg)

Source

read

Obj read(Type objType, Obj id)

Read an object from the database by its id.

Source

run

override protected Obj run()

The run method implements the code to run in the thread. If a run function was specified in the constructor, then it is invoked, otherwise subclasses should override this method. Threads which wish to process their message queue must enter the main loop by calling the loop() method. The return value of this method is available to the first thread which calls the join method (the result is not required to be immutable).

Source

tableName

Str tableName(Type type)

Get the table name for the specified type.

Source

trimIndexName

Str trimIndexName(Str indexName)

If the specified index name exceeds the maximum length for an index name in the database, mangle and trim to fit.

Source

trimTableName

Str trimTableName(Str tableName)

If the specified table name exceeds the maximum length for a table name in the database, mangle and trim to fit.

Source

typeTableExists

Bool typeTableExists(Type objType)

Does a table exist for the specified type?

Source

update

Void update(Obj obj)

Update the specified object in the database.

Source