PvCreateDatabase()
Creates a database by adding an entry to dbnames.cfg file. This entry is later used to create DSNs.
Header File: catalog.h (See also Header Files)
Function First Available In Library: w3dbav75.dll (Windows), libpsqldti.so (Linux), libpsqldti.dylib (OS X) (See also Link Libraries)
Syntax
BTI_API PvCreateDatabase(
   BTI_LONG           hConnection,
   BTI_CHAR_PTR       dbName,
   BTI_CHAR_PTR       dictPath,
   BTI_CHAR_PTR       dataPath,
   BTI_ULONG          dbFlags);
Arguments
 
Return Values
 
Remarks
The following preconditions must be met:
Connection established by PvConnectServer() or if you are performing the operation on a local machine, P_LOCAL_DB_CONNECTION may be used as the connection handle.
Btrieve Security Policy
The following table indicates how to specify a security model in a new database, or to interpret the security model of an existing database. Using any other combination of flags for security will result in status code 7024.
Metadata Version
If you specify P_DBFLAG_LONGMETADATA, the database property in dbnames.cfg is set to V2 metadata. If you specify P_DBFLAG_LONGMETADATA and P_DBFLAG_CREATE_DDF, the DDFs created are also V2 metadata.
The result of DDF creation varies depending on the DDF versions that already exist in the dictionary location.
For example, suppose that your dictionary location contains V1 metadata DDFs and you create V2 metadata DDFs. The dictionary location will then contain a combination of V1 metadata DDFs and V2 metadata DDFs. A particular database can use one set of DDFs or the other, but not both concurrently.
Example
The following example creates a database and DDFs that uses V2 metadata.
BTI_LONG connectionHandle = P_LOCAL_DB_CONNECTION;
BTI_CHAR_PTR dataPath = “c:\\data\\gallery”;
BTI_CHAR_PTR dictPath = “c:\\data\\gallery”;
BTI_CHAR_PTR databaseName = “Gallery”;
BTI_SINT status = 0;
BTI_CHAR_PTR server = “MyServer”;
BTI_CHAR_PTR user = “Administrator”;
BTI_CHAR_PTR pwd = “Admin”;
//only need to connect to server if it is remote
//otherwise can pass P_LOCAL_DB_CONNECTION for the handle
 
status = PvCreateDatabase(
connectionHandle,
databaseName,
dictPath,
dataPath,
P_DBFLAG_CREATE_DDF,
P_DBFLAG_LONGMETADATA);
See Also
PvStart()
PvConnectServer()
PvGetDbFlags()
PvModifyDatabase()
PvDropDatabase()
PvDisconnect()
PvStop()