summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
Diffstat (limited to 'src/char')
-rw-r--r--src/char/char.c2
-rw-r--r--src/char/int_elemental.c2
-rw-r--r--src/char/int_guild.c2
-rw-r--r--src/char/int_homun.c2
-rw-r--r--src/char/int_mercenary.c2
-rw-r--r--src/char/int_party.c5
-rw-r--r--src/char/int_pet.c2
7 files changed, 8 insertions, 9 deletions
diff --git a/src/char/char.c b/src/char/char.c
index f5a75964c..6e0f5363e 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1588,7 +1588,7 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag
}
#endif
//Retrieve the newly auto-generated char id
- char_id = (int)SQL->NumRows(sql_handle);
+ char_id = (int)SQL->LastInsertId(sql_handle);
//Give the char the default items
for (k = 0; k < ARRAYLENGTH(start_items) && start_items[k] != 0; k += 2) {
diff --git a/src/char/int_elemental.c b/src/char/int_elemental.c
index 807924941..53a63a212 100644
--- a/src/char/int_elemental.c
+++ b/src/char/int_elemental.c
@@ -29,7 +29,7 @@ bool mapif_elemental_save(struct s_elemental* ele) {
flag = false;
}
else
- ele->elemental_id = (int)SQL->NumRows(sql_handle);
+ ele->elemental_id = (int)SQL->LastInsertId(sql_handle);
} else if( SQL_ERROR == SQL->Query(sql_handle,
"UPDATE `elemental` SET `char_id` = '%d', `class` = '%d', `mode` = '%d', `hp` = '%d', `sp` = '%d',"
"`max_hp` = '%d', `max_sp` = '%d', `atk1` = '%d', `atk2` = '%d', `matk` = '%d', `aspd` = '%d', `def` = '%d',"
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index d9d89206b..b666cadae 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -150,7 +150,7 @@ int inter_guild_tosql(struct guild *g,int flag)
}
else
{
- g->guild_id = (int)SQL->NumRows(sql_handle);
+ g->guild_id = (int)SQL->LastInsertId(sql_handle);
new_guild = 1;
}
}
diff --git a/src/char/int_homun.c b/src/char/int_homun.c
index f06ace0b2..6e4f63849 100644
--- a/src/char/int_homun.c
+++ b/src/char/int_homun.c
@@ -104,7 +104,7 @@ bool mapif_homunculus_save(struct s_homunculus* hd)
}
else
{
- hd->hom_id = (int)SQL->NumRows(sql_handle);
+ hd->hom_id = (int)SQL->LastInsertId(sql_handle);
}
}
else
diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c
index 11cc47062..aecb3844a 100644
--- a/src/char/int_mercenary.c
+++ b/src/char/int_mercenary.c
@@ -81,7 +81,7 @@ bool mapif_mercenary_save(struct s_mercenary* merc)
flag = false;
}
else
- merc->mercenary_id = (int)SQL->NumRows(sql_handle);
+ merc->mercenary_id = (int)SQL->LastInsertId(sql_handle);
}
else if( SQL_ERROR == SQL->Query(sql_handle,
"UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `hp` = '%d', `sp` = '%d', `kill_counter` = '%u', `life_time` = '%u' WHERE `mer_id` = '%d'",
diff --git a/src/char/int_party.c b/src/char/int_party.c
index 7f99590ab..29b00e0a9 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -150,7 +150,7 @@ int inter_party_tosql(struct party *p, int flag, int index)
Sql_ShowDebug(sql_handle);
return 0;
}
- party_id = p->party_id = (int)SQL->NumRows(sql_handle);
+ party_id = p->party_id = (int)SQL->LastInsertId(sql_handle);
}
if( flag & PS_BASIC )
@@ -295,8 +295,7 @@ struct party_data* search_partyname(char* str)
SQL->EscapeStringLen(sql_handle, esc_name, str, safestrnlen(str, NAME_LENGTH));
if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `party_id` FROM `%s` WHERE `name`='%s'", party_db, esc_name) )
Sql_ShowDebug(sql_handle);
- else if( SQL_SUCCESS == SQL->NextRow(sql_handle) )
- {
+ else if( SQL_SUCCESS == SQL->NextRow(sql_handle) ) {
SQL->GetData(sql_handle, 0, &data, NULL);
p = inter_party_fromsql(atoi(data));
}
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index 8d523a133..2867aed77 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -39,7 +39,7 @@ int inter_pet_tosql(int pet_id, struct s_pet* p)
Sql_ShowDebug(sql_handle);
return 0;
}
- p->pet_id = (int)SQL->NumRows(sql_handle);
+ p->pet_id = (int)SQL->LastInsertId(sql_handle);
}
else
{// Update pet.