Skip to content

LexDbFunctions

BenjaminWaldron edited this page May 17, 2005 · 14 revisions

The LexDB uses a PostgreSQL database to provide a source of lexical items for client applications such as the LKB. This page provides a description of the internal (but "public") database functions used by a client connected to the LexDB. See also LexDbInternals for some documentation on the structure of the database itself.

  • check_psql_server_version RETURNS SETOF text Returns nothing if psql server version is compatible with the LexDB. Else returns message text.

  • clear_rev() RETURNS boolean

    Empty rev and rev_key tables. Register updated modstamp.

    Returns t.

  • commit_rev(user text) RETURNS boolean

    Call as user lexdb.

    Update public schema with contents of rev and rev_key. Register updated modstamp.

    Does NOT empty contents of rev and rev_key. Call clear_rev() as standard user to do this.

    Returns t.

  • complete(field text, val text) RETURNS SETOF text

    Returns possible completions of val amongst values taken by field in table lex.

  • current_timestamp() RETURNS text Returns current timestamp.

  • db_owner() RETURNS text

    Returns name of database owner (default lexdb).

  • dump_public_rev_rev_key_to_tmp_tmp_key() RETURNS boolean

    Places sorted copy of rev table in tmp. Places sorted copy of rev_key in tmp_key. These tables may then be accessed by the client (and placed in a file on client's local filesystem).

    Returns t.

  • filter() RETURNS text

    Returns filter of user (stored in meta table).

  • initialize_user_schema() RETURNS boolean

    Creates and initializes private schema for user. Registers schema in public.meta.

    Returns t if a new schema is created. If the schema already exists, or is the user is the database owner (lexdb), returns f.

  • lex_id_set() RETURNS SETOF text

    Returns set of name field values in lex table.

  • lexdb_version() RETURNS text

    Returns lexdb_version from meta table.

  • list_fld() RETURNS SETOF text

    Returns (ordered) field names for rev tables.

lookup_general('''field''' text,'''val''' text) RETURNS SETOF text

Returns set of name for records in which field has value val.

lookup_general_null(text) RETURNS SETOF text

Returns set of name for records in which field is null.

merge_dfn_from_tmp_dfn() RETURNS integer

Call as database owner.Tables tmp_dfn must contain dfn entries to be merged.

Returns number of new entries.

merge_public_rev_rev_key_from_tmp_tmp_key() RETURNS integer

Call as database owner. Tables tmp and tmp_key must contain rev and rev_key entries to be merged.

Updates rev/rev_key tables to include all entries in tmp/tmp_key fields. Register updated modstamp.

Returns number of new entries.

register_modstamp() RETURNS text

Updates modstamp.

Returns current timestamp.

retrieve_all_entries() RETURNS SETOF rev

Returns contents of lex.

retrieve_entries_by_orthkey('''key''' text) RETURNS SETOF rev

Returns entries in lex for with corresponding key in table rev_key.

retrieve_entry('''name''' text)

Returns entries in lex matching name.

rev() RETURNS SETOF rev

Returns contents of rev table.

semi_extra() RETURNS SETOF semi_extra

semi_frame() RETURNS SETOF semi_frame

semi_pred() RETURNS SETOF semi_pred

semi_var() RETURNS SETOF semi_var

Returns contents of corresponding table.

return_field_info('''schema''' text,'''table''' text) RETURNS SETOF attname_typename_atttypmod

Returns psql database internal field definitions for schema.table.

rev_key_p() RETURNS boolean

Returns f if rev_key is empty.

rev_new() RETURNS SETOF rev

Returns contents of rev_new table. This table is populated with new entries merged on calling the function merge_public_rev_rev_key_from_tmp_tmp_key().

semi_out_of_date() RETURNS SETOF rev

Returns set of entries in lex for which entries in the semi_... tables are either stale or do not exist.

semi_setup_pre() RETURNS boolean

semi_setup_post() RETURNS boolean

Set up the semi_... tables.

semi_up_to_date_p() RETURNS boolean

Returns t if all entries in the semi_... tables are up to date.

Clone this wiki locally