Introduction
With this C++ wrapper, you can easily do the following:
- Connect/disconnect to a Sybase 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("sybase11","sa","");
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.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here