[Refdb-devel] CVS: refdb/src backend.c,1.17,1.18
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2003-12-21 23:02:41
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1:/tmp/cvs-serv32367/src Modified Files: backend.c Log Message: renamed get_refdb_note_note_copy() to get_refdb_note_content_copy(); new functions get_refdb_note_content_type() and get_refdb_note_content_xmllang(); fixed time output; select additional fields from t_note Index: backend.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backend.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -U2 -r1.17 -r1.18 --- backend.c 25 Oct 2003 23:46:37 -0000 1.17 +++ backend.c 21 Dec 2003 23:02:38 -0000 1.18 @@ -117,8 +117,8 @@ /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - get_refdb_note_note_copy(): retrieves the note element from a note query + get_refdb_note_content_copy(): retrieves the content element from a note query - char* get_refdb_note_note_copy returns a pointer to a string containing the - note_note element. The string is allocated and + char* get_refdb_note_content_copy returns a pointer to a string containing the + note_content element. The string is allocated and must be freed by the caller @@ -127,6 +127,52 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ -char* get_refdb_note_note_copy(dbi_result dbires) { - return my_dbi_result_get_string_copy(dbires, "note_note"); +char* get_refdb_note_content_copy(dbi_result dbires) { + return my_dbi_result_get_string_copy(dbires, "note_content"); +} + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + get_refdb_note_content_type(): retrieves the content_type element + from a note query + + char* get_refdb_content_type returns a pointer to a string containing the + content_type element + + dbi_result dbires database query result, pointing to the current + dataset + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +const char* get_refdb_note_content_type(dbi_result dbires) { + const char* result; + + result = dbi_result_get_string(dbires, "note_content_type"); + if (dbi_conn_error_flag(dbi_result_get_conn(dbires))) { + return NULL; + } + else { + return result; + } +} + +/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + get_refdb_note_content_xmllang(): retrieves the content_xmllang element + from a note query + + char* get_refdb_content_xmllang returns a pointer to a string containing the + content_xmllang element + + dbi_result dbires database query result, pointing to the current + dataset + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ +const char* get_refdb_note_content_xmllang(dbi_result dbires) { + const char* result; + + result = dbi_result_get_string(dbires, "note_content_xmllang"); + if (dbi_conn_error_flag(dbi_result_get_conn(dbires))) { + return NULL; + } + else { + return result; + } } @@ -155,5 +201,5 @@ } else { - strftime(date, 256, "<year>%Y</year><month>%m</month><day>%d</day>", localtime(&the_time)); + strftime(date, 256, "%Y-%m-%d", localtime(&the_time)); } } @@ -212,5 +258,5 @@ if (mode & REFERENCE) { sprintf(sql_chunk, - "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_note FROM t_note,t_xnote, t_user, t_refdb WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xnote.xref_id=t_refdb.refdb_id AND t_xnote.xnote_type=\'REFERENCE\'", + "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang FROM t_note,t_xnote, t_user, t_refdb WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xnote.xref_id=t_refdb.refdb_id AND t_xnote.xnote_type=\'REFERENCE\'", user, (unsigned long long)n_id); @@ -222,5 +268,5 @@ if (mode & KEYWORD) { sprintf(sql_chunk, - "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_note FROM t_note,t_xnote, t_user, t_refdb, t_xkeyword, t_keyword WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xkeyword.keyword_id=t_keyword.keyword_id AND t_xkeyword.xref_id=t_refdb.refdb_id AND t_xnote.xref_id=t_keyword.keyword_id AND t_xnote.xnote_type=\'KEYWORD\'", + "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang FROM t_note,t_xnote, t_user, t_refdb, t_xkeyword, t_keyword WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xkeyword.keyword_id=t_keyword.keyword_id AND t_xkeyword.xref_id=t_refdb.refdb_id AND t_xnote.xref_id=t_keyword.keyword_id AND t_xnote.xnote_type=\'KEYWORD\'", user, (unsigned long long)n_id); @@ -235,5 +281,5 @@ if (mode & AUTHOR) { sprintf(sql_chunk, - "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_note FROM t_note,t_xnote, t_user, t_refdb, t_xauthor, t_author WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xauthor.author_id=t_author.author_id AND t_xauthor.refdb_id=t_refdb.refdb_id AND t_xnote.xref_id=t_author.author_id AND t_xnote.xnote_type=\'AUTHOR\'", + "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang FROM t_note,t_xnote, t_user, t_refdb, t_xauthor, t_author WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xauthor.author_id=t_author.author_id AND t_xauthor.refdb_id=t_refdb.refdb_id AND t_xnote.xref_id=t_author.author_id AND t_xnote.xnote_type=\'AUTHOR\'", user, (unsigned long long)n_id); @@ -248,5 +294,5 @@ if (mode & PERIODICAL) { sprintf(sql_chunk, - "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_note FROM t_note,t_xnote, t_user, t_refdb, t_periodical WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_refdb.refdb_periodical_id=t_periodical.periodical_id AND t_xnote.xref_id=t_periodical.periodical_id AND t_xnote.xnote_type=\'PERIODICAL\'", + "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang FROM t_note,t_xnote, t_user, t_refdb, t_periodical WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_refdb.refdb_periodical_id=t_periodical.periodical_id AND t_xnote.xref_id=t_periodical.periodical_id AND t_xnote.xnote_type=\'PERIODICAL\'", user, (unsigned long long)n_id); @@ -267,5 +313,7 @@ note_key VARCHAR(255), \ note_title VARCHAR(255), \ - note_note BLOB, \ + note_content BLOB, \ + note_content_type VARCHAR(255), \ + note_content_xmllang VARCHAR(255), \ note_user_id INT, \ note_date DATE)"); @@ -277,5 +325,7 @@ note_key VARCHAR(255) UNIQUE, \ note_title VARCHAR(255), \ - note_note TEXT, \ + note_content TEXT, \ + note_content_type VARCHAR(255), \ + note_content_xmllang VARCHAR(255), \ note_user_id BIGINT, \ note_date DATE)"); @@ -287,7 +337,9 @@ note_key TEXT, \ note_title TEXT, \ + note_content_type TEXT, \ + note_content_xmllang TEXT, \ note_user_id INTEGER, \ note_date DATE, \ - note_note TEXT)"); + note_content TEXT)"); } else { @@ -313,5 +365,5 @@ if (mode & REFERENCE) { sprintf(sql_chunk, - "INSERT INTO t_noteunion (note_id, note_key, note_title, note_user_id, note_date, note_note) SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_note FROM t_note,t_xnote, t_user, t_refdb WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xnote.xref_id=t_refdb.refdb_id AND t_xnote.xnote_type=\'REFERENCE\'", + "INSERT INTO t_noteunion (note_id, note_key, note_title, note_user_id, note_date, note_content, t_note.note_content_type, t_note.note_content_xmllang) SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang FROM t_note,t_xnote, t_user, t_refdb WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xnote.xref_id=t_refdb.refdb_id AND t_xnote.xnote_type=\'REFERENCE\'", user, (unsigned long long)n_id); @@ -330,5 +382,5 @@ if (mode & KEYWORD) { sprintf(sql_chunk, - "INSERT INTO t_noteunion (note_id, note_key, note_title, note_user_id, note_date, note_note) SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_note FROM t_note,t_xnote, t_user, t_refdb, t_xkeyword, t_keyword WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xkeyword.keyword_id=t_keyword.keyword_id AND t_xkeyword.xref_id=t_refdb.refdb_id AND t_xnote.xref_id=t_keyword.keyword_id AND t_xnote.xnote_type=\'KEYWORD\'", + "INSERT INTO t_noteunion (note_id, note_key, note_title, note_user_id, note_date, note_content, t_note.note_content_type, t_note.note_content_xmllang) SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content FROM t_note,t_xnote, t_user, t_refdb, t_xkeyword, t_keyword WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xkeyword.keyword_id=t_keyword.keyword_id AND t_xkeyword.xref_id=t_refdb.refdb_id AND t_xnote.xref_id=t_keyword.keyword_id AND t_xnote.xnote_type=\'KEYWORD\'", user, (unsigned long long)n_id); @@ -347,5 +399,5 @@ if (mode & AUTHOR) { sprintf(sql_chunk, - "INSERT INTO t_noteunion (note_id, note_key, note_title, note_user_id, note_date, note_note) SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_note FROM t_note,t_xnote, t_user, t_refdb, t_xauthor, t_author WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xauthor.author_id=t_author.author_id AND t_xauthor.refdb_id=t_refdb.refdb_id AND t_xnote.xref_id=t_author.author_id AND t_xnote.xnote_type=\'AUTHOR\'", + "INSERT INTO t_noteunion (note_id, note_key, note_title, note_user_id, note_date, note_content, t_note.note_content_type, t_note.note_content_xmllang) SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang FROM t_note,t_xnote, t_user, t_refdb, t_xauthor, t_author WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_xauthor.author_id=t_author.author_id AND t_xauthor.refdb_id=t_refdb.refdb_id AND t_xnote.xref_id=t_author.author_id AND t_xnote.xnote_type=\'AUTHOR\'", user, (unsigned long long)n_id); @@ -364,5 +416,5 @@ if (mode & PERIODICAL) { sprintf(sql_chunk, - "INSERT INTO t_noteunion (note_id, note_key, note_title, note_user_id, note_date, note_note) SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_note FROM t_note,t_xnote, t_user, t_refdb, t_periodical WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_refdb.refdb_periodical_id=t_periodical.periodical_id AND t_xnote.xref_id=t_periodical.periodical_id AND t_xnote.xnote_type=\'PERIODICAL\'", + "INSERT INTO t_noteunion (note_id, note_key, note_title, note_user_id, note_date, note_content, t_note.note_content_type, t_note.note_content_xmllang) SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang FROM t_note,t_xnote, t_user, t_refdb, t_periodical WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND t_refdb.refdb_id="ULLSPEC" AND t_note.note_id=t_xnote.note_id AND t_refdb.refdb_periodical_id=t_periodical.periodical_id AND t_xnote.xref_id=t_periodical.periodical_id AND t_xnote.xnote_type=\'PERIODICAL\'", user, (unsigned long long)n_id); @@ -380,5 +432,5 @@ /* now retrieve the datasets again */ - sprintf(sql_command, "SELECT DISTINCT note_id, note_key, note_title, note_user_id, note_date, note_note FROM t_noteunion"); + sprintf(sql_command, "SELECT DISTINCT note_id, note_key, note_title, note_user_id, note_date, note_content, t_note.note_content_type, t_note.note_content_xmllang FROM t_noteunion"); } |