Modules/MTA-MySQL/mysql fetch lengths: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<pageclass class="#AA7592" subcaption="MTA-MySQL Module"></pageclass> | |||
__NOTOC__ | __NOTOC__ | ||
{{ModuleFunction|MTA-MySQL}} | {{ModuleFunction|MTA-MySQL}} |
Latest revision as of 18:04, 5 January 2011
This function is provided by the external module MTA-MySQL. You must install this module to use this function. | |
Returns a table containing the length of the values of the last retreived row. If you didn't retreive any row or you are in the end of the result set, it returns nil.
Syntax
table mysql_fetch_lengths ( MySQLResult result )
Required arguments
- result: A valid MySQL result
Returns
A table with the length of the values of the last retreived row.
Example
Example 1: This example shows the length of an account name
local result = mysql_query(handler, "SELECT name FROM account WHERE id='1' LIMIT 1") -- Execute the query if (result) then local row = mysql_fetch_row(result) -- Return the resulting row local lengths = mysql_fetch_lengths(result) -- Retreive the lengths of the result fields outputDebugString("The length of " .. row[1] .. " is " .. lengths[1]) mysql_free_result(result) -- Free the result end