Visual Studio 6DBAWindows 2000Visual C++ 6.0Windows XPCIntermediateDevVisual StudioSQL ServerSQLWindowsC++
C++ wrapper for Oracle's OCI Interface






3.50/5 (2 votes)
Sep 28, 2002

130091

3743
This article will provide a cross platform C++ wrapper for Oracle's OCI interface.
Introduction
With this C++ wrapper, you can easily do the following:
- Connect/disconnect to an Oracle server;
- Execute SQL
select
/insert
/update
/delete
commands; - Store the query result in a simple linked list;
This project is a cross platform implementation.
class ObList ; class Record ; class RecordSet; int Connect(); int Connect(char *user, char *pass, char *service); void DisConnect(); int ExecCommand(char* cmdbuf);
Examples:
#include <stdio.h> #include "dbclient.h" int main(int argc, char* argv[]) { Connect(); printf("Connect OK.\n"); RecordSet set; set.Open("select * from EMP"); for(int k=0;k<set.GetRecordsCount();k++) { Record *pRec=set.GetRecord(k); for(int l=0;l<pRec->GetFieldsCount();l++) { printf("%s",pRec->GetFieldValue(l)); if(l==(pRec->GetFieldsCount()-1)) printf("\n"); else printf("\t"); } } DisConnect(); return 0; }
If you are interested in this article, and want to get details, contact me at lihaijian@sina.com or ema13@dongfang-china.com.