Re: OpenIngres API
Posted in 1997
GODS <gods@sky.net> wrote in article <34A20002.50F0@sky.net>... > Has anyone done any Visual C++ / OpenIngres API examples besides what > comes with the demo cd? > Yes (by the way some of their examples do not even compile correctly !!!). The OpenIngres API is handful (as most database API tend to be), there are some benefits versus ODBC and EMBEDDED SQL. Also like APIs it is designed for C development therefore if you want nice object-oriented code, you have to do it yourself. Personally, I have seen and used better APIs, one thing that annoys my about OpenIngres API is that the first SQL statement generates the transaction ID, therefore you need to be carefull about comparing against NULL, since a NULL transaction ID is acceptable in certain contexts. Also the you have to juggle with the use of VARIABLE length data (Ingres reserves the first two bytes for the length of the data), therefore you cannot simply pass the address of where you want the data to reside, you have to allocate a temporary variable, and copy n bytes (using the size value inside the first two bytes) from the temporary variable with an offset of two bytes into your destination address. With LONG datatypes this becomes even more complex by retrieve the data until everything has been read (however to be fair to OI API, so does ODBC and most other APIs handles LONG datatypes in complex manners). In conclusion, use API if you really need to mostly for performance gains, and multi-platform environments, less dependency on ODBC vendors, and sometimes there are some API operations that are almost impossible with E/SQL and ODBC, such as backup & restoring a database, two-phase commits, restarting a transaction, etc...