home *** CD-ROM | disk | FTP | other *** search
- #ifdef COMP_BCB
- // BORLAND C++ BUILDER INCLUDES
- #include <condefs.h>
- #else
- #define USELIB( arg )
- #endif
-
-
- //---------------------------------------------------------------------------
- // CUSTOM DATABASE HEADER
- #include "business.h"
- //---------------------------------------------------------------------------
- #include <stdio.h>
- //---------------------------------------------------------------------------
- // BORLAND C++ BUILDER DIRECTIVES
- USELIB("..\..\..\lib\win32\bcb\ojust.lib");
- //---------------------------------------------------------------------------
- int main(int argc, char* argv[])
- {
- // START TRY/CATCH BLOCK FOR EXCEPTIONS CATCHING
- try
- {
- d_Database db;
- d_Transaction tx;
-
- // OPEN DATABASE
- db.open( "database/business" );
-
- // START TRANSACTION
- tx.begin();
-
- d_Extent<Customer> customers( &db );
-
- cout << "Total objects in <Customer> class are: ";
-
- if( argc == 1 )
- cout << customers.cardinality() << endl;
- else
- cout << customers.count( argv[1] ) << endl;
-
- // COMMIT TRANSACTION
- tx.commit();
- }
- catch( d_Error &e )
- {
- // DATABASE ERROR
- cout << "Database error: " << e.what() << endl;
- }
- catch( ... )
- {
- // APPLICATION ERROR
- cout << "Generic error" << endl;
- }
-
- return 0;
- }
-
-
-