I have installed libdbi and libdbi-driver for firebird
http://mapopa.blogspot.com/
Here is the example i try to test for firebird
http://libdbi.sourceforge.net/
gedit employee.c
#include
#include
int main() {
dbi_conn conn;
dbi_result result;
double threshold = 4.333333;
unsigned int idnumber;
const char *fullname;
dbi_initialize(NULL);
conn = dbi_conn_new("firebird");
dbi_conn_set_option(conn, "host", "localhost");
dbi_conn_set_option(conn, "username", "SYSDBA");
dbi_conn_set_option(conn, "password", "masterkey");
dbi_conn_set_option(conn, "dbname",
"/var/lib/firebird/2.1/data/
dbi_conn_set_option(conn, "encoding", "UTF-8");
if (dbi_conn_connect(conn) < 0) {
printf("Could not connect. Please check the option settings\n");
}
else {
result = dbi_conn_queryf(conn, "SELECT EMP_NO, FIRST_NAME FROM EMPLOYEE");
if (result) {
while (dbi_result_next_row(result)) {
idnumber = dbi_result_get_uint(result, "ENP_NO");
fullname = dbi_result_get_string(result, "FIRST_NAME");
printf("%i. %s\n", idnumber, fullname);
}
dbi_result_free(result);
}
dbi_conn_close(conn);
}
dbi_shutdown();
return 0;
}
gcc -lm -ldl -ldbi employee.c
for the moment it crashes
No comments:
Post a Comment