The mi_dbcreate() function

The mi_dbcreate() function creates a new database on the given connection.

Syntax

mi_integer mi_dbcreate(conn, db_info, dbspace, create_flag)
   MI_CONNECTION *conn;
   const MI_DATABASE_INFO *db_info;
   const char *dbspace;
   MI_DBCREATE_FLAGS create_flag;
conn
A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect(). The connection must not be an open (logged-in) connection.

The conn value specifies the database server on which to create the database. A NULL-valued pointer specifies the default database server.

db_info
This value describes the new database.
dbspace
The storage location for the new database. A NULL value specifies the root dbspace.
create_flag
This value is one of the following options:
MI_DBCREATE_DEFAULT
Creates the database without logging.
MI_DBCREATE_LOG
Creates the database with a log.
MI_DBCREATE_LOG_BUFFERED
Creates the database with a buffered log.
MI_DBCREATE_LOG_ANSI
Creates the database with ANSI log mode.
Valid in client LIBMI application? Valid in user-defined routine?
Yes No

Usage

This call is equivalent to the SQL CREATE DATABASE statement. Part of the argument dbinfo specifies the database name.

On entry, there must be no logged-in database active on the given connection.

For additional information about the MI_DATABASE_INFO structure, see the description of the mi_get_database_info() function.

Return values

MI_OK
The function was successful; the new database exists.
MI_ERROR
The function was not successful. An exception was raised, and the database was not created.