Thread: [Refdb-cvs] CVS: refdb/src dbfncs.c,1.15,1.15.2.1
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2004-11-14 15:53:12
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23157/src Modified Files: Tag: Release_0_9_5_stable dbfncs.c Log Message: moved ID columns to BIGINT for MySQL Index: dbfncs.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/dbfncs.c,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -U2 -r1.15 -r1.15.2.1 --- dbfncs.c 29 Jan 2004 01:42:11 -0000 1.15 +++ dbfncs.c 14 Nov 2004 15:53:03 -0000 1.15.2.1 @@ -154,5 +154,5 @@ dbires = dbi_conn_query(conn, "CREATE TABLE t_refdb \ - (refdb_id INT NOT NULL AUTO_INCREMENT, \ + (refdb_id BIGINT NOT NULL AUTO_INCREMENT, \ refdb_citekey VARCHAR(255), \ refdb_type VARCHAR(6), \ @@ -201,5 +201,5 @@ /* create the author table */ dbires = dbi_conn_query(conn, "CREATE TABLE t_author \ - (author_id INT NOT NULL AUTO_INCREMENT, \ + (author_id BIGINT NOT NULL AUTO_INCREMENT, \ author_name VARCHAR(255) NOT NULL, \ author_lastname VARCHAR(255), \ @@ -220,5 +220,5 @@ /* create the keyword table */ dbires = dbi_conn_query(conn, "CREATE TABLE t_keyword \ - (keyword_id INT NOT NULL AUTO_INCREMENT, \ + (keyword_id BIGINT NOT NULL AUTO_INCREMENT, \ keyword_name VARCHAR(255) NOT NULL, \ PRIMARY KEY (keyword_id), \ @@ -235,5 +235,5 @@ /* create the periodical table */ dbires = dbi_conn_query(conn, "CREATE TABLE t_periodical \ - (periodical_id INT NOT NULL AUTO_INCREMENT, \ + (periodical_id BIGINT NOT NULL AUTO_INCREMENT, \ periodical_name VARCHAR(255) NOT NULL, \ periodical_abbrev VARCHAR(255) NOT NULL, \ @@ -256,5 +256,5 @@ /* create the notes table */ dbires = dbi_conn_query(conn, "CREATE TABLE t_note \ - (note_id INT NOT NULL AUTO_INCREMENT, \ + (note_id BIGINT NOT NULL AUTO_INCREMENT, \ note_key VARCHAR(255), \ note_title VARCHAR(255), \ @@ -281,5 +281,5 @@ /* the user_name length limit is imposed by MySQL, don't know about PostgreSQL */ dbires = dbi_conn_query(conn, "CREATE TABLE t_user \ - (user_id INT NOT NULL AUTO_INCREMENT, \ + (user_id BIGINT NOT NULL AUTO_INCREMENT, \ user_name VARCHAR(16) NOT NULL, \ PRIMARY KEY (user_id), \ @@ -296,7 +296,7 @@ /* create the author xtable */ dbires = dbi_conn_query(conn, "CREATE TABLE t_xauthor \ - (xauthor_id INT NOT NULL AUTO_INCREMENT, \ - author_id INT NOT NULL, \ - refdb_id INT NOT NULL, \ + (xauthor_id BIGINT NOT NULL AUTO_INCREMENT, \ + author_id BIGINT NOT NULL, \ + refdb_id BIGINT NOT NULL, \ xauthor_type ENUM('primary', 'secondary', 'tertiary'), \ xauthor_role VARCHAR(64), \ @@ -316,7 +316,7 @@ /* create the keyword xtable */ dbires = dbi_conn_query(conn, "CREATE TABLE t_xkeyword \ - (xkeyword_id INT NOT NULL AUTO_INCREMENT, \ - keyword_id INT NOT NULL, \ - xref_id INT NOT NULL, \ + (xkeyword_id BIGINT NOT NULL AUTO_INCREMENT, \ + keyword_id BIGINT NOT NULL, \ + xref_id BIGINT NOT NULL, \ xkeyword_type ENUM(\"REFERENCE\",\"NOTE\"), \ PRIMARY KEY (xkeyword_id), \ @@ -334,7 +334,7 @@ /* create the user xtable */ dbires = dbi_conn_query(conn, "CREATE TABLE t_xuser \ - (xuser_id INT NOT NULL AUTO_INCREMENT, \ - user_id INT NOT NULL, \ - refdb_id INT NOT NULL, \ + (xuser_id BIGINT NOT NULL AUTO_INCREMENT, \ + user_id BIGINT NOT NULL, \ + refdb_id BIGINT NOT NULL, \ xuser_reprint ENUM(\"IN FILE\",\"NOT IN FILE\",\"ON REQUEST\"), \ xuser_date DATE, \ @@ -355,7 +355,7 @@ /* create the notes xtable */ dbires = dbi_conn_query(conn, "CREATE TABLE t_xnote \ - (xnote_id INT NOT NULL AUTO_INCREMENT, \ - note_id INT NOT NULL, \ - xref_id INT NOT NULL, \ + (xnote_id BIGINT NOT NULL AUTO_INCREMENT, \ + note_id BIGINT NOT NULL, \ + xref_id BIGINT NOT NULL, \ xnote_type ENUM(\"REFERENCE\",\"KEYWORD\",\"AUTHOR\",\"PERIODICAL\"), \ PRIMARY KEY (xnote_id), \ @@ -1665,4 +1665,7 @@ unsigned long long my_dbi_result_get_idval(dbi_result dbires, const char* fieldname) { dbi_conn conn; + char buffer[512]; + unsigned long the_ulong; + unsigned long long the_ulonglong; conn = dbi_result_get_conn(dbires); @@ -1671,8 +1674,14 @@ /* database server does not support long long ints, retrieve as long int instead and cast */ - return (unsigned long long)dbi_result_get_ulong(dbires, fieldname); + the_ulong = dbi_result_get_ulong(dbires, fieldname); +/* sprintf(buffer, "ulong: u %u<< lu %lu<< llu %llu", the_ulong, the_ulong, the_ulong); */ +/* LOG_PRINT(LOG_DEBUG, buffer); */ + return (unsigned long long)the_ulong; } else { - return dbi_result_get_ulonglong(dbires, fieldname); + the_ulonglong = dbi_result_get_ulonglong(dbires, fieldname); +/* sprintf(buffer, "ulonglong: u %u<< lu %lu<< llu %llu", the_ulonglong, the_ulonglong, the_ulonglong); */ +/* LOG_PRINT(LOG_DEBUG, buffer); */ + return the_ulonglong; } } |