summaryrefslogtreecommitdiff
path: root/src/char/int_pet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/int_pet.c')
-rw-r--r--src/char/int_pet.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index 311ccd4be..8d523a133 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -24,13 +24,13 @@ int inter_pet_tosql(int pet_id, struct s_pet* p)
//`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`)
char esc_name[NAME_LENGTH*2+1];// escaped pet name
- Sql_EscapeStringLen(sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH));
+ SQL->EscapeStringLen(sql_handle, esc_name, p->name, strnlen(p->name, NAME_LENGTH));
p->hungry = cap_value(p->hungry, 0, 100);
p->intimate = cap_value(p->intimate, 0, 1000);
if( pet_id == -1 )
{// New pet.
- if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` "
+ if( SQL_ERROR == SQL->Query(sql_handle, "INSERT INTO `%s` "
"(`class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`) "
"VALUES ('%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
pet_db, p->class_, esc_name, p->account_id, p->char_id, p->level, p->egg_id,
@@ -39,11 +39,11 @@ int inter_pet_tosql(int pet_id, struct s_pet* p)
Sql_ShowDebug(sql_handle);
return 0;
}
- p->pet_id = (int)Sql_LastInsertId(sql_handle);
+ p->pet_id = (int)SQL->NumRows(sql_handle);
}
else
{// Update pet.
- if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%d',`equip`='%d',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incuvate`='%d' WHERE `pet_id`='%d'",
+ if( SQL_ERROR == SQL->Query(sql_handle, "UPDATE `%s` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%d',`equip`='%d',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incuvate`='%d' WHERE `pet_id`='%d'",
pet_db, p->class_, esc_name, p->account_id, p->char_id, p->level, p->egg_id,
p->equip, p->intimate, p->hungry, p->rename_flag, p->incuvate, p->pet_id) )
{
@@ -69,28 +69,28 @@ int inter_pet_fromsql(int pet_id, struct s_pet* p)
//`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`)
- if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate` FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) )
+ if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate` FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) )
{
Sql_ShowDebug(sql_handle);
return 0;
}
- if( SQL_SUCCESS == Sql_NextRow(sql_handle) )
+ if( SQL_SUCCESS == SQL->NextRow(sql_handle) )
{
p->pet_id = pet_id;
- Sql_GetData(sql_handle, 1, &data, NULL); p->class_ = atoi(data);
- Sql_GetData(sql_handle, 2, &data, &len); memcpy(p->name, data, min(len, NAME_LENGTH));
- Sql_GetData(sql_handle, 3, &data, NULL); p->account_id = atoi(data);
- Sql_GetData(sql_handle, 4, &data, NULL); p->char_id = atoi(data);
- Sql_GetData(sql_handle, 5, &data, NULL); p->level = atoi(data);
- Sql_GetData(sql_handle, 6, &data, NULL); p->egg_id = atoi(data);
- Sql_GetData(sql_handle, 7, &data, NULL); p->equip = atoi(data);
- Sql_GetData(sql_handle, 8, &data, NULL); p->intimate = atoi(data);
- Sql_GetData(sql_handle, 9, &data, NULL); p->hungry = atoi(data);
- Sql_GetData(sql_handle, 10, &data, NULL); p->rename_flag = atoi(data);
- Sql_GetData(sql_handle, 11, &data, NULL); p->incuvate = atoi(data);
-
- Sql_FreeResult(sql_handle);
+ SQL->GetData(sql_handle, 1, &data, NULL); p->class_ = atoi(data);
+ SQL->GetData(sql_handle, 2, &data, &len); memcpy(p->name, data, min(len, NAME_LENGTH));
+ SQL->GetData(sql_handle, 3, &data, NULL); p->account_id = atoi(data);
+ SQL->GetData(sql_handle, 4, &data, NULL); p->char_id = atoi(data);
+ SQL->GetData(sql_handle, 5, &data, NULL); p->level = atoi(data);
+ SQL->GetData(sql_handle, 6, &data, NULL); p->egg_id = atoi(data);
+ SQL->GetData(sql_handle, 7, &data, NULL); p->equip = atoi(data);
+ SQL->GetData(sql_handle, 8, &data, NULL); p->intimate = atoi(data);
+ SQL->GetData(sql_handle, 9, &data, NULL); p->hungry = atoi(data);
+ SQL->GetData(sql_handle, 10, &data, NULL); p->rename_flag = atoi(data);
+ SQL->GetData(sql_handle, 11, &data, NULL); p->incuvate = atoi(data);
+
+ SQL->FreeResult(sql_handle);
p->hungry = cap_value(p->hungry, 0, 100);
p->intimate = cap_value(p->intimate, 0, 1000);
@@ -115,7 +115,7 @@ void inter_pet_sql_final(void){
int inter_pet_delete(int pet_id){
ShowInfo("delete pet request: %d...\n",pet_id);
- if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) )
+ if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `pet_id`='%d'", pet_db, pet_id) )
Sql_ShowDebug(sql_handle);
return 0;
}