ExecuteSQLCreateTable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
The actual SQL query that is executed will be the following:
The actual SQL query that is executed will be the following:


<pre>CREATE <table> IF NOT EXISTS</pre>
<pre>CREATE TABLE IF NOT EXISTS <table> <definition></pre>


==Syntax==  
==Syntax==  
Line 13: Line 13:
===Required Arguments===  
===Required Arguments===  
*'''table:''' The table you want to create.
*'''table:''' The table you want to create.
*'''definition:''' The definition of the table, this includes the column definitions and constraints in SQL syntax. For each column definition, you start with the name (without any spaces), optionally followed by the [http://www.sqlite.org/datatype3.html SQL data type] and constraint (all separated by spaces). Each column definition is separated by a comma (,) (e.g. ''field1,field2,field3'' or ''field1 INTEGER,field2 TEXT'' as definition). Please refer to the [http://www.sqlite.org/lang_createtable.html SQLite SQL documentation] for more information on creating even more complex tables.


===Returns===
===Returns===

Revision as of 19:43, 22 September 2006

This function creates a table in the registry if it does not already exist. This function should be used in the initialization step of any script that uses SQL registry functions to write to a table, because that table may not exist yet if the script is run for the first time.

The actual SQL query that is executed will be the following:

CREATE TABLE IF NOT EXISTS <table> <definition>

Syntax

nil createRegistryTable ( string table )

Required Arguments

  • table: The table you want to create.
  • definition: The definition of the table, this includes the column definitions and constraints in SQL syntax. For each column definition, you start with the name (without any spaces), optionally followed by the SQL data type and constraint (all separated by spaces). Each column definition is separated by a comma (,) (e.g. field1,field2,field3 or field1 INTEGER,field2 TEXT as definition). Please refer to the SQLite SQL documentation for more information on creating even more complex tables.

Returns

The function doesn't return anything.

See Also