本文整理汇总了C++中StringBuf_Destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ StringBuf_Destroy函数的具体用法?C++ StringBuf_Destroy怎么用?C++ StringBuf_Destroy使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了StringBuf_Destroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapif_achievement_update
/**
* Updates an achievement in a character's achievementlog.
* @param char_id: Character ID
* @param ad: Achievement data
* @return false in case of errors, true otherwise
*/
bool mapif_achievement_update(uint32 char_id, struct achievement* ad)
{
StringBuf buf;
int i;
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "UPDATE `%s` SET ", schema_config.achievement_table);
if( ad->completed ){
StringBuf_Printf(&buf, "`completed` = FROM_UNIXTIME('%u'),", (uint32)ad->completed);
}else{
StringBuf_AppendStr(&buf, "`completed` = NULL,");
}
if( ad->rewarded ){
StringBuf_Printf(&buf, "`rewarded` = FROM_UNIXTIME('%u')", (uint32)ad->rewarded);
}else{
StringBuf_AppendStr(&buf, "`rewarded` = NULL");
}
for (i = 0; i < MAX_ACHIEVEMENT_OBJECTIVES; ++i)
StringBuf_Printf(&buf, ", `count%d` = '%d'", i + 1, ad->count[i]);
StringBuf_Printf(&buf, " WHERE `id` = %d AND `char_id` = %u", ad->achievement_id, char_id);
if (SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf))) {
Sql_ShowDebug(sql_handle);
StringBuf_Destroy(&buf);
return false;
}
StringBuf_Destroy(&buf);
return true;
}
示例2: mapif_achievement_add
/**
* Adds an achievement to a character's achievementlog.
* @param char_id: Character ID
* @param ad: Achievement data
* @return false in case of errors, true otherwise
*/
bool mapif_achievement_add(uint32 char_id, struct achievement* ad)
{
StringBuf buf;
int i;
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "INSERT INTO `%s` (`char_id`, `id`, `completed`, `rewarded`", schema_config.achievement_table);
for (i = 0; i < MAX_ACHIEVEMENT_OBJECTIVES; ++i)
StringBuf_Printf(&buf, ", `count%d`", i + 1);
StringBuf_AppendStr(&buf, ")");
StringBuf_Printf(&buf, " VALUES ('%u', '%d',", char_id, ad->achievement_id, (uint32)ad->completed, (uint32)ad->rewarded);
if( ad->completed ){
StringBuf_Printf(&buf, "FROM_UNIXTIME('%u'),", (uint32)ad->completed);
}else{
StringBuf_AppendStr(&buf, "NULL,");
}
if( ad->rewarded ){
StringBuf_Printf(&buf, "FROM_UNIXTIME('%u')", (uint32)ad->rewarded);
}else{
StringBuf_AppendStr(&buf, "NULL");
}
for (i = 0; i < MAX_ACHIEVEMENT_OBJECTIVES; ++i)
StringBuf_Printf(&buf, ", '%d'", ad->count[i]);
StringBuf_AppendStr(&buf, ")");
if (SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf))) {
Sql_ShowDebug(sql_handle);
StringBuf_Destroy(&buf);
return false;
}
StringBuf_Destroy(&buf);
return true;
}
示例3: memset
/**
* Load achievements for a character.
* @param char_id: Character ID
* @param count: Pointer to return the number of found entries.
* @return Array of found entries. It has *count entries, and it is care of the caller to aFree() it afterwards.
*/
struct achievement *mapif_achievements_fromsql(uint32 char_id, int *count)
{
struct achievement *achievelog = NULL;
struct achievement tmp_achieve;
SqlStmt *stmt;
StringBuf buf;
int i;
if (!count)
return NULL;
memset(&tmp_achieve, 0, sizeof(tmp_achieve));
StringBuf_Init(&buf);
StringBuf_AppendStr(&buf, "SELECT `id`, COALESCE(UNIX_TIMESTAMP(`completed`),0), COALESCE(UNIX_TIMESTAMP(`rewarded`),0)");
for (i = 0; i < MAX_ACHIEVEMENT_OBJECTIVES; ++i)
StringBuf_Printf(&buf, ", `count%d`", i + 1);
StringBuf_Printf(&buf, " FROM `%s` WHERE `char_id` = '%u'", schema_config.achievement_table, char_id);
stmt = SqlStmt_Malloc(sql_handle);
if( SQL_ERROR == SqlStmt_PrepareStr(stmt, StringBuf_Value(&buf))
|| SQL_ERROR == SqlStmt_Execute(stmt) )
{
SqlStmt_ShowDebug(stmt);
SqlStmt_Free(stmt);
StringBuf_Destroy(&buf);
*count = 0;
return NULL;
}
SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &tmp_achieve.achievement_id, 0, NULL, NULL);
SqlStmt_BindColumn(stmt, 1, SQLDT_INT, &tmp_achieve.completed, 0, NULL, NULL);
SqlStmt_BindColumn(stmt, 2, SQLDT_INT, &tmp_achieve.rewarded, 0, NULL, NULL);
for (i = 0; i < MAX_ACHIEVEMENT_OBJECTIVES; ++i)
SqlStmt_BindColumn(stmt, 3 + i, SQLDT_INT, &tmp_achieve.count[i], 0, NULL, NULL);
*count = (int)SqlStmt_NumRows(stmt);
if (*count > 0) {
i = 0;
achievelog = (struct achievement *)aCalloc(*count, sizeof(struct achievement));
while (SQL_SUCCESS == SqlStmt_NextRow(stmt)) {
if (i >= *count) // Sanity check, should never happen
break;
memcpy(&achievelog[i++], &tmp_achieve, sizeof(tmp_achieve));
}
if (i < *count) {
// Should never happen. Compact array
*count = i;
achievelog = (struct achievement *)aRealloc(achievelog, sizeof(struct achievement) * i);
}
}
SqlStmt_Free(stmt);
StringBuf_Destroy(&buf);
ShowInfo("achievement load complete from DB - id: %d (total: %d)\n", char_id, *count);
return achievelog;
}
示例4: mail_loadmessage
/// Retrieves a single message from the database.
/// Returns true if the operation succeeds (or false if it fails).
static bool mail_loadmessage(int mail_id, struct mail_message* msg)
{
int j;
StringBuf buf;
StringBuf_Init(&buf);
StringBuf_AppendStr(&buf, "SELECT `id`,`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`status`,"
"`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`, `serial`");
for( j = 0; j < MAX_SLOTS; j++ )
StringBuf_Printf(&buf, ",`card%d`", j);
StringBuf_Printf(&buf, " FROM `%s` WHERE `id` = '%d'", mail_db, mail_id);
if( SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf))
|| SQL_SUCCESS != Sql_NextRow(sql_handle) )
{
Sql_ShowDebug(sql_handle);
Sql_FreeResult(sql_handle);
StringBuf_Destroy(&buf);
return false;
}
else
{
char* data;
Sql_GetData(sql_handle, 0, &data, NULL); msg->id = atoi(data);
Sql_GetData(sql_handle, 1, &data, NULL); safestrncpy(msg->send_name, data, NAME_LENGTH);
Sql_GetData(sql_handle, 2, &data, NULL); msg->send_id = atoi(data);
Sql_GetData(sql_handle, 3, &data, NULL); safestrncpy(msg->dest_name, data, NAME_LENGTH);
Sql_GetData(sql_handle, 4, &data, NULL); msg->dest_id = atoi(data);
Sql_GetData(sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH);
Sql_GetData(sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH);
Sql_GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data);
Sql_GetData(sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data);
Sql_GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data);
Sql_GetData(sql_handle,10, &data, NULL); msg->item.amount = (short)atoi(data);
Sql_GetData(sql_handle,11, &data, NULL); msg->item.nameid = atoi(data);
Sql_GetData(sql_handle,12, &data, NULL); msg->item.refine = atoi(data);
Sql_GetData(sql_handle,13, &data, NULL); msg->item.attribute = atoi(data);
Sql_GetData(sql_handle,14, &data, NULL); msg->item.identify = atoi(data);
Sql_GetData(sql_handle,15, &data, NULL); msg->item.serial = (unsigned int)atol(data);
msg->item.expire_time = 0;
msg->item.bound = 0;
msg->item.favorite = 0;
for( j = 0; j < MAX_SLOTS; j++ )
{
Sql_GetData(sql_handle,16 + j, &data, NULL);
msg->item.card[j] = atoi(data);
}
}
StringBuf_Destroy(&buf);
Sql_FreeResult(sql_handle);
return true;
}
示例5: chmapif_parse_req_saveskillcooldown
//Request to save skill cooldown data
int chmapif_parse_req_saveskillcooldown(int fd){
if( RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2) )
return 0;
else {
int count, aid, cid;
aid = RFIFOL(fd,4);
cid = RFIFOL(fd,8);
count = RFIFOW(fd,12);
if( count > 0 )
{
struct skill_cooldown_data data;
StringBuf buf;
int i;
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "INSERT INTO `%s` (`account_id`, `char_id`, `skill`, `tick`) VALUES ", schema_config.skillcooldown_db);
for( i = 0; i < count; ++i )
{
memcpy(&data,RFIFOP(fd,14+i*sizeof(struct skill_cooldown_data)),sizeof(struct skill_cooldown_data));
if( i > 0 )
StringBuf_AppendStr(&buf, ", ");
StringBuf_Printf(&buf, "('%d','%d','%d','%d')", aid, cid, data.skill_id, data.tick);
}
if( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
Sql_ShowDebug(sql_handle);
StringBuf_Destroy(&buf);
}
RFIFOSKIP(fd, RFIFOW(fd, 2));
}
return 1;
}
示例6: inter_accreg_tosql
//--------------------------------------------------------
// Save registry to sql
int inter_accreg_tosql(uint32 account_id, uint32 char_id, struct accreg* reg, int type)
{
StringBuf buf;
int i;
if( account_id <= 0 )
return 0;
reg->account_id = account_id;
reg->char_id = char_id;
//`global_reg_value` (`type`, `account_id`, `char_id`, `str`, `value`)
switch( type ) {
case 3: //Char Reg
if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `type`=3 AND `char_id`='%d'", schema_config.reg_db, char_id) )
Sql_ShowDebug(sql_handle);
account_id = 0;
break;
case 2: //Account Reg
if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `type`=2 AND `account_id`='%d'", schema_config.reg_db, account_id) )
Sql_ShowDebug(sql_handle);
char_id = 0;
break;
case 1: //Account2 Reg
ShowError("inter_accreg_tosql: Char server shouldn't handle type 1 registry values (##). That is the login server's work!\n");
return 0;
default:
ShowError("inter_accreg_tosql: Invalid type %d\n", type);
return 0;
}
if( reg->reg_num <= 0 )
return 0;
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "INSERT INTO `%s` (`type`,`account_id`,`char_id`,`str`,`value`) VALUES ", schema_config.reg_db);
for( i = 0; i < reg->reg_num; ++i ) {
struct global_reg* r = ®->reg[i];
if( r->str[0] != '\0' && r->value[0] != '\0' ) {
char str[32];
char val[256];
if( i > 0 )
StringBuf_AppendStr(&buf, ",");
Sql_EscapeString(sql_handle, str, r->str);
Sql_EscapeString(sql_handle, val, r->value);
StringBuf_Printf(&buf, "('%d','%d','%d','%s','%s')", type, account_id, char_id, str, val);
}
}
if( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) ) {
Sql_ShowDebug(sql_handle);
}
StringBuf_Destroy(&buf);
return 1;
}
示例7: auction_save
void auction_save(struct auction_data *auction)
{
int j;
StringBuf buf;
SqlStmt* stmt;
if( !auction )
return;
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "UPDATE `%s` SET `seller_id` = '%d', `seller_name` = ?, `buyer_id` = '%d', `buyer_name` = ?, `price` = '%d', `buynow` = '%d', `hours` = '%d', `timestamp` = '%lu', `nameid` = '%hu', `item_name` = ?, `type` = '%d', `refine` = '%d', `attribute` = '%d'",
auction_db, auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute);
for( j = 0; j < MAX_SLOTS; j++ )
StringBuf_Printf(&buf, ", `card%d` = '%hu'", j, auction->item.card[j]);
StringBuf_Printf(&buf, " WHERE `auction_id` = '%d'", auction->auction_id);
stmt = SqlStmt_Malloc(sql_handle);
if( SQL_SUCCESS != SqlStmt_PrepareStr(stmt, StringBuf_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) )
{
SqlStmt_ShowDebug(stmt);
}
SqlStmt_Free(stmt);
StringBuf_Destroy(&buf);
}
示例8: itemdb_save_serials
void itemdb_save_serials(void)
{
struct item_data *id;
StringBuf buf;
int count = 0, i;
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "REPLACE INTO `item_serials` (`nameid`, `serial`) VALUES ");
for( i = 0; i < ARRAYLENGTH(itemdb_array); i++ )
{
id = itemdb_array[i];
if( id == NULL || itemdb_isstackable2(id) || id->last_serial == 0 || !id->changed )
continue;
if( count )
StringBuf_AppendStr(&buf, ",");
StringBuf_Printf(&buf, "('%d','%u')", id->nameid, id->last_serial);
id->changed = false;
count++;
}
if( count && SQL_ERROR == Sql_QueryStr(mmysql_handle, StringBuf_Value(&buf)) )
Sql_ShowDebug(mmysql_handle);
StringBuf_Destroy(&buf);
return;
}
示例9: auction_create
unsigned int auction_create(struct auction_data *auction)
{
int j;
StringBuf buf;
SqlStmt* stmt;
if( !auction )
return false;
auction->timestamp = time(NULL) + (auction->hours * 3600);
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "INSERT INTO `%s` (`seller_id`,`seller_name`,`buyer_id`,`buyer_name`,`price`,`buynow`,`hours`,`timestamp`,`nameid`,`item_name`,`type`,`refine`,`attribute`,`unique_id`", auction_db);
for( j = 0; j < MAX_SLOTS; j++ )
StringBuf_Printf(&buf, ",`card%d`", j);
StringBuf_Printf(&buf, ") VALUES ('%d',?,'%d',?,'%d','%d','%d','%lu','%d',?,'%d','%d','%d','%"PRIu64"'",
auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute, auction->item.unique_id);
for( j = 0; j < MAX_SLOTS; j++ )
StringBuf_Printf(&buf, ",'%d'", auction->item.card[j]);
StringBuf_AppendStr(&buf, ")");
//Unique Non Stackable Item ID
updateLastUid(auction->item.unique_id);
dbUpdateUid(sql_handle);
stmt = SqlStmt_Malloc(sql_handle);
if( SQL_SUCCESS != SqlStmt_PrepareStr(stmt, StringBuf_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) )
{
SqlStmt_ShowDebug(stmt);
auction->auction_id = 0;
}
else
{
struct auction_data *auction_;
unsigned int tick = auction->hours * 3600000;
auction->item.amount = 1;
auction->item.identify = 1;
auction->item.expire_time = 0;
auction->auction_id = (unsigned int)SqlStmt_LastInsertId(stmt);
auction->auction_end_timer = add_timer( 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);
CREATE(auction_, struct auction_data, 1);
memcpy(auction_, auction, sizeof(struct auction_data));
idb_put(auction_db_, auction_->auction_id, auction_);
}
SqlStmt_Free(stmt);
StringBuf_Destroy(&buf);
return auction->auction_id;
}
示例10: Sql_Free
/// Frees a Sql handle returned by Sql_Malloc.
void Sql_Free(Sql* self)
{
if( self )
{
Sql_FreeResult(self);
StringBuf_Destroy(&self->buf);
if( self->keepalive != INVALID_TIMER ) delete_timer(self->keepalive, Sql_P_KeepaliveTimer);
aFree(self);
}
}
示例11: guild_storage_fromsql
/// Load guild_storage data to mem
int guild_storage_fromsql(int guild_id, struct guild_storage* p)
{
StringBuf buf;
struct item* item;
char* data;
int i;
int j;
memset(p, 0, sizeof(struct guild_storage)); //clean up memory
p->storage_amount = 0;
p->guild_id = guild_id;
// storage {`guild_id`/`id`/`nameid`/`amount`/`equip`/`identify`/`refine`/`attribute`/`card0`/`card1`/`card2`/`card3`}
StringBuf_Init(&buf);
StringBuf_AppendStr(&buf, "SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`");
for( j = 0; j < MAX_SLOTS; ++j )
StringBuf_Printf(&buf, ",`card%d`", j);
StringBuf_Printf(&buf, " FROM `%s` WHERE `guild_id`='%d' ORDER BY `nameid`", guild_storage_db, guild_id);
if( SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf)) )
Sql_ShowDebug(sql_handle);
StringBuf_Destroy(&buf);
for( i = 0; i < MAX_GUILD_STORAGE && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i )
{
item = &p->items[i];
Sql_GetData(sql_handle, 0, &data, NULL);
item->id = atoi(data);
Sql_GetData(sql_handle, 1, &data, NULL);
item->nameid = atoi(data);
Sql_GetData(sql_handle, 2, &data, NULL);
item->amount = atoi(data);
Sql_GetData(sql_handle, 3, &data, NULL);
item->equip = atoi(data);
Sql_GetData(sql_handle, 4, &data, NULL);
item->identify = atoi(data);
Sql_GetData(sql_handle, 5, &data, NULL);
item->refine = atoi(data);
Sql_GetData(sql_handle, 6, &data, NULL);
item->attribute = atoi(data);
item->expire_time = 0;
for( j = 0; j < MAX_SLOTS; ++j )
{
Sql_GetData(sql_handle, 7+j, &data, NULL);
item->card[j] = atoi(data);
}
}
p->storage_amount = i;
Sql_FreeResult(sql_handle);
ShowInfo("guild storage load complete from DB - id: %d (total: %d)\n", guild_id, p->storage_amount);
return 0;
}
示例12: Sql_Free
void Sql_Free(Sql_t* self)
{
if( self )
{
mysql_close(&self->handle);
Sql_FreeResult(self);
StringBuf_Destroy(&self->buf);
if( self->keepalive != CTaskMgr::TASK_INVALID ) CTaskMgr::getInstance()->RemoveTask("Sql_P_KeepAliveTimer");
aFree(self);
}
}
示例13: mail_DeleteAttach
/*==========================================
* Client Attachment Request
*------------------------------------------*/
static bool mail_DeleteAttach(int mail_id)
{
StringBuf buf;
int i;
StringBuf_Init(&buf);
StringBuf_Printf(&buf, "UPDATE `%s` SET `zeny` = '0', `nameid` = '0', `amount` = '0', `refine` = '0', `attribute` = '0', `identify` = '0', `unique_id` = '0'", mail_db);
for (i = 0; i < MAX_SLOTS; i++)
StringBuf_Printf(&buf, ", `card%d` = '0'", i);
StringBuf_Printf(&buf, " WHERE `id` = '%d'", mail_id);
if(SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf))) {
Sql_ShowDebug(sql_handle);
StringBuf_Destroy(&buf);
return false;
}
StringBuf_Destroy(&buf);
return true;
}
示例14: ext_storage_fromsql
// DB -> storage data conversion
int ext_storage_fromsql(int account_id, struct extra_storage_data *p)
{
StringBuf buf;
struct item* item;
char* data;
int i;
int j;
memset(p, 0, sizeof(struct extra_storage_data)); //clean up memory
p->storage_amount = 0;
// storage {`account_id`/`id`/`nameid`/`amount`/`equip`/`identify`/`refine`/`attribute`/`card0`/`card1`/`card2`/`card3`}
StringBuf_Init(&buf);
StringBuf_AppendStr(&buf, "SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`expire_time`,`unique_id`,`bound`");
for( j = 0; j < MAX_SLOTS; ++j )
StringBuf_Printf(&buf, ",`card%d`", j);
StringBuf_Printf(&buf, " FROM `%s` WHERE `account_id`='%d' ORDER BY `nameid`", rentstorage_db, account_id);
if( SQL_ERROR == Sql_Query(sql_handle, StringBuf_Value(&buf)) )
Sql_ShowDebug(sql_handle);
StringBuf_Destroy(&buf);
for( i = 0; i < MAX_EXTRA_STORAGE && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i )
{
item = &p->items[i];
Sql_GetData(sql_handle, 0, &data, NULL); item->id = atoi(data);
Sql_GetData(sql_handle, 1, &data, NULL); item->nameid = atoi(data);
Sql_GetData(sql_handle, 2, &data, NULL); item->amount = atoi(data);
Sql_GetData(sql_handle, 3, &data, NULL); item->equip = atoi(data);
Sql_GetData(sql_handle, 4, &data, NULL); item->identify = atoi(data);
Sql_GetData(sql_handle, 5, &data, NULL); item->refine = atoi(data);
Sql_GetData(sql_handle, 6, &data, NULL); item->attribute = atoi(data);
Sql_GetData(sql_handle, 7, &data, NULL); item->expire_time = (unsigned int)atoi(data);
Sql_GetData(sql_handle, 8, &data, NULL); item->unique_id = strtoull(data, NULL, 10);
Sql_GetData(sql_handle, 9, &data, NULL); item->bound = atoi(data);
for( j = 0; j < MAX_SLOTS; ++j )
{
Sql_GetData(sql_handle, 10+j, &data, NULL); item->card[j] = atoi(data);
}
}
p->storage_amount = i;
Sql_FreeResult(sql_handle);
ShowInfo("rentstorage load complete from DB - id: %d (total: %d)\n", account_id, p->storage_amount);
return 1;
}
示例15: SqlStmt_Free
/// Frees a SqlStmt returned by SqlStmt_Malloc.
void SqlStmt_Free(SqlStmt* self)
{
if( self )
{
SqlStmt_FreeResult(self);
StringBuf_Destroy(&self->buf);
mysql_stmt_close(self->stmt);
if( self->params )
aFree(self->params);
if( self->columns )
{
aFree(self->columns);
aFree(self->column_lengths);
}
aFree(self);
}
}