Jump to content

Recommended Posts

Hi everybody,

 

I want do function in game source ( mysql query select )

 

my function

    int _mysql_query_select( lua_State* L ){
        SQLMsg *msg = DBManager::instance().DirectQuery(lua_tostring(L, 1));

        if (msg->uiSQLErrno != 0)
            return 0;
    
        MYSQL_RES *res = msg->Get()->pSQLResult;
    
        MYSQL_ROW row = mysql_fetch_row(res);
    
        if (!row)
            return 0;

        lua_pushstring(L, row);
        
        return 1;
    }

error


questlua_global.cpp: In function 'int quest::_mysql_query_select(lua_State*)':
questlua_global.cpp:1207: error: cannot convert 'char**' to 'const char*' for argument '2' to 'void lua_pushstring(lua_State*, const char*)'

:(

 

 

  • Love 1
Link to comment
https://metin2.dev/topic/3026-c-mysql-select-function/
Share on other sites

  • Honorable Member
  • Honorable Member

Is any way to get result from query without loop?

You have to convert the result to something acceptable for lua. Mine does it.

If you need something in particular, just write the complete request here.

NB: In your code, you're trying to push the list of all the fields of your row as string. (this is clearly not possible using a direct way like yours)

Link to comment
https://metin2.dev/topic/3026-c-mysql-select-function/#findComment-20028
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.