Skip to content

melon.sql

garryspins edited this page Feb 27, 2026 · 5 revisions

melon.sql


server link

Contains everything needed to interact with multiple SQL drivers
melon

Members

melon.sql.Adapters

server link

A table of all created sql adapters

Functions

melon.sql.NewConnection

server link
melon.sql.NewConnection() -> melon.sql.Connection

Argument and Return information

Returns

# Name Type Description
1 conn melon.sql.Connection The connection object

Creates a new connection object

melon.sql.QueryParse

server link
melon.sql.QueryParse(query: string, escape: func, values: table) -> string

Argument and Return information

Arguments

# 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

Returns

# 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

Classes

melon.sql.Connection

server link

The central SQL connection that handles I/O

Accessors

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

server link

melon.sql.Connection:QueryNoResult

server link
melon.sql.Connection:QueryNoResult(adapters: table, ...values: any) -> bool?

Argument and Return information

Arguments

# 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

Returns

# Name Type Description
1 passed bool Did the query get validated successfully

Sends a query to the connection


server link

melon.sql.Connection:Query

server link
melon.sql.Connection:Query(done: func, adapters: table, ...values: any) -> bool?

Argument and Return information

Arguments

# 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

Returns

# 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


server link

melon.sql.Connection:Connect

server link
melon.sql.Connection:Connect()

Attempts to connect to the sql server, if applicable

Clone this wiki locally