This is the first of the Getting Started samples, and probably where you should start when exploring EDMsdk. In this sample, we will show you haw to create your first EDMdatabase, create a user and a repository for containing your data. You will learn how to compile an EXPRESS schema into the EDMdatabase and to import a data set in an EDMmodel. Then you will learn how you can export the data set to a Part28 XML file. This sample also shows how you may do conditional selection of subsets of the data and print it out on the screen as well as to Part28 XML.
The complete package with resource files and source code is available from Getting Started, but you may also download the source code of the sample below.
In the following, we will walk you through all the statements and explain them.
Creating the EDMdatabase
When your application is a EDMstandaloneClient, you will create and operate on the EDMdatabase locally. The first you need to do is to create this database (unless you already have one on your file system). This sample assumes that there is already an EDMdatabase on your file system, created by your previous run, and that you will delete it first.
if (rstat = edmiDeleteDatabase (dbPath, dbName, dbPwd)) { if (rstat != edmiENOSUCHDATABASE) { printf("\nERROR: Failed to delete database with error '%s'", edmiGetErrorText(rstat)); goto err; } }
The EDMdatabase will consist of a great number of files, so make sure you create a separate folder for it.
if (rstat = edmiCreateDatabase (dbPath, dbName, dbPwd)) { printf("\nERROR: Failed to create database with error '%s'", edmiGetErrorText(rstat)); goto err; }
After creating the EDMdatabase, you will have typically 50 files in your database folder. Any standalone process can open and connect to this EDMdatabase once it is created, but only one process can open it at the time. If you need multiple client applications connect to the EDMdatabase simultaneously, you need an EDMserver and write your application as an EDMthinClient.
if (rstat = edmiOpenDatabase(dbPath, dbName, dbPwd)) { printf("\nERROR: Failed to open database with error '%s'", edmiGetErrorText(rstat)); goto err; }
The EDMdatabaseis now open and therefore uavailable to other EDMclient applications.