ULCreateDatabase function

Creates an UltraLite database.

Syntax
ul_bool ULCreateDatabase ( SQLCA * sqlca, 
 ul_char * connection-parms, 
 void const  * collation,
 ul_char * creation-parms,
 void * reserved
  );                                  
Parameters

sqlca   A pointer to the initialized SQLCA.

connection-parms   A semicolon separated string of connection parameters, which are set as keyword value pairs. The connection string must include the name of the database. These parameters are the same set of parameters that may be specified when you connect to a database. For a complete list, see UltraLite connection parameters reference.

collation  

The desired collation sequence for the database. You can get a collation sequence by calling the appropriate function. For example:

void const * collation = ULGetCollation_1250LATIN2(); 

The function name is constructed by prefixing the name of the desired collation with ULGetCollation_. For a list of all available collation functions see install-dir\SDK\Include\ulgetcoll.h. You must include this file in programs that call any of the ULGetCollation_ functions.

creation-parms  

A semicolon separated string of database creation parameters, which are set as keyword value pairs. For example:

page_size=2048;obfuscate=yes

For a complete list, see Choosing database creation parameters for UltraLite.

reserved   This parameter is reserved for future use.

Returns
  • ul_true   Indicates that database was successfully created.

  • ul_false   A detailed error message is defined by the SQLCODE field in the SQLCA. Typically this is caused by an invalid file name or access denial.

Remarks

The database is created with information provided in two sets of parameters:

  • The connection-parms are standard connection parameters that are applicable whenever the database is accessed (for example, file name, user id, password, optional encryption key, and so on).
  • The creation-parms are parameters that are only relevant when creating a database (for example, obfuscation, page-size, time and date format, and so one)

Applications can call this function after initializing the SQLCA.

Example

The following code illustrates using ULCreateDatabase to create an UltraLite database as the file C:\myfile.udb.

if( ULCreateDatabase(&sqlca 
    ,UL_TEXT("DBF=C:\myfile.udb;uid=DBA;pwd=sql")
    ,ULGetCollation_1250LATIN2() 
    ,UL_TEXT("obfuscate=1;page_size=8192")
    ,NULL)
  {
   // success
  };