Jump to content
  • 0

sql query eathena -> rathena


Question

Posted (edited)

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

7 answers to this question

Recommended Posts

Posted (edited)

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
Posted

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)

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...