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
|
#include <stdio.h>
#include </home/bluefrog/SQLAPI/include/SQLAPI.h>
int main(int argc, char* argv[]) {
SAConnection con;
SACommand cmd(&con, "select x, y from test1");
try {
//con.Connect("localhost,5432@ft_node", "bluefrog", "bluefrog", SA_PostgreSQL_Client);
//con.Connect("//localhost:1521/ftnode", "ordb", "ordb", SA_Oracle_Client);
con.Connect("localhost,2638@ftnode_sa", "sadb", "sadb", SA_SQLAnywhere_Client);
cmd.Execute();
while(cmd.FetchNext())
printf("Row : x = %ld, y = '%s'\n", cmd.Field("x").asLong(), (const char*)cmd.Field("y").asString());
}
catch(SAException &x) {
try {
con.Rollback();
}
catch(SAException &) { }
printf("%s\n", (const char*)x.ErrText());
}
return 0;
};
|