mysql_fetch_field_row() stops fetching fields
#1

Hi all,

I'm having some issues with mysql_fetch_field_row().
For some reason the function only fetches a few fields, after that it simply returns empty values.

Here is a part of the log:
Код:
[07:10:48] >> mysql_store_result( Connection handle: 1 )
[07:10:48] CMySQLHandler::StoreResult() - Result was stored.
[07:10:48] >> mysql_retrieve_row( Connection handle: 1 )
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield1") - Some value
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield2") - 1
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield3") - 6
...
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield10") - Another value
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield11") - 0
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield12") - 0
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield13") - 1
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield14") - 0
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield15") - 0
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield16") - 
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield17") - 
[07:10:48] >> mysql_fetch_field_row( Connection handle: 1 )
[07:10:48] CMySQLHandler::FetchField("somefield18") -
As these logs shows, it just stops fetching values (as seen from 'somefield16') at a random point, or at least so it seems.

Part of the code:
pawn Код:
...

    mysql_store_result();
   
    if(mysql_retrieve_row())
    {
        mysql_fetch_field_row(someString1, "somefield1");
        mysql_fetch_field_row(someString2, "somefield2");
        mysql_fetch_field_row(someString3, "somefield3");
        mysql_fetch_field_row(someString4, "somefield4");

...
What could be the cause of this problem?

Thanks in advance.
Reply
#2

pawn Код:
if(mysql_retrieve_row())
{
        mysql_fetch_field_row(someString1, "somefield1");
        mysql_fetch_field_row(someString1, "somefield2");
        mysql_fetch_field_row(someString1, "somefield3");
        mysql_fetch_field_row(someString1, "somefield4");
.......
Reply
#3

I assume you are referring to the rest of the code?

It's not very significant, just some more fetch field statements as this is just some example code. ;-)

Edit
Oops, I didn't notice you changed the variables.
That's not it, you can assume that the destination variables and sources are correct.
Reply
#4

I've been playing around with it for a while, and it seems that it doesn't like having a lot of fields.

The fields I'm trying to fetch are behind a lot of other fields, so I tried selecting the fields specifically in the SELECT statement instead of SELECT *.

Although it fetches a few more fields now, it still stops at a certain point, so the problem persists.

Anybody an idea?
Reply
#5

If your code looks alright and bueno, it might be the time to take this as a flaw of the plugin. Which version are you using?

Regardless of the version, though, functions that fetch data based on the field name are hideously slow. You mention having the syntax as follows "SELECT field1,field2,field3 ...", so why not start using the newest cache functions provided by MySQL plugin R7?
Reply
#6

I'm using version R7.

The reason I'm trying to avoid selecting the fields in particular is because there are a lot of fields I'm fetching.
PAWN does not like long strings, so I would even have to start using string manipulation functions just to write the query.

Fetching fields based on names is indeed not the fastest way to do it, but with a high amount of fields it's more convenient (as in easier to manage).

Though I've not yet looked into the new cache functions.
Would they provide better ways to do this?

Edit
Just did some research on the cache functions, and it seems they might just be the answer.
I'll see if it works, thanks!
Reply
#7

As I see from the reputation details, the issue has been resolved, yay. Sorry for the late response though.

Cache functions are a lot faster, and indeed, looking at the plugin code, use a different source for the field names. But they still run comparisons and if I'm not mistaken, for lets say, 40 fields, there will be around 800 comparisons. If you knew the field index, things would go a lot smoother. But I understand where you're coming from.

Anyways, good night
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)