📄 citem.cpp
字号:
ret= SQLFetch(hStmt) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL );// Process any inserts in lpMsgBuf.
// ...// Display the string.
printf("\nLast Error: %s", (LPCTSTR)lpMsgBuf) ;
// Free the buffer.
LocalFree( lpMsgBuf );
printf("\nItem7: Fetch Error ") ;
return -1 ;
}
while(ret == SQL_SUCCESS)
{
// Accquire the DATA
ret= SQLGetData(hStmt, 1, SQL_C_SLONG, &c, sizeof(int), &cbValue) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nError!!! (%d)", ret) ;
return -1 ;
}
CPotion[c].Item_id = c;
ret= SQLGetData(hStmt, 2, SQL_C_CHAR, &CPotion[c].Name, sizeof(Name), &cbValue) ;
ret= SQLGetData(hStmt, 3, SQL_C_CHAR, &CPotion[c].Han_Name, sizeof(Han_Name), &cbValue) ;
EatRearWhiteChar(CPotion[c].Han_Name );
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nString GET Error!!! (%d)", ret) ;
return -1 ;
}
tmp = &CPotion[c].lv;
for(i=4; i <= nCols; i++) {
ret= SQLGetData(hStmt, i, SQL_C_SLONG, tmp, sizeof(int), &cbValue) ;
tmp++ ;
}
c++ ;
ret= SQLFetch(hStmt) ;
m_Much = 0;
}
SQLFreeStmt(hStmt, SQL_DROP) ;
return c ;
}
int CItem_Tool::getAllData(void)
{
if(Num_Of_CItem_Tool <= 0) {
return -4 ; // No item's available
}
HSTMT hStmt= NULL ;
RETCODE ret ;
SWORD nCols ;
char query_stmt[80]= {0, } ;
SDWORD cbValue ;
int *tmp ;
int c= 1, i ;
SQLAllocStmt(hDBC, &hStmt);
/////////////////////////////////////////////////////////////////////////////
//strcpy(query_stmt, "select * from Item_Tool order by item_id") ;
strcpy(query_stmt, "EXEC up_get_item_tool");
/////////////////////////////////////////////////////////////////////////////
ret= SQLExecDirect(hStmt, (UCHAR *)query_stmt, SQL_NTS) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nItem Tool: ExecDirect Error ") ;
return -1 ;
}
SQLNumResultCols(hStmt, &nCols) ;
ret= SQLFetch(hStmt) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL );// Process any inserts in lpMsgBuf.
// ...// Display the string.
printf("\nLast Error: %s", (LPCTSTR)lpMsgBuf) ;
// Free the buffer.
LocalFree( lpMsgBuf );
printf("\nItem7: Fetch Error ") ;
return -1 ;
}
while( ret == SQL_SUCCESS)
{
// Accquire the DATA
ret= SQLGetData(hStmt, 1, SQL_C_SLONG, &c, sizeof(int), &cbValue) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nError!!! (%d)", ret) ;
return -1 ;
}
CTool[c].Item_id = c;
ret= SQLGetData(hStmt, 2, SQL_C_CHAR, &CTool[c].Name, sizeof(Name), &cbValue) ;
ret= SQLGetData(hStmt, 3, SQL_C_CHAR, &CTool[c].Han_Name, sizeof(Han_Name), &cbValue) ;
EatRearWhiteChar( CTool[c].Han_Name );
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nString GET Error!!! (%d)", ret) ;
return -1 ;
}
tmp = &CTool[c].lv;
for(i=4; i <= nCols; i++) {
ret= SQLGetData(hStmt, i, SQL_C_SLONG, tmp, sizeof(int), &cbValue) ;
tmp++ ;
}
c++ ;
ret= SQLFetch(hStmt) ;
m_Much = 0;
}
SQLFreeStmt(hStmt, SQL_DROP) ;
return c ;
}
int CItem_Weapon::getAllData(void)
{
if(Num_Of_CItem_Weapon <= 0) {
return -4 ; // No item's available
}
HSTMT hStmt= NULL ;
RETCODE ret ;
SWORD nCols ;
char query_stmt[80]= {0, } ;
SDWORD cbValue ;
int *tmp ;
int c= 1, i ;
SQLAllocStmt(hDBC, &hStmt);
/////////////////////////////////////////////////////////////////////////////
//strcpy(query_stmt, "select * from Item_Weapon order by item_id") ;
strcpy(query_stmt, "EXEC up_get_item_weapon");
/////////////////////////////////////////////////////////////////////////////
ret= SQLExecDirect(hStmt, (UCHAR *)query_stmt, SQL_NTS) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nItem Weapon: ExecDirect Error ") ;
return -1 ;
}
SQLNumResultCols(hStmt, &nCols) ;
ret= SQLFetch(hStmt) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL );// Process any inserts in lpMsgBuf.
// ...// Display the string.
printf("\nLast Error: %s", (LPCTSTR)lpMsgBuf) ;
// Free the buffer.
LocalFree( lpMsgBuf );
printf("\nItem7: Fetch Error ") ;
return -1 ;
}
while(ret == SQL_SUCCESS)
{
// Accquire the DATA
ret= SQLGetData(hStmt, 1, SQL_C_SLONG, &c, sizeof(int), &cbValue) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nError!!! (%d)", ret) ;
return -1 ;
}
CWeapon[c].Item_id = c;
ret= SQLGetData(hStmt, 2, SQL_C_CHAR, &CWeapon[c].Name, sizeof(Name), &cbValue) ;
ret= SQLGetData(hStmt, 3, SQL_C_CHAR, &CWeapon[c].Han_Name, sizeof(Han_Name), &cbValue) ;
EatRearWhiteChar( CWeapon[c].Han_Name );
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nString GET Error!!! (%d)", ret) ;
return -1 ;
}
tmp = &CWeapon[c].lv;
for(i=4; i <= nCols; i++) {
ret= SQLGetData(hStmt, i, SQL_C_SLONG, tmp, sizeof(int), &cbValue) ;
tmp++ ;
}
c++ ;
ret= SQLFetch(hStmt) ;
m_Much = 0;
}
SQLFreeStmt(hStmt, SQL_DROP) ;
return c ;
}
int CItem_Disposable::getAllData(void)
{
if(Num_Of_CItem_Disposable <= 0) {
return -4 ; // No item's available
}
HSTMT hStmt= NULL ;
RETCODE ret ;
SWORD nCols ;
char query_stmt[80]= {0, } ;
SDWORD cbValue ;
int *tmp ;
int c= 1, i ;
SQLAllocStmt(hDBC, &hStmt);
/////////////////////////////////////////////////////////////////////////////
//strcpy(query_stmt, "select * from Item_Disposable order by item_id") ;
strcpy(query_stmt, "EXEC up_get_item_disposable");
/////////////////////////////////////////////////////////////////////////////
ret= SQLExecDirect(hStmt, (UCHAR *)query_stmt, SQL_NTS) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nItem Disposable: ExecDirect Error ") ;
return -1 ;
}
SQLNumResultCols(hStmt, &nCols) ;
ret= SQLFetch(hStmt) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL );// Process any inserts in lpMsgBuf.
printf("\nLast Error: %s", (LPCTSTR)lpMsgBuf) ;
LocalFree( lpMsgBuf );
printf("\nItem7: Fetch Error ") ;
return -1 ;
}
while(ret == SQL_SUCCESS)
{
// Accquire the DATA
ret= SQLGetData(hStmt, 1, SQL_C_SLONG, &c, sizeof(int), &cbValue) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nError!!! (%d)", ret) ;
return -1 ;
}
CDisposable[c].Item_id = c;
ret= SQLGetData(hStmt, 2, SQL_C_CHAR, &CDisposable[c].Name, sizeof(Name), &cbValue) ;
ret= SQLGetData(hStmt, 3, SQL_C_CHAR, &CDisposable[c].Han_Name, sizeof(Han_Name), &cbValue) ;
EatRearWhiteChar( CDisposable[c].Han_Name );
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nString GET Error!!! (%d)", ret) ;
return -1 ;
}
tmp = &CDisposable[c].lv;
for(i=4; i <= nCols; i++) {
ret= SQLGetData(hStmt, i, SQL_C_SLONG, tmp, sizeof(int), &cbValue) ;
tmp++ ;
}
c++ ;
ret= SQLFetch(hStmt) ;
m_Much = 0;
}
SQLFreeStmt(hStmt, SQL_DROP) ;
return c ;
}
int CItem_Armor::getAllData(void)
{
if(Num_Of_CItem_Armor <= 0) {
return -4 ; // No item's available
}
HSTMT hStmt= NULL ;
RETCODE ret ;
SWORD nCols ;
char query_stmt[80]= {0, } ;
SDWORD cbValue ;
int *tmp ;
int c= 1, i ;
SQLAllocStmt(hDBC, &hStmt);
/////////////////////////////////////////////////////////////////////////////
//strcpy(query_stmt, "select * from Item_Armor order by item_id") ;
strcpy(query_stmt, "EXEC up_get_item_armor");
/////////////////////////////////////////////////////////////////////////////
ret= SQLExecDirect(hStmt, (UCHAR *)query_stmt, SQL_NTS) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nItem Armor: ExecDirect Error ") ;
return -1 ;
}
SQLNumResultCols(hStmt, &nCols) ;
ret= SQLFetch(hStmt) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS)
{
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL );// Process any inserts in lpMsgBuf.
// ...// Display the string.
printf("\nLast Error: %s", (LPCTSTR)lpMsgBuf) ;
// Free the buffer.
LocalFree( lpMsgBuf );
printf("\nItem7: Fetch Error ") ;
return -1 ;
}
while(ret == SQL_SUCCESS)
{
// Accquire the DATA
ret= SQLGetData(hStmt, 1, SQL_C_SLONG, &c, sizeof(int), &cbValue) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nError!!! (%d)", ret) ;
return -1 ;
}
CArmor[c].Item_id = c;
ret= SQLGetData(hStmt, 2, SQL_C_CHAR, &CArmor[c].Name, sizeof(Name), &cbValue) ;
ret= SQLGetData(hStmt, 3, SQL_C_CHAR, &CArmor[c].Han_Name, sizeof(Han_Name), &cbValue) ;
EatRearWhiteChar( CArmor[c].Han_Name );
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nString GET Error!!! (%d)", ret) ;
return -1 ;
}
tmp = &CArmor[c].lv;
for(i=4; i <= nCols; i++) {
ret= SQLGetData(hStmt, i, SQL_C_SLONG, tmp, sizeof(int), &cbValue) ;
tmp++ ;
}
c++ ;
ret= SQLFetch(hStmt) ;
m_Much = 0;
}
SQLFreeStmt(hStmt, SQL_DROP) ;
return c ;
}
int CItem_Accessory::getAllData(void)
{
if(Num_Of_CItem_Accessory <= 0) {
//fprintf(stdout, "\n No item's available ") ;
return -4 ; // No item's available
}
HSTMT hStmt= NULL ;
RETCODE ret ;
SWORD nCols ;
char query_stmt[80]= {0, } ;
SDWORD cbValue ;
int *tmp ;
int c= 1, i ;
SQLAllocStmt(hDBC, &hStmt);
/////////////////////////////////////////////////////////////////////////////
//strcpy(query_stmt, "select * from Item_Accessory order by item_id") ;
strcpy(query_stmt, "EXEC up_get_item_accessory");
/////////////////////////////////////////////////////////////////////////////
ret= SQLExecDirect(hStmt, (UCHAR *)query_stmt, SQL_NTS) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nItem Accessory: ExecDirect Error ") ;
return -1 ;
}
SQLNumResultCols(hStmt, &nCols) ;
ret= SQLFetch(hStmt) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL );// Process any inserts in lpMsgBuf.
printf("\nLast Error: %s", (LPCTSTR)lpMsgBuf) ;
LocalFree( lpMsgBuf );
printf("\nItem7: Fetch Error ") ;
return -1 ;
}
while(ret == SQL_SUCCESS)
{
// Accquire the DATA
ret= SQLGetData(hStmt, 1, SQL_C_SLONG, &c, sizeof(int), &cbValue) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nError!!! (%d)", ret) ;
return -1 ;
}
CAccessory[c].Item_id = c;
ret= SQLGetData(hStmt, 2, SQL_C_CHAR, &CAccessory[c].Name, sizeof(Name), &cbValue) ;
ret= SQLGetData(hStmt, 3, SQL_C_CHAR, &CAccessory[c].Han_Name, sizeof(Han_Name), &cbValue) ;
EatRearWhiteChar( CAccessory[c].Han_Name );
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nString GET Error!!! (%d)", ret) ;
return -1 ;
}
tmp = &CAccessory[c].lv;
for(i=4; i <= nCols; i++) {
ret= SQLGetData(hStmt, i, SQL_C_SLONG, tmp, sizeof(int), &cbValue) ;
tmp++ ;
}
c++ ;
ret= SQLFetch(hStmt) ;
m_Much = 0; // 弊 酒捞袍捞 倔付唱 乐唱 檬扁拳 1215
}
SQLFreeStmt(hStmt, SQL_DROP) ;
return c ;
}
int CItem_Etc::getAllData(void)
{
if(Num_Of_CItem_Etc <= 0) {
return -4 ; // No item's available
}
HSTMT hStmt= NULL ;
RETCODE ret ;
SWORD nCols ;
char query_stmt[80]= {0, } ;
SDWORD cbValue ;
int *tmp ;
int c= 1, i ;
SQLAllocStmt(hDBC, &hStmt);
/////////////////////////////////////////////////////////////////////////////
//strcpy(query_stmt, "select * from Item_Etc order by item_id") ;
strcpy(query_stmt, "EXEC up_get_item_etc");
/////////////////////////////////////////////////////////////////////////////
ret= SQLExecDirect(hStmt, (UCHAR *)query_stmt, SQL_NTS) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
printf("\nItem Etc: ExecDirect Error ") ;
return -1 ;
}
SQLNumResultCols(hStmt, &nCols) ;
ret= SQLFetch(hStmt) ;
if(ret != SQL_SUCCESS_WITH_INFO && ret != SQL_SUCCESS) {
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL );// Process any inserts in lpMsgBuf.
printf("\nLast Error: %s", (LPCTSTR)lpMsgBuf) ;
LocalFree( lpMsgBuf );
printf("\nItem7: Fetch Error ") ;
return -1 ;
}
while(ret == SQL_SUCCESS)
{
// Accquire the DATA
ret= SQLGetData(hStmt, 1, SQL_C_SLONG, &c, sizeof(int), &cbValue) ;
CEtc[c].Item_id = c;
ret= SQLGetData(hStmt, 2, SQL_C_CHAR, &CEtc[c].Name, sizeof(Name), &cbValue) ;
ret= SQLGetData(hStmt, 3, SQL_C_CHAR, &CEtc[c].Han_Name, sizeof(Han_Name), &cbValue) ;
EatRearWhiteChar( CEtc[c].Han_Name );
tmp = &CEtc[c].lv;
for(i=4; i <= nCols; i++) {
ret= SQLGetData(hStmt, i, SQL_C_SLONG, tmp, sizeof(int), &cbValue) ;
tmp++ ;
}
c++ ;
ret= SQLFetch(hStmt) ;
m_Much = 0;
}
SQLFreeStmt(hStmt, SQL_DROP) ;
return c ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -