| 22 |
* |
* |
| 23 |
* $Revision$ |
* $Revision$ |
| 24 |
* $Log$ |
* $Log$ |
| 25 |
|
* Revision 1.103 2005/08/23 07:34:24 tani |
| 26 |
|
* Language対応: getItems, _insetItem, updateItem |
| 27 |
|
* |
| 28 |
* Revision 1.102 2005/08/23 02:19:10 tani |
* Revision 1.102 2005/08/23 02:19:10 tani |
| 29 |
* getEventsForRSS?????`?F?b?N???X. |
* getEventsForRSSの権限チェックを変更. |
| 30 |
* |
* |
| 31 |
* Revision 1.101 2005/08/08 01:57:00 aga4096 |
* Revision 1.101 2005/08/08 01:57:00 aga4096 |
| 32 |
* ・2回目以降のinitializeDBを無視. |
* ・2回目以降のinitializeDBを無視. |
| 3612 |
SQLCHAR title[ XNP_ITEM_TITLE_LEN + 1 ], |
SQLCHAR title[ XNP_ITEM_TITLE_LEN + 1 ], |
| 3613 |
keywords[ XNP_ITEM_KEYWORDS_LEN + 1 ], |
keywords[ XNP_ITEM_KEYWORDS_LEN + 1 ], |
| 3614 |
description[ XNP_ITEM_DESCRIPTION_LEN + 1 ], |
description[ XNP_ITEM_DESCRIPTION_LEN + 1 ], |
| 3615 |
doi[ XNP_ITEM_DOI_LEN + 1 ]; |
doi[ XNP_ITEM_DOI_LEN + 1 ], |
| 3616 |
|
lang[ XNP_ITEM_LANG_LEN + 1 ]; |
| 3617 |
SQLLEN cbTitle = SQL_NTS, |
SQLLEN cbTitle = SQL_NTS, |
| 3618 |
cbKeywords = SQL_NTS, |
cbKeywords = SQL_NTS, |
| 3619 |
cbDescription = SQL_NTS, |
cbDescription = SQL_NTS, |
| 3620 |
cbDOI = SQL_NTS; |
cbDOI = SQL_NTS, |
| 3621 |
|
cbLang = SQL_NTS; |
| 3622 |
indexid_t private_xid; |
indexid_t private_xid; |
| 3623 |
|
|
| 3624 |
if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) { |
if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) { |
| 3625 |
string sql; |
string sql; |
| 3626 |
sql = "INSERT INTO " + dbprefix + "_xoonips_item_basic (item_type_id, title, keywords, description, doi, uid, creation_date, last_update_date, publication_year, publication_month, publication_mday) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"; |
sql = "INSERT INTO " + dbprefix + "_xoonips_item_basic (item_type_id, title, keywords, description, doi, uid, creation_date, last_update_date, publication_year, publication_month, publication_mday, lang) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"; |
| 3627 |
syslog_printf( "\nsql at %d=%s", __LINE__, sql.c_str() ); |
syslog_printf( "\nsql at %d=%s", __LINE__, sql.c_str() ); |
| 3628 |
sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS); |
sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS); |
| 3629 |
if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){ |
if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){ |
| 3638 |
SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_year, 0, &cbPublication_year ); |
SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_year, 0, &cbPublication_year ); |
| 3639 |
SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_month, 0, &cbPublication_month ); |
SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_month, 0, &cbPublication_month ); |
| 3640 |
SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_mday, 0, &cbPublication_mday ); |
SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_mday, 0, &cbPublication_mday ); |
| 3641 |
|
SQLBindParameter(hstmt, 12, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ITEM_LANG_LEN, 0, lang, 0, &cbLang ); |
| 3642 |
|
|
| 3643 |
strncpy2( (char*)title, item -> getTitle(), XNP_ITEM_TITLE_LEN ); |
strncpy2( (char*)title, item -> getTitle(), XNP_ITEM_TITLE_LEN ); |
| 3644 |
strncpy2( (char*)keywords, item -> getKeywords(), XNP_ITEM_KEYWORDS_LEN ); |
strncpy2( (char*)keywords, item -> getKeywords(), XNP_ITEM_KEYWORDS_LEN ); |
| 3645 |
strncpy2( (char*)description, item -> getDescription(), XNP_ITEM_DESCRIPTION_LEN ); |
strncpy2( (char*)description, item -> getDescription(), XNP_ITEM_DESCRIPTION_LEN ); |
| 3646 |
strncpy2( (char*)doi, item -> getDOI(), XNP_ITEM_DOI_LEN ); |
strncpy2( (char*)doi, item -> getDOI(), XNP_ITEM_DOI_LEN ); |
| 3647 |
|
strncpy2( (char*)lang, item -> getLang(), XNP_ITEM_LANG_LEN ); |
| 3648 |
item_type_id = item -> getItemTypeID( ); |
item_type_id = item -> getItemTypeID( ); |
| 3649 |
uid = item -> getContributorUID( ); |
uid = item -> getContributorUID( ); |
| 3650 |
creation_date = time( NULL ); |
creation_date = time( NULL ); |
| 3781 |
|
|
| 3782 |
|
|
| 3783 |
if( dbtype == DBTYPE_MYSQL ){ |
if( dbtype == DBTYPE_MYSQL ){ |
| 3784 |
sql = "SELECT DISTINCT ti.item_id as item_id, item_type_id, title, keywords, description, doi, ti.uid as uid, creation_date, last_update_date, publication_year, publication_month, publication_mday "; |
sql = "SELECT DISTINCT ti.item_id as item_id, item_type_id, title, keywords, description, doi, ti.uid as uid, creation_date, last_update_date, publication_year, publication_month, publication_mday, lang "; |
| 3785 |
sql+= " FROM " + dbprefix + "_xoonips_index_item_link AS tlink"; |
sql+= " FROM " + dbprefix + "_xoonips_index_item_link AS tlink"; |
| 3786 |
sql+= " LEFT JOIN " + dbprefix + "_xoonips_index AS tx ON tlink.index_id = tx.index_id"; |
sql+= " LEFT JOIN " + dbprefix + "_xoonips_index AS tx ON tlink.index_id = tx.index_id"; |
| 3787 |
sql+= " LEFT JOIN " + dbprefix + "_xoonips_item_basic AS ti ON tlink.item_id = ti.item_id"; |
sql+= " LEFT JOIN " + dbprefix + "_xoonips_item_basic AS ti ON tlink.item_id = ti.item_id"; |
| 3851 |
dst[ i ].setPublicationYear( publication_year ); |
dst[ i ].setPublicationYear( publication_year ); |
| 3852 |
dst[ i ].setPublicationMonth( publication_month ); |
dst[ i ].setPublicationMonth( publication_month ); |
| 3853 |
dst[ i ].setPublicationMday( publication_mday ); |
dst[ i ].setPublicationMday( publication_mday ); |
| 3854 |
|
dst[ i ].setLang( getResultCol( hstmt, 13 ).c_str() ); |
| 3855 |
( *itemsLen )++; |
( *itemsLen )++; |
| 3856 |
} |
} |
| 3857 |
*items = dst; |
*items = dst; |
| 4074 |
SQLCHAR title[ XNP_ITEM_TITLE_LEN + 1 ], |
SQLCHAR title[ XNP_ITEM_TITLE_LEN + 1 ], |
| 4075 |
keywords[ XNP_ITEM_KEYWORDS_LEN + 1 ], |
keywords[ XNP_ITEM_KEYWORDS_LEN + 1 ], |
| 4076 |
description[ XNP_ITEM_DESCRIPTION_LEN + 1 ], |
description[ XNP_ITEM_DESCRIPTION_LEN + 1 ], |
| 4077 |
doi[ XNP_ITEM_DOI_LEN + 1 ]; |
doi[ XNP_ITEM_DOI_LEN + 1 ], |
| 4078 |
|
lang[ XNP_ITEM_LANG_LEN + 1 ]; |
| 4079 |
SQLLEN cbTitle = SQL_NTS, |
SQLLEN cbTitle = SQL_NTS, |
| 4080 |
cbKeywords = SQL_NTS, |
cbKeywords = SQL_NTS, |
| 4081 |
cbDescription = SQL_NTS, |
cbDescription = SQL_NTS, |
| 4082 |
cbDOI = SQL_NTS; |
cbDOI = SQL_NTS, |
| 4083 |
|
cbLang = SQL_NTS; |
| 4084 |
|
|
| 4085 |
if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) { |
if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) { |
| 4086 |
string sql; |
string sql; |
| 4095 |
sql += ", publication_year=?"; |
sql += ", publication_year=?"; |
| 4096 |
sql += ", publication_month=?"; |
sql += ", publication_month=?"; |
| 4097 |
sql += ", publication_mday=?"; |
sql += ", publication_mday=?"; |
| 4098 |
|
sql += ", lang=?"; |
| 4099 |
sql += " WHERE item_id=?"; |
sql += " WHERE item_id=?"; |
| 4100 |
sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS); |
sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS); |
| 4101 |
if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){ |
if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){ |
| 4109 |
SQLBindParameter(hstmt, 8, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_year, 0, &cbPublication_year ); |
SQLBindParameter(hstmt, 8, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_year, 0, &cbPublication_year ); |
| 4110 |
SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_month, 0, &cbPublication_month ); |
SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_month, 0, &cbPublication_month ); |
| 4111 |
SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_mday, 0, &cbPublication_mday ); |
SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &publication_mday, 0, &cbPublication_mday ); |
| 4112 |
SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &item_id, 0, &cbItem_id ); |
SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ITEM_LANG_LEN, 0, lang, 0, &cbLang ); |
| 4113 |
|
SQLBindParameter(hstmt, 12, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &item_id, 0, &cbItem_id ); |
| 4114 |
|
|
| 4115 |
strncpy2( (char*)title, item -> getTitle(), XNP_ITEM_TITLE_LEN ); |
strncpy2( (char*)title, item -> getTitle(), XNP_ITEM_TITLE_LEN ); |
| 4116 |
strncpy2( (char*)keywords, item -> getKeywords(), XNP_ITEM_KEYWORDS_LEN ); |
strncpy2( (char*)keywords, item -> getKeywords(), XNP_ITEM_KEYWORDS_LEN ); |
| 4122 |
publication_year = item -> getPublicationYear(); |
publication_year = item -> getPublicationYear(); |
| 4123 |
publication_month = item -> getPublicationMonth(); |
publication_month = item -> getPublicationMonth(); |
| 4124 |
publication_mday = item -> getPublicationMday(); |
publication_mday = item -> getPublicationMday(); |
| 4125 |
|
strncpy2( (char*)lang, item -> getLang(), XNP_ITEM_LANG_LEN ); |
| 4126 |
item_id = item -> getItemID( ); |
item_id = item -> getItemID( ); |
| 4127 |
|
|
| 4128 |
if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){ |
if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){ |