Dear Developers, first of all I'd like to thank for libdbi, I found it recently and this is something I need desperately...
When I tried to use it, however, I encountered a major problem which currently prevents me from using it. This is probably related to the firebird driver. Let me describe it in detail. The platform is Xubuntu Ibex Intrepid, running on a 32-bit Intel platform. Everything expect libdbi and its drivers are installed from packages, I have Firebird 2.0 (LI-V6.3.4.13130). The libdbi and libdbi-drivers (ver. 0.8.3) are installed from source as there was no firebird driver amongst the Ubuntu packages. I have mysql and firebird drivers installed. During installation the compilation of the html documentation produced a large amunt of errors, but after commenting out the related stuff from the makefiles, the libraries have compiled. The "make check" went through with no errors, however, the firedbird driver produced an output which you may find in the file "makecheckoutput.txt" attached to this mail. Till test 6 everything is fine, but then: ---------- Test 6: List tables: Got result, try to access rows *** glibc detected *** ./test_dbi: malloc(): memory corruption: 0x097c9f38 *** ---------- It appears that it is some memory allocation issue... Then I tried to compile a short example program according to the documentation, this is attacehed in "employee.c", using the standard example database provided with firebird. This lists the names properly, but there is a segmentation fault at the end. I have written a similar program with the database I'm using, and the segmentation fault appears already at the dbi_result_next_row(result) call inside the while statement. I tried to figure out the reason, but I found nothing related in the documentation. Serarching the www I found some blogs where this issue is mentioned, but no solution is provided. Hence I suspect that this might be a bug. I tried to hack the source code, but unfortunately I had no succes as my insight into the operation of libdbi is not deep enough. Could some of you maybe -correct this issue -or at least give me some hint why it is happenning? I would be extremely grateful since I need it very much. I'm also ready to do some efforts if needed, since the proper operation of libdbi would save me a huge amount of work. Also, if you need more information about the sofware and hardware setup, please do not hesitate to contact me. Best regards, Matyas Koniorczyk -- Dr. Matyas Koniorczyk http://rail.ttk.pte.hu/kmatyas
libdbi-drivers test program: $Id: test_dbi.c,v 1.46 2008/02/06 16:22:44 mhoenicka Exp $ Library version: libdbi v0.8.3 libdbi driver directory? [/usr/local/lib/dbd] 2 drivers available: mysql firebird test which driver? firebird database administrator name? SYSDBA database administrator password? masterkey database directory? [.] /var/databases database hostname? [(blank for local socket if possible)] localhost database name? [libdbitest] Driver information: ------------------- Name: firebird Filename: /usr/local/lib/dbd/libdbdfirebird.so Desc: Firebird/Interbase database support Maintainer: Christian M. Stamgren <c...@cention.se> URL: http://libdbi-drivers.sourceforge.net Version: dbd_firebird v0.8.3-1 Compiled: Mar 31 2009 Use CONNECT or CREATE DATABASE to specify a database CREATE DATABASE 'localhost:/var/databases/libdbitest'; Successfully connected! Using database engine version 2000531 (numeric) and 2.0.4.131 (string) Test 1: List databases: not yet implemented Test 2: Create database libdbitest using default encoding: This is a no-op with the sqlite/msql/firebird/ingres drivers. Test 3: Select database: Ok. Test 4: Get encoding: The database encoding appears to be: US-ASCII Test 5: Create table: libdbi: [query] CREATE TABLE test_datatypes ( the_char SMALLINT,the_uchar SMALLINT,the_short SMALLINT, the_ushort SMALLINT,the_long INTEGER,the_ulong INTEGER, the_float FLOAT,the_double DOUBLE PRECISION, the_driver_string VARCHAR(255),the_conn_quoted_string VARCHAR(255),the_conn_quoted_string_copy VARCHAR(255),the_conn_escaped_string VARCHAR(255),the_conn_escaped_string_copy VARCHAR(255),the_empty_string VARCHAR(255),the_null_string VARCHAR(255), the_binary_quoted_string BLOB,the_binary_escaped_string BLOB,the_datetime TIMESTAMP, the_date DATE,the_time TIME,id INTEGER NOT NULL PRIMARY KEY) Ok. Test 6: List tables: Got result, try to access rows *** glibc detected *** ./test_dbi: malloc(): memory corruption: 0x097c9f38 ***
#include <stdio.h> #include <dbi/dbi.h> 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/databases/employee.fdb"); 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("%s\n", fullname); } dbi_result_free(result); } dbi_conn_close(conn); } dbi_shutdown(); return 0; }
------------------------------------------------------------------------------
_______________________________________________ Libdbi-drivers-devel mailing list Libdbi-drivers-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel