Line-by-line Anatomy of DB.c (Cont.)


DmCreateDatabase( 0, DBName, CreatorID, DBType, false )
This function Err DmCreateDatabase( UInt16 cardNo, const Char *nameP, UInt32 creator, UInt32 type, Boolean resDB ) creates a new database on the specified card with the given name, creator, and type. It returns errNone if no error, or one of the following if an error occurs:
  • dmErrInvalidDatabaseName
  • dmErrAlreadyExists
  • memErrCardNotPresent
  • dmErrMemError
  • memErrChunkLocked
  • memErrInvalidParam
  • memErrInvalidStoreHeader
  • memErrNotEnoughSpace
  • memErrRAMOnlyCard
Call this routine to create a new database on a specific card. Once created, the database ID can be retrieved by calling DmFindDatabase( ). The database can be opened using the database ID. After you create a database, it's recommended that you call DmSetDatabaseInfo( ) to set the version number. Databases default to version 0 if the version isn't explicitly set.

DmDatabaseInfo( dbCard, dbID, NULL, &attributes, NULL, ... );
This function Err DmDatabaseInfo( UInt16 cardNo, LocalID dbID, Char *nameP, UInt16 *attributesP, UInt16 *versionP, UInt32 *crDateP, UInt32 *modDateP, UInt32 *bckUpDateP, UInt32 *modNumP, LocalID *appInfoIDP, LocalID *sortInfoIDP, UInt32 *typeP, UInt32 *creatorP ) retrieves information about a database. It returns errNone if no error, or dmErrInvalidParam if an error occurs.