2. Embedded SQL for C : C++ Programming : How to Create ESQL/C++ Programs : How Data is Declared
 
Share this page                  
How Data is Declared
ESQL/C++ supports C data types, including pointers and structures. To declare data in ESQL/C++ applications, use the data types and techniques described in C Variables and Data Types (see page C Variables and Data Types) in this chapter.
You cannot declare an entire class to ESQL/C++; however, you can declare the class members. For example:
Wrong:
exec sql begin declare section;
  class Employee {
  char *     name;     // Name
  char *  address;     // Address
  char *  title;      // Title 
  int     age;
  public:
       Employee();      // Constructor
       ~Employee();     // Destructor
       void operator=(const Employee&);     // Assignment
       void print();    // Print
       void select(char *);    // Select
};
exec sql end declare section;
Right:
class Employee {
exec sql begin declare section;
  char *     name;     // Name
  char *  address;     // Address
  char *  title;      // Title 
  int     age;
 exec sql end declare section;
 public:
     Employee();       // Constructor
     ~Employee();      // Destructor
     void operator=(const Employee&);     // Assignment
     void print();     // Print
     void select(char *);     // Select
};