mariadb prepare: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
28days (talk | contribs)
No edit summary
Line 10: Line 10:
{{FuncParam|format_str|The query to prepare}}
{{FuncParam|format_str|The query to prepare}}


{{FuncReturnValue|String with sql-injection safe query}}
{{FuncReturnValue|String with sql-injection safe query, or '''false''' if there's an error in query.}}


== Example ==
== Example ==

Revision as of 17:29, 18 December 2019

mariadb prepare

Type: Function
Context: Server
Introduced: v1.0

NOTICE

This function is provided by the official MariaDB plugin.

Description

Prepares a SQL statement with SQL-injection safe query.

Syntax

mariadb_prepare(handle_id, format_str)

Parameters

  • handle_id
    The databse handle identifier
  • format_str
    The query to prepare

Return Value

  • String with sql-injection safe query, or false if there's an error in query.

Example

local query = mariadb_prepare(db, "SELECT * FROM accounts WHERE steamid = ? LIMIT 1",
    tostring(GetPlayerSteamId(player))
)
mariadb_async_query(db, query, OnAccountLoad, player)

See also