mysql_info: what is it?

Started by KAKAN, Mar 04, 2016, 06:24 PM

Previous topic - Next topic

KAKAN

Well, I was updating the wiki, so I choose to update the MySQL functions first. I edited some, then came to the mysql_info function, I connected to the database and tried doing this:
print( mysql_info( handler ) );It gave me null.
Then I tried searching it in the MySQL website. Got this:
http://dev.mysql.com/doc/refman/5.0/en/mysql-info.html
So, after reading that, I came back to the script, did some queries and then tried the mysql_info, but it still gave me null. What am I doing wrong? How can I fix that?
oh no

KAKAN

oh no

MacTavish


Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Coolkid

R u updating wiki or this is for your server

KAKAN

Quote from: Coolkid on Mar 04, 2016, 07:31 PMR u updating wiki or this is for your server
Updating wiki, and as well, it would help me with my server.
And also, this is for helping, not for asking questions like that

@Kusanagi I also gave a link to the official MySQL webpage for that function, and tried the same way and followed your link too, still then, it returns null
oh no

Thijn

Works fine here:
[SCRIPT]  Rows matched: 1  Changed: 1  Warnings: 0
Doing the query twice, which means the row is already changed returns
[SCRIPT]  Rows matched: 1  Changed: 0  Warnings: 0

Just make sure you actually do the queries the manual says:
QuoteINSERT INTO ... SELECT ...

String format: Records: 100 Duplicates: 0 Warnings: 0

INSERT INTO ... VALUES (...),(...),(...)...

String format: Records: 3 Duplicates: 0 Warnings: 0

LOAD DATA INFILE ...

String format: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0

ALTER TABLE

String format: Records: 3 Duplicates: 0 Warnings: 0

UPDATE

function onScriptLoad( )
{
local conn = mysql_connect("localhost", "test", "test", "test");
if ( conn ) {
mysql_query(conn, "UPDATE benchmark SET testFloat = 123.45 WHERE testInt = 0");
print( mysql_info(conn) );
}
}

KAKAN

Quote from: Thijn on Mar 04, 2016, 08:21 PMWorks fine here:
[SCRIPT]  Rows matched: 1  Changed: 1  Warnings: 0
Doing the query twice, which means the row is already changed returns
[SCRIPT]  Rows matched: 1  Changed: 0  Warnings: 0

Just make sure you actually do the queries the manual says:
QuoteINSERT INTO ... SELECT ...

String format: Records: 100 Duplicates: 0 Warnings: 0

INSERT INTO ... VALUES (...),(...),(...)...

String format: Records: 3 Duplicates: 0 Warnings: 0

LOAD DATA INFILE ...

String format: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0

ALTER TABLE

String format: Records: 3 Duplicates: 0 Warnings: 0

UPDATE

function onScriptLoad( )
{
local conn = mysql_connect("localhost", "test", "test", "test");
if ( conn ) {
mysql_query(conn, "UPDATE benchmark SET testFloat = 123.45 WHERE testInt = 0");
print( mysql_info(conn) );
}
}
I tried this:
function onScriptLoad(){
local conn = mysql_connect("localhost","test","test","vcmp");
if( !conn ) return;
mysql_query(conn,format("INSERT INTO Bans(name,uid,ip) VALUES('%s','%s','%s')","KAKAN","something","127.0.0.1" ) );
print( mysql_info( conn ) );
}
Giving the result as null
oh no

Stormeus

#7
@KAKAN Read the MySQL documentation more closely.
Quotemysql_info() returns a non-NULL value for INSERT ... VALUES only for the multiple-row form of the statement (that is, only if multiple value lists are specified).