| ORAC++ : A C++ Class Library For Oracle on Linux | |||||||
| ORAC++ is a Linux C++ class shared library for Oracle 8i. As an interface to Oracle OCI, it simplifies design of C++ programs to select, insert, update or delete records, create and query joins, execute stored procedures and functions. It supports array bind and fetch, LOB data types, nested tables, embedded objects, stored collections and set operators like union, intersect and minus. Any user entered sql statement also can be processed and executed. Auto-formatting provides standarized output from queries allowing to minimize program size. Selected records can be stored in memory tables. | |||||||
| Example of a C++ program for a single table query using ORAC++ (with auto-formatted output): | |||||||
| #include <orac++.h> int main() { ��� TInt id, type;����������������������������������������������� // create data-type objects ��� TFloat price; ��� TStr desc; ��� Connect c;���������������������������������������������������� // use default connection ��� try { �������� Database d = c.OpenDatabase("demo;", "demo"); �������� Table t = d.GetTable("products"); �������� Select s(t);������������������������������������������������ // select * from products �������� s >> t["prod_id"] == 100001;������������������// where prod_id = 100001 �������� �������� cout� << " display as line" <<endl; // use default display - line �������� while (s.Row()) { �������������� cout� << s; // display as line �������������� s<< id << desc << price << type; // and load data objects ������� } �������� cout << "display as record" << endl; ���������s.AsRecord();���������������������������������������� �// set record display �������� while (s.Row())������������������������������������� // repeat records fetch ��������������� cout�<< s; //� display as record �������� ��� cout << "display loaded variables" << endl; cout << id��<< " - " << desc lt;< " - " << " - " << price << " - " << << type << endl; �������� d.Close();������������������������������������������������� // close database ���� } ���� catch (OException e) { ��������� cerr << e << endl; ����������������� // display error message �� � } ����� catch (...)� { ��������� cerr << "Error..."�<< endl; ��� } ���� return 0;�������������������������������������������������������������������������� � next page } |
|||||||
Output� from the program, when using test database, is: ��� display as line ��� PROD_ID� PROD_DESC�������������PROD_PRICE�� PROD_TYPE 100001 BOOKSHELF 108.5 3 display as record ���������������������������� PROD_ID : 100001 ��������������������� PROD_DESC : BOOKSHELF �������������������� PROD_PRICE : 108.5 ���������������������� PROD_TYPE : 3 ���� display loaded variables ��� 100001 -� BOOKSHELF - 108.5 - 3 |
|||||||
| Downloads:� library for Red Hat 8.0 (128K), documentation - in html format (43K),�� in Word format - with programming examples (160K).� (last updated: Apr 2, 2004) ���Version 4.0�������������������������������������������������������������������������������������������������������To send me e-mail ������������������������������������������� �� |
|||||||
| �������������������������������������������������������Copyright 2001-2004 Mark Polakowski �Permission is hereby granted, free of charge to copy and redistribute� this software� and associated� documentation as long as above copyright notice is included in all copies. |
|||||||