diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-23 11:47:27 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-23 11:47:27 +0000 |
commit | 8ac5438e9dabbde99abed1b77b1b7d15950fe172 (patch) | |
tree | 83bf169e3f2cacc9209c8f4c9339a61626b7173b /src/map/script.c | |
parent | 206d9e2affc46aede0fe7cfc632501273f902d5f (diff) | |
download | hercules-8ac5438e9dabbde99abed1b77b1b7d15950fe172.tar.gz hercules-8ac5438e9dabbde99abed1b77b1b7d15950fe172.tar.bz2 hercules-8ac5438e9dabbde99abed1b77b1b7d15950fe172.tar.xz hercules-8ac5438e9dabbde99abed1b77b1b7d15950fe172.zip |
* [Fixed]:
- MAPREGSQL overloading SQL table with temperory map registries.
- Incorrect perfomance calculation for MAPREGSQL loading and saving.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7310 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/map/script.c b/src/map/script.c index 8a151aba0..487f78bfa 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11682,9 +11682,10 @@ int mapreg_setreg(int num,int val) #endif if(val!=0) { - + if(idb_put(mapreg_db,num,(void*)val)) + ; #if !defined(TXT_ONLY) && defined(MAPREGSQL) - if(name[1] != '@' && idb_get(mapreg_db,num) == NULL) { + else if(name[1] != '@') { sprintf(tmp_sql,"INSERT INTO `%s`(`%s`,`%s`,`%s`) VALUES ('%s','%d','%d')",mapregsql_db,mapregsql_db_varname,mapregsql_db_index,mapregsql_db_value,jstrescapecpy(tmp_str,name),i,val); if(mysql_query(&mmysql_handle,tmp_sql)){ ShowSQL("DB error - %s\n",mysql_error(&mmysql_handle)); @@ -11692,7 +11693,6 @@ int mapreg_setreg(int num,int val) } } #endif - idb_put(mapreg_db,num,(void*)val); // else } else { // [zBuffer] #if !defined(TXT_ONLY) && defined(MAPREGSQL) @@ -11744,7 +11744,8 @@ int mapreg_setregstr(int num,const char *str) if (idb_put(mapregstr_db,num,p)) ; #if !defined(TXT_ONLY) && defined(MAPREGSQL) - else { //put returned null, so we must insert. + else if(name[1] != '@'){ //put returned null, so we must insert. + // Someone is causing a database size infinite increase here without name[1] != '@' [Lance] sprintf(tmp_sql,"INSERT INTO `%s`(`%s`,`%s`,`%s`) VALUES ('%s','%d','%s')",mapregsql_db,mapregsql_db_varname,mapregsql_db_index,mapregsql_db_value,jstrescapecpy(tmp_str,name),i,jstrescapecpy(tmp_str2,p)); if(mysql_query(&mmysql_handle,tmp_sql)){ ShowSQL("DB error - %s\n",mysql_error(&mmysql_handle)); @@ -11804,7 +11805,7 @@ static int script_load_mapreg(void) | varname | index | value | +-------------------------+ */ - int perfomance = gettick_nocache(); + unsigned int perfomance = (unsigned int)time(NULL); sprintf(tmp_sql,"SELECT * FROM `%s`",mapregsql_db); ShowInfo("Querying script_load_mapreg ...\n"); if(mysql_query(&mmysql_handle, tmp_sql) ) { @@ -11836,7 +11837,7 @@ static int script_load_mapreg(void) ShowInfo("Freeing results...\n"); mysql_free_result(sql_res); mapreg_dirty=0; - perfomance = (gettick_nocache() - perfomance) / 1000; + perfomance = ((unsigned int)time(NULL) - perfomance); ShowInfo("SQL Mapreg Loading Completed Under %d Seconds.\n",perfomance); return 0; #endif /* TXT_ONLY */ @@ -11912,10 +11913,10 @@ static int script_save_mapreg(void) mapregstr_db->foreach(mapregstr_db,script_save_mapreg_strsub,fp); lock_fclose(fp,mapreg_txt,&lock); #else - int perfomance = (int)time(NULL); + unsigned int perfomance = (unsigned int)time(NULL); mapreg_db->foreach(mapreg_db,script_save_mapreg_intsub); // [zBuffer] mapregstr_db->foreach(mapregstr_db,script_save_mapreg_strsub); - perfomance = ((int)time(NULL) - perfomance) / 1000; + perfomance = ((int)time(NULL) - perfomance); if(perfomance > 2) ShowWarning("Slow Query: MapregSQL Saving @ %d second(s).\n", perfomance); #endif |