Product Documentation

FairCom Direct SQL for C and C++

Previous Topic

Next Topic

Tutorial 2: Relational Model and Indexing

<faircomInstallFolder>\drivers\c.sql.direct\tutorials\DSQL_tutorial2.c

Here we will will perform the following:

  1. Create a database
  2. Create 4 tables each with an index
  3. Populate each table with a few records
  4. Build a query utilizing the advantage of indexes
  5. Output the results of the query

To keep this program as simple as possible, this program uses four standard procedures:

  • Initialize() - Connects to the FairCom Database Engine.
  • Define() - Defines and creates a "customer master" (custmast) table/file.
  • Manage() - Adds a few rows/records; Reads the rows/records back from the database; displays the column/field content; and then deletes the rows/records.
  • Done() - Disconnects from FairCom Database Engine.

Note our simple Main() function:/*

* main()

*

* The main() function implements the concept of "init, define, manage

* and you're done..."

*/

int main(int argc, char* argv[])

{

Initialize();

Define();

Manage();

Done();

printf("\nPress <ENTER> key to exit . . .\n");

getchar();

return(0);

}

We suggest opening the source code with your own editor.

Continue now to review these four steps.

In This Section

Init

Define

Manage

Done

TOCIndex