-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOCCI-proxy-test.cpp
35 lines (32 loc) · 1.1 KB
/
OCCI-proxy-test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include "OCCI-proxy.h"
using namespace occi_proxy;
int main(void) {
Environment * envr;
Connection * conn;
Statement * stmt;
ResultSet * rset;
try {
envr = Environment::createEnvironment(Environment::THREADED_MUTEXED);
printf("Got an environment: %p\n", envr);
conn = envr->createConnection("OE", "OE");
printf("Got a connection : %p\n", conn);
stmt = conn->createStatement("select * from user_objects where object_type = 'TABLE'");
printf("Got a statement : %p\n", stmt);
rset = stmt->executeQuery();
printf("Got a resultset : %p\n", rset);
int n = rset->next();
printf("rset->next() = %i\n", n);
if (n) {
std::string s = rset->getString(1);
printf("s = %s\n", s.c_str());
}
stmt->closeResultSet(rset);
conn->terminateStatement(stmt);
envr->terminateConnection(conn);
Environment::terminateEnvironment(envr);
} catch (SQLException e) {
printf("Got an exception: %s\n", e.what());
e.getMessage();
}
}