Jump to content
  • 0

sql query eathena -> rathena


Anime s2

Question


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  68
  • Reputation:   6
  • Joined:  11/29/13
  • Last Seen:  

Some commands that stopped working after I migrated to  rathena

 

eathena:

query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+.@names$+"'",#ACCOUNT__ID);

 

query_sql "UPDATE `login` SET `BLOCK_PJ` = '0' WHERE `account_id` = '"+#ACCOUNT__ID+"'";

 

query_sql ("SELECT `BLOCK_PJ` FROM `login` WHERE `account_id`='"+getcharid(3)+"'", .@BAN$);

 

query_sql "INSERT INTO `broadcast`(`name`,`last__broadcast`) VALUES ('"+strcharinfo(0)+"','"+@Megaphone$+"')";

 

query_sql ("SELECT `name`,`last__broadcast` FROM `broadcast` ORDER BY `ID__MSJ` DESC LIMIT 10", .@NAMES$[0] , .@MSJS$[0]);

 

query_sql "SELECT `char`.char_id,`char`.`name`,global_reg_value.`value` FROM global_reg_value LEFT JOIN `char` ON global_reg_value.char_id=`char`.char_id WHERE global_reg_value.str='fallsdoei' ORDER BY CAST(`global_reg_value`.`value` AS UNSIGNED) DESC LIMIT 10", .@char_id, .@name$, .@count;

 

set @nb,query_sql("INSERT INTO `itemizer` VALUES(NULL,'"+ escape_sql(@ep_item_id) +"','"+ escape_sql(@ep_item_count) +"','"+ escape_sql(getitemname(@ep_item_id)) +"','"+ escape_sql(getcharid(0)) +"','"+ escape_sql(strcharinfo(0)) +"','N/A','"+ escape_sql(strcharinfo(0)) +"','"+ escape_sql(@when$) +"','gm','1')");

 

set @result,query_sql("SELECT `id`,`item_id`,`item_name`,`item_amount`,`reason`,`by_gm` FROM `itemizer` WHERE (`char_id` = '"+ getcharid(0) +"' AND `for` = 'player' AND `collected` = 0) LIMIT 127",

 

set @nb,query_sql("UPDATE `itemizer` SET `collected` = 1 WHERE (`id` = '"+ @db_id[@choice] +"') LIMIT 1");

 

set @result,query_sql("SELECT `item_name`,`item_amount`,`reason`,`by_gm`,`when` FROM `itemizer` WHERE (`char_id` = '"+ getcharid(0) +"' AND `for` = 'player' AND `collected` = 1) ORDER BY `when` DESC LIMIT "+ @offset +","+ @rows_per_page,

 

query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '"+ .@guild_id +"'",.@guild_lv;

 

query_sql "SELECT `guild_id` FROM `guild` WHERE `name` = '" +escape_sql(.@guildname$) +"'", .@guildid;

 

        query_sql "SELECT `char`.char_id,`char`.`name`,global_reg_value.`value` FROM global_reg_value LEFT JOIN `char` ON global_reg_value.char_id=`char`.char_id WHERE global_reg_value.str='bempcount' ORDER BY CAST(`global_reg_value`.`value` AS UNSIGNED) DESC LIMIT 10", .@char_id, .@name$, .@count;

        query_sql "SELECT `char`.char_id,`char`.`name`,global_reg_value.`value` FROM global_reg_value LEFT JOIN `char` ON global_reg_value.char_id=`char`.char_id WHERE global_reg_value.str='showbrokeemp' ORDER BY CAST(`global_reg_value`.`value` AS UNSIGNED) DESC LIMIT 10", .@char_id, .@name2$, .@count2;

 

query_sql "SELECT COUNT(castle_id) FROM guild_castle WHERE guild_id="+getcharid(2), .@count;

 

query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;

 

db is complete with all the tables (eAthena + rathena+custom)

 

sry for my bad english

Anyone?

Edited by Anime s2
Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   38
  • Joined:  04/28/13
  • Last Seen:  

Same:

query_sql "SELECT refineable FROM item_db WHERE id = '"+.@ID+"'",.@ref;

to

query_sql "SELECT refineable FROM item_db WHERE id = "+.@ID+";",.@ref;

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

https://rathena.org/board/topic/102946-script-engine-upgrade/

You only need to update the query for global_reg_value the others query should working

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   38
  • Joined:  04/28/13
  • Last Seen:  

try:
query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+.@names$+"'",#ACCOUNT__ID);
 
to:
query_sql "SELECT account_id FROM char WHERE name = "+.@names$+";",#ACCOUNT__ID;
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  68
  • Reputation:   6
  • Joined:  11/29/13
  • Last Seen:  

https://rathena.org/board/topic/102946-script-engine-upgrade/

You only need to update the query for global_reg_value the others query should working

 

https://rathena.org/board/topic/102946-script-engine-upgrade/

You only need to update the query for global_reg_value the others query should working

Done, but still bugged.

                set .@ID,1101;

                query_sql "SELECT `slots` FROM `item_db` WHERE `id` = '"+.@ID+"'".@slots;

 

// .@ID = sword [5]

 

Result: show "0" slots (.@slots)

Edited by Anime s2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   38
  • Joined:  04/28/13
  • Last Seen:  

query_sql "SELECT `slots` FROM `item_db` WHERE `id` = '"+.@ID+"'".@slots;

to

query_sql "SELECT slots FROM item_db WHERE id = "+.@ID+";",.@slots;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  68
  • Reputation:   6
  • Joined:  11/29/13
  • Last Seen:  

ok, i found a way to get item slot. (getiteminfo)

 

                set .@ID,5013;
                query_sql "SELECT refineable FROM item_db WHERE id = '"+.@ID+"'",.@ref;
                mes .@ref; )

 

query_sql "SELECT `slots` FROM `item_db` WHERE `id` = '"+.@ID+"'".@slots;

to

query_sql "SELECT slots FROM item_db WHERE id = "+.@ID+";",.@slots;

ok, i found a way to get item slot. (getiteminfo)

 

           @Promise

 

                set .@ID,5013;
                query_sql "SELECT refineable FROM item_db WHERE id = '"+.@ID+"'",.@ref;
                mes .@ref; (show 0)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  68
  • Reputation:   6
  • Joined:  11/29/13
  • Last Seen:  

bug on ramod, sry

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...