Skip to content

compiling plugins on new_arch #10

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

D4edalus
Copy link

ifeq ($(TARGET_OS),mingw32)
fails on my mingw versions. cod4x server also uses Windows_NT to detect windows

Plugin_Scr_AddArrayKey isn't exported on windows. was that a typo for Plugin_Scr_AddArrayKeys?

bloke added 2 commits September 10, 2018 22:46
fails on my mingw versions. cod4x server also uses Windows_NT to detect windows
@thamidu
Copy link
Contributor

thamidu commented Nov 17, 2018

I have compiled with the commits you have done. But the Plugin_Scr_AddArrayKeys() doesn't seems to be working. When I call the mysql_fetch_row() aka OnScript_Fetch_Row() function (which has called Plugin_Scr_AddArrayKeys() in it) through script, it returns just an empty array.
I checked my SQL query. It is executing fine and it returns a row too.

After that I compiled again without Plugin_Scr_AddArrayKeys() function inside OnScript_Fetch_Row().

void CMySQLPlugin::OnScript_Fetch_Row()
{
    if (Plugin_Scr_GetNumParam() != 1)
    {
        Plugin_Scr_Error("Usage: mysql_fetch_row(<handle>);");
        return;
    }

    int idx = getHandleIndexForScriptArg(0);
    checkConnection(idx);
    checkQuery(idx);

    unsigned int col_count = mysql_num_fields(m_MySQLResults[idx]);
    MYSQL_ROW row = mysql_fetch_row(m_MySQLResults[idx]);

    if (row != NULL)
    {
        Plugin_Scr_MakeArray();

        mysql_field_seek(m_MySQLResults[idx], 0);
        for (unsigned int i = 0; i < col_count; ++i)
        {
            /* A little help here? I don't actually understand data
             * representation. Integer must be integer, string - string,
             * float - float */
            MYSQL_FIELD *field = mysql_fetch_fields(m_MySQLResults[idx]);
            if (field == NULL)
            {
                pluginError("Houston, we got a problem: unnamed column!");
                return;
            }
            if(row[i] == NULL)
                Plugin_Scr_AddUndefined();
            else
                Plugin_Scr_AddString(row[i]);
                
            // Plugin_Scr_AddArrayKeys(Plugin_Scr_AllocString(field->name));
        }
    }
}

Now the mysql_fetch_row() function returns the array with the row as I expected. But yes, without array keys. I think there is something wrong with the Plugin_Scr_AddArrayKeys() function.

@T-Maxxx
Copy link
Contributor

T-Maxxx commented Nov 18, 2018

This function, "Plugin_Scr_AddArrayKeys" must be changed to a "Plugin_Scr_AddArrayStringIndexed", which is a wrapper to a "Scr_AddArrayStringIndexed". These are different functions and there was error in master branch - "Plugin_Scr_AddArrayKeys" called wrong.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants