-
Notifications
You must be signed in to change notification settings - Fork 1
melon.sql
melon.sql
Contains everything needed to interact with multiple SQL drivers
melon

melon.sql.NewConnection() -> melon.sql.Connection
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | conn | melon.sql.Connection | The connection object |
Creates a new connection object

melon.sql.QueryParse(query: string, escape: func, values: table) -> string
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | query | string | The query to parse and convert |
| 2 | escape | func | The escape function |
| 3 | values | table | The values to be injected into the query |
| # | Name | Type | Description |
|---|---|---|---|
| 1 | query | string | The converted query |
Takes an input query with the placeholder ?? or ?<number>?, eg. SELECT * FROM ?4?, and converts it into an escaped query
The central SQL connection that handles I/O
All of these values have Set*/Get* methods for them. They can also be indexed by their name, object.*
| Name | Type | Comment |
|---|---|---|
| SupportedAdapters | table | A table of adapters each query is required to support |
| Adapter | string | The connections adapter, what kind of sql variant its using |
| Host | string | The remote host of this connection, if applicable |
| Username | string | The remote username of this connection, if applicable |
| Password | string | The password of this connection, if applicable |
| Database | string | The database of this connection, if applicable |
| Port | string | The port of this connection, if applicable |

melon.sql.Connection:QueryNoResult(adapters: table, ...values: any) -> bool?
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | adapters | table | A table of adapter keys with query values |
| 2 | ...values | any | Varargs of values to be escaped in those queries |
| # | Name | Type | Description |
|---|---|---|---|
| 1 | passed | bool | Did the query get validated successfully |
Sends a query to the connection

melon.sql.Connection:Query(done: func, adapters: table, ...values: any) -> bool?
Argument and Return information
| # | Name | Type | Description |
|---|---|---|---|
| 1 | done | func | The function to call with the output values when finished |
| 2 | adapters | table | A table of adapter keys with query values |
| 3 | ...values | any | Varargs of values to be escaped in those queries |
| # | Name | Type | Description |
|---|---|---|---|
| 1 | passed | bool | Did the query get validated successfully |
Sends a query to the connection and calls done with whatever the query returned

melon.sql.Connection:Connect()
Attempts to connect to the sql server, if applicable