[Plugin] [REL] MySQL Plugin (Now on github!)

I'm just using the latest download. I'm running windows 7 64 bit(could that be the problem?)
Reply

No, just install that: http://www.microsoft.com/en-us/downl....aspx?id=30679
Do you also have the libmysql.dll in the right place?
Reply

Ah thank you so much. x86 version worked.
Reply

In regards to documentation, why do you need to use the SA-MP wiki? I don't think the SA-MP wiki should be used to document plugins - only SA-MP itself. Can't you get your own wiki, or just document it in a post? That being said, I have a wiki account so could help with documentation.
Reply

Good idea, I'll create an own wiki.
Why use the SA-MP wiki?
https://sampwiki.blast.hk/wiki/MySQL
Thats why. But let's just leave this as the documentation for the older plugins which still support unthreaded queries.
Reply

Use ****** code wiki no?
Reply

That would be too overkill. If I'd use the ****** code wiki, there would be 26 pages for each function (and 44 pages with R33!). And as you can currently see if you look at the wiki, that would just look disgusting.
I also don't like the syntax there, there is almost no chance to make it look like in the SA-MP wiki (which is my goal).
Reply

You could just get a free wiki.

Anyway, when using R7, I did this to retrieve the rows in a while loop and put them in a string with delimiters:

pawn Код:
while(mysql_fetch_row_format(dest))
but that doesn't seem to work in R29 (mysql_fetch_row_format doesn't seem to return a value). How would I (using cache) go through every row and get a string with delimiters as a result? Hope you understand what I mean.
Reply

Quote:
Originally Posted by MP2
Посмотреть сообщение
You could just get a free wiki.

Anyway, when using R7, I did this to retrieve the rows in a while loop and put them in a string with delimiters:

pawn Код:
while(mysql_fetch_row_format(dest))
but that doesn't seem to work in R29 (mysql_fetch_row_format doesn't seem to return a value). How would I (using cache) go through every row and get a string with delimiters as a result? Hope you understand what I mean.
Load the string with cache_get_row() and use sscanf to split the string.
Reply

Quote:
Originally Posted by MP2
Посмотреть сообщение
You could just get a free wiki.

Anyway, when using R7, I did this to retrieve the rows in a while loop and put them in a string with delimiters:

pawn Код:
while(mysql_fetch_row_format(dest))
but that doesn't seem to work in R29 (mysql_fetch_row_format doesn't seem to return a value). How would I (using cache) go through every row and get a string with delimiters as a result? Hope you understand what I mean.
Use
pawn Код:
while(mysql_retrieve_row()) {
    mysql_fetch_row_format(dest);
    //other code
}
or
pawn Код:
for(new r=0; r < cache_num_rows(); ++r) {
    new dest[1024];
    for(new f=0; f < cache_num_fields(); f++) {
        if(f != 0) {
            strcat(destination, "|");
           
        }
        new row_val_tmp[256];
        cache_get_row(r, f, row_val_tmp);
        if(f == 0)
            strins(dest, row_val_tmp, 0);
        else
            strcat(dest, row_val_tmp);
    }
        //here you now have your values with a | delimiter, like "1|TestName|32512|Password"
}
And also stop using R29 and switch to R31! :P
Reply

Why is it good for a mySQL plugin to use cache?
Reply

Quote:
Originally Posted by RedCrossER
Посмотреть сообщение
latest version of what?
Of the MySQL plugin (R31).

Quote:
Originally Posted by Kar
Посмотреть сообщение
I had a weird issue where mysql_affected_rows() returned -1 once.. How is this possible?

Also what would you say about transferring this project to GitHub. In all honesty its surpassed ****** project..
I also got that one day. I thought it was a bug somewhere, but I checked everything and found nothing. Then I changed the query a bit and it suddenly worked. I was sending such an INSERT-query
PHP код:
INSERT INTO test (`Field1`) VALUE ('321'
and then I replaced "VALUE" with "VALUES" and cache_affected_rows returned 1. Both queries are correct (they are both creating a new row), but only one is the real correct one.

I sent BlueG a PM some weeks ago where I asked him if he could move the project to GitHub, but didn't got an answer yet.
Reply

if using mysql_tquery, will continue keeping the cache is like using mysql_function_query?

I jump from R15 to R31, and I'm not sure how to use the new features of cache
Reply

Well mine was a update query, idk. Here see for yourself

pawn Код:
forward Check_For_Unbans();
public Check_For_Unbans()
{
    mysql_function_query(McHandle, "UPDATE `"#BAN_TABLE_NAME"` SET `"#BAN_COLUMN_EXPIRE"` = -1 WHERE `"#BAN_COLUMN_EXPIRE"` < UNIX_TIMESTAMP() AND `"#BAN_COLUMN_EXPIRE"` != 0", true, "Thread_Check_For_Unbans", "i", -1); //expires = 0 // DATE_ADD("#BAN_COLUMN_TIME_BANNED", INTERVAL "#BAN_COLUMN_TIME" SECOND) <= NOW()
    return 1;
}
THREAD:Check_For_Unbans(extraid)
{
    new count = mysql_affected_rows();
    if(count)
    {
        printf("[Server: Check_For_Unbans] - %d Banned Players Have Been Unbanned", count);
        MessageToAdmins(_, "[Server: Check_For_Unbans] - %d Banned Players Have Been Unbanned", count);
    }
    return 1;
}
Alright. Maybe you should use IRC, can message you easier there too.
Reply

PHP код:
UPDATE `"#BAN_TABLE_NAME"SET `"#BAN_COLUMN_EXPIRE"` = '-1' WHERE `"#BAN_COLUMN_EXPIRE"` < UNIX_TIMESTAMP() AND `"#BAN_COLUMN_EXPIRE"` != '0' 
Maybe this one will work? (have put the query values in ')

Yes, maybe I should use IRC. Some day.
Reply

Integers doesn't require single quotes in MySQL, only strings do.

It's fine though.

That Some Day should be soon, lol
Reply

Код:
[16:50:46] [WARNING] CMySQLHandle::Create - connection already exists
Not sure how to get rid of that. Or even whether it is a bug or not. I'm connecting to the same server, with the same credentials, from a filterscript and a gamemode at the same time.
Reply

It's not a bug. It just warns you that there is already a similar connection and then returns the connection id of the existing connection. You can simply ignore that.
Reply

pawn Код:
public OnGameModeInit()
{
    mysql_log(LOG_ERROR | LOG_WARNING);
    print("test1");
    mysql_connect(MYSQLIP, MYSQLUSER, MYSQLDB, MYSQLPASSWORD);
    print("test2");
"test1" is printed, test2 isn't however. I assume the server is hanging itself while connecting (what else?). Any ideas? My logs are empty.
Reply

Are you using the correct libmysql.dll (if on Windows)? Is the MySQL server online?
Reply


Forum Jump:


Users browsing this thread: 15 Guest(s)