Provides minisql client console facilities for this project.
Package: minisql.client.console
Reachable from entry: yes
minisql/client/client.mlasclient→ src/minisql/client/client.mlminisql/client/formatter.mlasformatter→ src/minisql/client/formatter.mlminisql/common/endian.mlasendian→ src/minisql/common/endian.mlminisql/common/uuid.mlasuuid→ src/minisql/common/uuid.mlminisql/platform/file.mlasfile_api→ src/minisql/platform/file.mlminisql/protocol/constants.mlasconstants→ src/minisql/protocol/constants.mlstd/console.mlasconsole_api→../MiniLangCompilerML/std/console.ml— external dependency
function appendSqlFragment(statements, source, startOffset, endOffset, hasToken)Appends SQL fragment using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
statements |
dynamic |
— | statements value consumed by this operation. |
source |
dynamic |
— | source value consumed by this operation. |
startOffset |
dynamic |
— | startOffset value consumed by this operation. |
endOffset |
dynamic |
— | endOffset value consumed by this operation. |
hasToken |
dynamic |
— | hasToken value consumed by this operation. |
function commandArgument(line, prefix)Implements command argument for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
line |
dynamic |
— | line value consumed by this operation. |
prefix |
dynamic |
— | prefix value consumed by this operation. |
function componentName()Performs the componentName operation for the minisql client console module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
const CP_UTF8 = 65001Defines the cp utf8 constant used by the minisql client console module.
function disableQuickEdit()Prevents accidental mouse selection from suspending a Windows console server. Redirected standard input and service processes have no console and are treated as already safe; a real console-mode update reports failures.
const ENABLE_ECHO_INPUT = 4Defines the enable echo input constant used by the minisql client console module.
const ENABLE_EXTENDED_FLAGS = 128Defines the enable extended flags constant used by the minisql client console module.
const ENABLE_QUICK_EDIT_MODE = 64Defines the enable quick edit mode constant used by the minisql client console module.
function executeMeta(activeClient, line)Executes meta using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
activeClient |
dynamic |
— | activeClient value consumed by this operation. |
line |
dynamic |
— | line value consumed by this operation. |
function executeOnce(activeClient, sqlText)Executes once using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
activeClient |
dynamic |
— | activeClient value consumed by this operation. |
sqlText |
dynamic |
— | sqlText value consumed by this operation. |
function executeStatements(activeClient, statements)Executes statements using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
activeClient |
dynamic |
— | activeClient value consumed by this operation. |
statements |
dynamic |
— | statements value consumed by this operation. |
function fail(code, operation, message)Performs the fail operation for the minisql client console module. Returns its result or propagates a structured error from validation or a dependency. Performs I/O through its file, transport, or storage dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
code |
dynamic |
— | code value consumed by this operation. |
operation |
dynamic |
— | operation value consumed by this operation. |
message |
dynamic |
— | Human-readable message associated with the operation. |
extern function GetConsoleMode(handle as ptr, mode as bytes) from "kernel32.dll" symbol "GetConsoleMode" returns boolReads console-mode flags into mode and returns false on a Win32 error.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
ptr |
— | Native or runtime handle used by the operation. |
mode |
bytes |
— | Mode selecting the requested behavior. |
Returns: Native bool result produced by the call.
extern function GetStdHandle(kind as i32) from "kernel32.dll" symbol "GetStdHandle" returns ptrReturns the Windows standard-stream handle identified by kind; failure uses an invalid native handle.
| Parameter | Type | Default | Description |
|---|---|---|---|
kind |
i32 |
— | kind value consumed by this operation. |
Returns: Native ptr result produced by the call.
const INVALID_ARGUMENT = 9001Defines the invalid argument constant used by the minisql client console module.
const IO_FAILURE = 9005Defines the io failure constant used by the minisql client console module.
function isIdentifierByte(value, first)Returns whether the supplied value satisfies the identifier byte condition. Returns the computed value or operation status. Does not modify its inputs.
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
dynamic |
— | Value consumed or transformed by the operation. |
first |
dynamic |
— | first value consumed by this operation. |
function isImplemented()Returns whether implemented satisfies the condition required by the minisql client console module. Returns the computed value or operation status. Does not modify its inputs.
function isMetaCommand(text)Returns whether the supplied value satisfies the meta command condition. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Does not modify its inputs.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
function isSafeMetaIdentifier(value)Returns whether the supplied value satisfies the safe meta identifier condition. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Does not modify its inputs.
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
dynamic |
— | Value consumed or transformed by the operation. |
function isScriptComment(line)Returns whether the supplied value satisfies the script comment condition. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Does not modify its inputs.
| Parameter | Type | Default | Description |
|---|---|---|---|
line |
dynamic |
— | line value consumed by this operation. |
function isSqlBatch(value)Returns whether the supplied value satisfies the SQL batch condition. Returns the computed value or operation status. Does not modify its inputs.
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
dynamic |
— | Value consumed or transformed by the operation. |
function isWhitespaceByte(value)Returns whether the supplied value satisfies the whitespace byte condition. Returns the computed value or operation status. Does not modify its inputs.
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
dynamic |
— | Value consumed or transformed by the operation. |
const MAX_PASSWORD_UTF16_UNITS = 1024Defines the max password utf16 units constant used by the minisql client console module.
function openAuthenticatedPrompt(address, port, username)Opens authenticated prompt using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
address |
dynamic |
— | address value consumed by this operation. |
port |
dynamic |
— | port value consumed by this operation. |
username |
dynamic |
— | username value consumed by this operation. |
function openTlsAuthenticatedPrompt(address, port, serverName, username)Prompts for a password and opens native TLS using Windows certificate trust.
| Parameter | Type | Default | Description |
|---|---|---|---|
address |
dynamic |
— | address value consumed by this operation. |
port |
dynamic |
— | port value consumed by this operation. |
serverName |
dynamic |
— | serverName value consumed by this operation. |
username |
dynamic |
— | username value consumed by this operation. |
function openTlsPinnedAuthenticatedPrompt(address, port, serverName, pinText, username)Prompts for a password and opens native TLS using an exact leaf SHA-256 pin.
| Parameter | Type | Default | Description |
|---|---|---|---|
address |
dynamic |
— | address value consumed by this operation. |
port |
dynamic |
— | port value consumed by this operation. |
serverName |
dynamic |
— | serverName value consumed by this operation. |
pinText |
dynamic |
— | pinText value consumed by this operation. |
username |
dynamic |
— | username value consumed by this operation. |
function printQueryResponse(response)Prints query response using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
response |
dynamic |
— | response value consumed by this operation. |
function printShellHelp()Prints shell help using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
function rawText(source, offset, count)Implements raw text for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
source |
dynamic |
— | source value consumed by this operation. |
offset |
dynamic |
— | Zero-based offset at which processing starts. |
count |
dynamic |
— | Number of items or units to process. |
extern function ReadConsoleW(handle as ptr, buffer as bytes, count as u32, readOut as bytes, control as ptr) from "kernel32.dll" symbol "ReadConsoleW" returns boolReads UTF-16 console input into buffer, reporting the unit count through readOut.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
ptr |
— | Native or runtime handle used by the operation. |
buffer |
bytes |
— | Buffer that receives or supplies the operation data. |
count |
u32 |
— | Number of items or units to process. |
readOut |
bytes |
— | readOut value consumed by this operation. |
control |
ptr |
— | control value consumed by this operation. |
Returns: Native bool result produced by the call.
function readPassword(prompt)Reads password using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt |
dynamic |
— | prompt value consumed by this operation. |
function readPasswordConfirmed(prompt, confirmationPrompt)Reads password confirmed using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt |
dynamic |
— | prompt value consumed by this operation. |
confirmationPrompt |
dynamic |
— | confirmationPrompt value consumed by this operation. |
function runScript(activeClient, path)Runs script using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Performs I/O through its file, transport, or storage dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
activeClient |
dynamic |
— | activeClient value consumed by this operation. |
path |
dynamic |
— | Path of the file or directory used by the operation. |
function runShell(activeClient, prompt)Runs shell using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
activeClient |
dynamic |
— | activeClient value consumed by this operation. |
prompt |
dynamic |
— | prompt value consumed by this operation. |
function scanSqlBatch(text, finalInput)Split complete SQL statements without treating semicolons inside quoted strings, quoted identifiers or comments as terminators. When finalInput is false, an incomplete suffix is returned for the interactive continuation prompt. When finalInput is true, a final statement may omit its semicolon. Scans SQL batch using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
finalInput |
dynamic |
— | finalInput value consumed by this operation. |
extern function SetConsoleMode(handle as ptr, mode as u32) from "kernel32.dll" symbol "SetConsoleMode" returns boolReplaces console-mode flags and returns false on a Win32 error.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
ptr |
— | Native or runtime handle used by the operation. |
mode |
u32 |
— | Mode selecting the requested behavior. |
Returns: Native bool result produced by the call.
function splitLines(text)Implements split lines for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
function splitSqlStatements(text)Implements split SQL statements for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
- minisql.client.console.SqlBatch — struct
function startsWithBytes(text, first, second)Implements starts with bytes for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
first |
dynamic |
— | first value consumed by this operation. |
second |
dynamic |
— | second value consumed by this operation. |
function startsWithText(text, prefix)Implements starts with text for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
prefix |
dynamic |
— | prefix value consumed by this operation. |
const STD_INPUT_HANDLE = -10Defines the std input handle constant used by the minisql client console module.
const STD_OUTPUT_HANDLE = -11Defines the std output handle constant used by the minisql client console module.
function targetMilestone()Performs the targetMilestone operation for the minisql client console module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
function trimAscii(text)Implements trim ascii for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
dynamic |
— | Text consumed by the operation. |
function utf16PasswordToUtf8(wide, units)Implements utf16 password to UTF-8 for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
wide |
dynamic |
— | wide value consumed by this operation. |
units |
dynamic |
— | units value consumed by this operation. |
const WC_ERR_INVALID_CHARS = 128Defines the wc err invalid chars constant used by the minisql client console module.
extern function WideCharToMultiByte(codePage as u32, flags as u32, wideText as bytes, wideCount as i32, output as bytes, outputCount as i32, defaultChar as ptr, usedDefault as ptr) from "kernel32.dll" symbol "WideCharToMultiByte" returns i32Converts UTF-16 units to the requested code page; returns bytes written or zero on failure.
| Parameter | Type | Default | Description |
|---|---|---|---|
codePage |
u32 |
— | codePage value consumed by this operation. |
flags |
u32 |
— | Bit flags controlling the operation. |
wideText |
bytes |
— | wideText value consumed by this operation. |
wideCount |
i32 |
— | Number of wide to process. |
output |
bytes |
— | Output collection or buffer populated by the operation. |
outputCount |
i32 |
— | Number of output to process. |
defaultChar |
ptr |
— | defaultChar value consumed by this operation. |
usedDefault |
ptr |
— | usedDefault value consumed by this operation. |
Returns: Native i32 result produced by the call.
function wipePassword(passwordBytes)Implements wipe password for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
passwordBytes |
dynamic |
— | passwordBytes value consumed by this operation. |
extern function WriteConsoleW(handle as ptr, text as wstr, count as u32, writtenOut as bytes, reserved as ptr) from "kernel32.dll" symbol "WriteConsoleW" returns boolWrites UTF-16 console text and reports the unit count through writtenOut.
| Parameter | Type | Default | Description |
|---|---|---|---|
handle |
ptr |
— | Native or runtime handle used by the operation. |
text |
wstr |
— | Text consumed by the operation. |
count |
u32 |
— | Number of items or units to process. |
writtenOut |
bytes |
— | writtenOut value consumed by this operation. |
reserved |
ptr |
— | reserved value consumed by this operation. |
Returns: Native bool result produced by the call.
function writePrompt(outputHandle, prompt)Writes prompt using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.
| Parameter | Type | Default | Description |
|---|---|---|---|
outputHandle |
dynamic |
— | outputHandle value consumed by this operation. |
prompt |
dynamic |
— | prompt value consumed by this operation. |