dbCreate()

DBCREATE()

Creates an empty database from a array.

Syntax

      DBCREATE( <cDatabase>, <aStruct>, [<cDriver>], [<lOpen>],
                [<cAlias>] )

Arguments

<cDatabase> Name of database to be create

<aStruct> Name of a multidimensional array that contains the database structure

<cDriver> Name of the RDD

<lOpenNew> 3-way toggle to Open the file in New or Current workarea:

                       NIL     The file is not opened.
                       True    It is opened in a New area.
                       False   It is opened in the current area.

<cAlias> Name of database Alias

Description

This function creates the database file specified as <cDatabase> from the multidimensional array <aStruct>. If no file extension is use with <cDatabase> the .dbf extension is assumed. The array specified in <aStruct> must follow a few guidelines when being built prior to a call to DBCREATE():

– All subscripts values in the second dimension must be set to proper values

– The fourth subscript value in the second dimension – which contains the decimal value-must he specified. even 1kw nonnumeric fields.

– The second subscript value in the second dimension-which contains the field data type-must contain a proper value: C, D, L, M or N It is possible to use additional letters (or clarity (e.g., ‘Numeric’ for ‘N’): however, the first letter of this array element must be a proper value.

The DBCREATE( ) function does not use the decimal field to calculate the length of a character held longer than 256. Values up to the maximum length of a character field (which is 65, 519 bytes) are stored directly in the database in the length attribute if that database was created via this function. However, a file containing fields longer than 256 bytes is not compatible with any interpreter.

The <cDriver> parameter specifies the name of the Replaceable Database Driver to use to create the database. If it is not specified, then the Replaceable Database Driver in the current work area is used.

The <lOpenNew> parameter specifies if the already created database is to be opened, and where. If NIL, the file is not opened. If True, it is opened in a New area, and if False it is opened in the current area (closing any file already occupying that area). The <cAlias> parameter specifies the alias name for the new opened database.

Examples

      PROCEDURE Main()
         LOCAL nI, aStruct := { { "CHARACTER", "C", 25, 0 }, ;
                                { "NUMERIC",   "N",  8, 0 }, ;
                                { "DOUBLE",    "N",  8, 2 }, ;
                                { "DATE",      "D",  8, 0 }, ;
                                { "LOGICAL",   "L",  1, 0 }, ;
                                { "MEMO1",     "M", 10, 0 }, ;
                                { "MEMO2",     "M", 10, 0 } }

         REQUEST DBFCDX

         dbCreate( "testdbf", aStruct, "DBFCDX", .T., "MYALIAS" )

         RETURN

Compliance

This function is not CA-Cl*pper compliant

Files

Library is rdd Header is dbstruct.ch

Seealso

AFIELDS()*, DBSTRUCT()

Advertisements

3 responses to “dbCreate()

  1. Pingback: Harbour All Functions – D | Viva Clipper !

  2. Pingback: Harbour Database Functions | Viva Clipper !

  3. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s