Modules/MySQL/MysqlDestroy: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
==Description==
This functions closes the MySQL connection that is currently opened, if there is one.
This functions closes the MySQL connection that is currently opened, if it exists.


This function is provided by the '''ml_mysql''' module.
This function is provided by the [[Module functions|ml_mysql]] module.


==Syntax==
==Syntax==
nil mysqlClose ( [[mysql]] object )
<syntaxhighlight lang="lua">nil mysqlClose ( mysql db )</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''mysql''' : The [[mysql]] object created by [[mysqlOpen]]
*'''db''' : The [[mysql]] object created by [[mysqlOpen]]


===Optional Arguments===
===Optional Arguments===


''None''
''None''
==Example==
function onMySQLOpen ( my_mysql, result )
  if ( result )
    -- do something useful.
    mysqlClose ( my_mysql );
  else
    -- panic.
  end
end
<...>
mysqlOpen ( "onMySQLOpen", "localhost", "user123", "mypassword", "testdatabase", 3306 );

Revision as of 01:26, 1 November 2006

Description

This functions closes the MySQL connection that is currently opened, if it exists.

This function is provided by the ml_mysql module.

Syntax

nil mysqlClose ( mysql db )

Required Arguments

Optional Arguments

None