OCCI 中文编程指南(17)
发布时间:2021-06-08
发布时间:2021-06-08
string password = "bill"; string connstring = "jftest"; string sql;
int i,numrows=5,isnum,ilnum,ipos=0; int isno[5],vsno[20],ii=0,x[20]; ub2 isnolen[5],snamelen[5];
char sname[5][20],vsname[20][20];
for (i=0;i<20;i++) {
isnolen[i]=sizeof(isno[i]);
snamelen[i]=strlen(sname[i]+1);
}
cout << "PROGRAM START ..." << endl; try {
env = Environment::createEnvironment();
conn = env->createConnection(username,password,connstring); stmt = conn->createStatement();
sql = " SELECT sno,sname FROM student "; stmt->setSQL(sql); rs = stmt->executeQuery(); rs->setDataBuffer(1,isno,OCCIINT,sizeof(int)); rs->setDataBuffer(2,sname,OCCI_SQLT_STR,sizeof(sname[0]),snamelen); ilnum = rs->getNumArrayRows(); cout << " ilnum = " << ilnum <<endl; while (rs->next(numrows)) { isnum = rs->getNumArrayRows(); cout << " isnum = " << isnum <<endl; for(i=0;i<numrows;i++) { vsno[ipos] = isno[i]; vsname[ipos] = sname[i]; ipos = ipos+1; } }
ilnum = rs->getNumArrayRows(); cout << " ilnum = " << ilnum <<endl;
上一篇:地理信息系统(gis)英语论文
下一篇:初中中学共青团团队工作计划,方案