DB Management
Table of Contents

Navigation, creation and deletion of databases and tables


  • proc close_db( sequence db_name )   
  • func create_db( sequence db_name )   
  • func create_field( sequence db_name, sequence table_name, sequence field_name, integer datatype, integer build_index )   
  • func create_index( sequence db_name, sequence table_name, sequence ix_name, sequence field, integer unique )   
  • func create_table( sequence db_name, sequence table_name )   
  • func drop_field( sequence db_name, sequence table_name, sequence field_name, integer break_on_error )   
  • func drop_index( sequence db_name, sequence index_name )   
  • func drop_table( sequence db_name, sequence table_name )   
  • proc eusql_exclusive( integer flag )   
  • func open_db( sequence db_name )   
  • func reindex(sequence db_name, sequence table_name, sequence ix_name)   
  • func reindex_table( sequence db_name, sequence table_name )   
  • func rename_field( sequence db_name, sequence table_name, sequence old_name, sequence new_name )   
  • func rename_table( sequence db_name, sequence table_name, sequence new_name )   
  • func select_current( sequence db_name, sequence table_name )   
  • func select_db( sequence db )   
  • func select_table( sequence table )     
     
    Subtopics:
  • Datatypes

    DB Management
    Table of Contents

    [proc]
    close_db
    ( sequence db_name )

    Category: DB Management

    Closes the specified database.

    See Also: create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    create_db
    ( sequence db_name )

    Category: DB Management

    Creates a EuSQL database, including TABLEDEF and INDEXDEF tables.

    See Also: close_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    create_field
    ( sequence db_name, sequence table_name, sequence field_name, integer datatype, integer build_index )

    Category: DB Management

    You do not have to create a field before you can create a subfield. EuSQL will automatically create a parent field for a subfield if it doesn't exist.

    Valid datatypes:

    Atoms, integers objects and sequences are the same as the standard Eu definitions. Text is just a one dimensional sequence filled with integers in range 0-255. The binary datatype is a one dimensional sequence filled with bytes.

    build_index should be 1 if you wish to create an index (you cannot create an index for the primary key, although you can for subfields of a primary key), or 0 if not.

    See Also: close_db, create_db, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    create_index
    ( sequence db_name, sequence table_name, sequence ix_name, sequence field, integer unique )

    Category: DB Management

    Creates an index (stored in INDEXDEF) on a field in a table. Each index must have a unique name (ix_name). It is recommended that you create an index on any field that is likely to be used as a foreign key, as this will speed up queries. The primary key itself may not be indexed, however, subfields of the primary key may be indexed.

    See Also: close_db, create_db, create_field, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    create_table
    ( sequence db_name, sequence table_name )

    Category: DB Management

    Creates a table and generates an entry in TABLEDEF.

    See Also: close_db, create_db, create_field, create_index, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    drop_field
    ( sequence db_name, sequence table_name, sequence field_name, integer break_on_error )

    Category: DB Management

    Deletes a field and any index associated with the field. If you delete the primary key, then the next field in the record will become the primary key. If the key changes (by dropping the primary key or a subfield of the primary key), some keys may not be unique. If you do not want to lose any data, set break_on_error to 0, and the table will not be changed.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    drop_index
    ( sequence db_name, sequence index_name )

    Category: DB Management

    Deletes an index and cleans up system tables.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    drop_table
    ( sequence db_name, sequence table_name )

    Category: DB Management

    Deletes a table and cleans up system tables to remove dropped table.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [proc]
    eusql_exclusive
    ( integer flag )

    Category: DB Management

    Sets the mode with which EuSQL will open databases. Valid values are:

    See the database.e documentation that comes with Euphoria for more details on using the different modes.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    open_db
    ( sequence db_name )

    Category: DB Management

    Opens a EuSQL database. The default is to open the database with the EDS flag DB_LOCK_EXCLUSIVE. To open databases with DB_LOCK_NO, use eusql_exclusive().

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, reindex, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    reindex
    (sequence db_name, sequence table_name, sequence ix_name)

    Category: DB Management

    Rebuilds the specified index.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex_table, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    reindex_table
    ( sequence db_name, sequence table_name )

    Category: DB Management

    Rebuilds all indices for the specified table.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, rename_field, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    rename_field
    ( sequence db_name, sequence table_name, sequence old_name, sequence new_name )

    Category: DB Management

    Rename a field.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_table, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    rename_table
    ( sequence db_name, sequence table_name, sequence new_name )

    Category: DB Management

    Renames the table table_name to new_name and updates TABLEDEF and INDEXDEF with the new name.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, select_current, select_db, select_table


    DB Management
    Table of Contents

    [func]
    select_current
    ( sequence db_name, sequence table_name )

    Category: DB Management

    Change the current database and table. An empty sequence for either parameter will use the current setting.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_db, select_table


    DB Management
    Table of Contents

    [func]
    select_db
    ( sequence db )

    Category: DB Management

    Change the current database.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_table


    DB Management
    Table of Contents

    [func]
    select_table
    ( sequence table )

    Category: DB Management

    Change the current table.

    See Also: close_db, create_db, create_field, create_index, create_table, drop_field, drop_index, drop_table, eusql_exclusive, open_db, reindex, reindex_table, rename_field, rename_table, select_current, select_db