Jump to content
  • 0

query_sql change 128rows to more


mleo1

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  123
  • Reputation:   4
  • Joined:  11/21/11
  • Last Seen:  

http://rathena.org/wiki/Query_sql

this only returns 128. How to change array size? I want to have 500rows or more

tried

set .@nb, query_sql("SELECT name, fame FROM `char` ORDER BY fame DESC", .@name$, .@fame);
mes "Hall Of Fame";
for(set .@i,1; .@i <= .@nb; set .@i,.@i+1)
mes .@i+". "+.@name$[.@i-1]+" ("+.@fame[.@i-1]+")";

Sorry for the bad english.

Edited by mleo1
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

trunk/src/map/script.c

/// Maximum amount of elements in script arrays
#define SCRIPT_MAX_ARRAYSIZE 128

you can try increase the size, but i dunno how far it can extend..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  123
  • Reputation:   4
  • Joined:  11/21/11
  • Last Seen:  

I got what I want, I just needed to see all the rows. But thanks for the support again Emistry xD.

just sharing

mes "Test";
set .@start, 0;
while(1){		
	set .@nb, query_sql("SELECT `name` FROM `char` ORDER BY `char_id` LIMIT " +.@start+ ",128", .@name$);
	if(.@nb==0)
		break;

	mes (.@start+1) +" to "+ (.@start+128);
	for(set .@i,1; .@i <= .@nb; set .@i,.@i+1)
		mes (.@i+.@start) +". "+ .@name$[.@i-1];

	deletearray .@name$, getarraysize(.@name$);
	set .@start, .@start+128;
	next;
}
close;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

the answer is OFFSET

select * from mob_db limit 10 OFFSET 5;

but yeah ... putting a limit 5,5 also works, like you did

select * from mob_db limit 5,10;

  • Upvote 1
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...