summaryrefslogtreecommitdiff
path: root/src/char/int_auction.c
diff options
context:
space:
mode:
authorshennetsind <notind@gmail.com>2013-06-10 17:53:37 -0700
committershennetsind <notind@gmail.com>2013-06-10 17:53:37 -0700
commit8821ff87533b037d5d4914db6dbdeacfa5fca4ce (patch)
tree5fd975f4501e8d71ff1b5b31d66a6b99bc813927 /src/char/int_auction.c
parent8f85487dbdc1a5f4bd3d01bc3fc75bba9b643124 (diff)
parent4d9a0a869c52f7acab6ca110d78aa006f76f70a5 (diff)
downloadhercules-8821ff87533b037d5d4914db6dbdeacfa5fca4ce.tar.gz
hercules-8821ff87533b037d5d4914db6dbdeacfa5fca4ce.tar.bz2
hercules-8821ff87533b037d5d4914db6dbdeacfa5fca4ce.tar.xz
hercules-8821ff87533b037d5d4914db6dbdeacfa5fca4ce.zip
Merge pull request #42 from Earisu/master
Sql Statement interface
Diffstat (limited to 'src/char/int_auction.c')
-rw-r--r--src/char/int_auction.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index c9195a380..bf5ea1700 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -56,17 +56,17 @@ void auction_save(struct auction_data *auction)
StrBuf->Printf(&buf, ", `card%d` = '%d'", j, auction->item.card[j]);
StrBuf->Printf(&buf, " WHERE `auction_id` = '%d'", auction->auction_id);
- stmt = SqlStmt_Malloc(sql_handle);
- if( SQL_SUCCESS != SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 2, SQLDT_STRING, auction->item_name, strnlen(auction->item_name, ITEM_NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(sql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, auction->item_name, strnlen(auction->item_name, ITEM_NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Destroy(&buf);
}
@@ -95,12 +95,12 @@ unsigned int auction_create(struct auction_data *auction)
updateLastUid(auction->item.unique_id);
dbUpdateUid(sql_handle);
- stmt = SqlStmt_Malloc(sql_handle);
- if( SQL_SUCCESS != SqlStmt_PrepareStr(stmt, StrBuf->Value(&buf))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_BindParam(stmt, 2, SQLDT_STRING, auction->item_name, strnlen(auction->item_name, ITEM_NAME_LENGTH))
- || SQL_SUCCESS != SqlStmt_Execute(stmt) )
+ stmt = SQL->StmtMalloc(sql_handle);
+ if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, auction->item_name, strnlen(auction->item_name, ITEM_NAME_LENGTH))
+ || SQL_SUCCESS != SQL->StmtExecute(stmt) )
{
SqlStmt_ShowDebug(stmt);
auction->auction_id = 0;
@@ -114,7 +114,7 @@ unsigned int auction_create(struct auction_data *auction)
auction->item.identify = 1;
auction->item.expire_time = 0;
- auction->auction_id = (unsigned int)SqlStmt_LastInsertId(stmt);
+ auction->auction_id = (unsigned int)SQL->StmtLastInsertId(stmt);
auction->auction_end_timer = iTimer->add_timer( iTimer->gettick() + tick , auction_end_timer, auction->auction_id, 0);
ShowInfo("New Auction %u | time left %u ms | By %s.\n", auction->auction_id, tick, auction->seller_name);
@@ -123,7 +123,7 @@ unsigned int auction_create(struct auction_data *auction)
idb_put(auction_db_, auction_->auction_id, auction_);
}
- SqlStmt_Free(stmt);
+ SQL->StmtFree(stmt);
StrBuf->Destroy(&buf);
return auction->auction_id;