Skip to content

Latest commit

 

History

History
1737 lines (1112 loc) · 63.4 KB

File metadata and controls

1737 lines (1112 loc) · 63.4 KB

src/minisql/admin/fullclient.ml

Home · Files

Provides minisql admin fullclient facilities for this project.

Package: minisql.admin.fullclient

Reachable from entry: no

Imports

Declarations

abort

function abort(state)

Aborts a session after cancellation invalidated its request/response stream.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

activeResultTab

function activeResultTab(state)

Returns the currently selected structured result tab.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

addResultTab

function addResultTab(state, sqlText, view, responses, elapsedMilliseconds)

Stores one result tab and selects it for grid rendering.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
sqlText dynamic sqlText value consumed by this operation.
view dynamic view value consumed by this operation.
responses dynamic responses value consumed by this operation.
elapsedMilliseconds dynamic elapsedMilliseconds value consumed by this operation.

View source

appendSyntaxSpan

function appendSyntaxSpan(accumulator, startOffset, endOffset, kind)

Appends one non-empty native syntax range in constant time.

Parameter Type Default Description
accumulator dynamic accumulator value consumed by this operation.
startOffset dynamic startOffset value consumed by this operation.
endOffset dynamic endOffset value consumed by this operation.
kind dynamic kind value consumed by this operation.

View source

asciiUpper

function asciiUpper(text)

Converts ASCII letters to upper case for secret-bearing DCL detection.

Parameter Type Default Description
text dynamic Text consumed by the operation.

View source

beginTransaction

function beginTransaction(state)

Begins an explicit MiniSQL transaction.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

bookmarkLines

function bookmarkLines(bookmarks)

Returns bookmark labels for native list rendering.

Parameter Type Default Description
bookmarks dynamic bookmarks value consumed by this operation.

View source

bookmarkSqlForSelection

function bookmarkSqlForSelection(state, label)

Returns SQL for a bookmark and substitutes the selected table where required.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
label dynamic label value consumed by this operation.

View source

byteOffsetForUtf16

function byteOffsetForUtf16(text, wantedUnits)

Converts a native UTF-16 caret offset to an exact UTF-8 byte boundary.

Parameter Type Default Description
text dynamic Text consumed by the operation.
wantedUnits dynamic wantedUnits value consumed by this operation.

View source

clearResultTabs

function clearResultTabs(state)

Clears result tabs while preserving SQL history.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

clipboardField

function clipboardField(value)

Escapes tabs, line endings, and backslashes for lossless clipboard TSV.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

close

function close(state)

Closes the active protocol session.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

closeResultTab

function closeResultTab(state, index)

Closes one result page and keeps the nearest surviving page selected.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
index dynamic Zero-based index of the affected item.

View source

columnMetadata

function columnMetadata(details, columnName)

Finds one DESCRIBE row by exact column name.

Parameter Type Default Description
details dynamic details value consumed by this operation.
columnName dynamic columnName value consumed by this operation.

View source

commitTransaction

function commitTransaction(state)

Commits the current explicit MiniSQL transaction.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

componentName

function componentName()

Performs the componentName operation for the minisql admin fullclient module.

View source

containsText

function containsText(values, wanted)

Returns whether an array contains an exact string.

Parameter Type Default Description
values dynamic values value consumed by this operation.
wanted dynamic wanted value consumed by this operation.

View source

createDataBrowseOptions

function createDataBrowseOptions(filterText, sortColumn, ascending, page, pageSize)

Constructs validated table-browser paging, filter, and ordering options.

Parameter Type Default Description
filterText dynamic filterText value consumed by this operation.
sortColumn dynamic sortColumn value consumed by this operation.
ascending dynamic ascending value consumed by this operation.
page dynamic page value consumed by this operation.
pageSize dynamic pageSize value consumed by this operation.

View source

createProfile

function createProfile(name, address, port, serverName, databaseName, userName, tls, pinSha256, trustedLocal)

Constructs and validates one MiniSQL-only connection profile.

Parameter Type Default Description
name dynamic Name of the affected item.
address dynamic address value consumed by this operation.
port dynamic port value consumed by this operation.
serverName dynamic serverName value consumed by this operation.
databaseName dynamic databaseName value consumed by this operation.
userName dynamic userName value consumed by this operation.
tls dynamic tls value consumed by this operation.
pinSha256 dynamic pinSha256 value consumed by this operation.
trustedLocal dynamic trustedLocal value consumed by this operation.

View source

csvField

function csvField(value)

Escapes one cell for RFC 4180-compatible UTF-8 CSV output.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

currentStatementSql

function currentStatementSql(text, caretOffset)

Locates the statement containing a collapsed caret while honoring SQL lexical regions. A caret after the final delimiter selects the preceding statement, matching common worksheet behavior; semicolons inside strings, identifiers, and comments are ignored.

Parameter Type Default Description
text dynamic Text consumed by the operation.
caretOffset dynamic caretOffset value consumed by this operation.

View source

dataColumnIndex

function dataColumnIndex(details, columnName)

Finds a named preview column so key values can be read from a selected row.

Parameter Type Default Description
details dynamic details value consumed by this operation.
columnName dynamic columnName value consumed by this operation.

View source

dataCountSql

function dataCountSql(tableName, options)

Builds the matching filtered row-count query used by pagination controls.

Parameter Type Default Description
tableName dynamic tableName value consumed by this operation.
options dynamic Options controlling the operation.

View source

dataEditorValues

function dataEditorValues(details, rowIndex, duplicate)

Creates initial editor values for a new, copied, or existing preview row.

Parameter Type Default Description
details dynamic details value consumed by this operation.
rowIndex dynamic Zero-based index of row.
duplicate dynamic duplicate value consumed by this operation.

View source

dataGridWithChanges

function dataGridWithChanges(details, changes)

Builds an optimistic Data-page grid with explicit pending-change markers.

Parameter Type Default Description
details dynamic details value consumed by this operation.
changes dynamic changes value consumed by this operation.

View source

dataRowPredicate

function dataRowPredicate(details, originalRow)

Builds the stable key predicate used by UPDATE and DELETE from original row values.

Parameter Type Default Description
details dynamic details value consumed by this operation.
originalRow dynamic originalRow value consumed by this operation.

View source

dataSelectSql

function dataSelectSql(tableName, options)

Builds the bounded SELECT used by the editable table browser.

Parameter Type Default Description
tableName dynamic tableName value consumed by this operation.
options dynamic Options controlling the operation.

View source

ddlFromDescribe

function ddlFromDescribe(tableName, response)

Converts validated DESCRIBE metadata into a readable CREATE TABLE preview.

Parameter Type Default Description
tableName dynamic tableName value consumed by this operation.
response dynamic response value consumed by this operation.

View source

decodeClipboardField

function decodeClipboardField(raw)

Decodes one escaped clipboard field without interpreting SQL syntax.

Parameter Type Default Description
raw dynamic raw value consumed by this operation.

View source

DEFAULT_DATA_PAGE_SIZE

const DEFAULT_DATA_PAGE_SIZE = 100

Defines the default data page size constant used by the minisql admin fullclient module.

View source

defaultBookmarks

function defaultBookmarks()

Provides SQuirreL-style starter templates specialized for MiniSQL.

View source

defaultDataBrowseOptions

function defaultDataBrowseOptions()

Returns the default first-page data-browser options.

View source

deleteDataSql

function deleteDataSql(details, originalRow)

Generates a key-constrained DELETE statement for a selected preview row.

Parameter Type Default Description
details dynamic details value consumed by this operation.
originalRow dynamic originalRow value consumed by this operation.

View source

describeTable

function describeTable(state, tableName)

Loads the default first page while preserving the original public API.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
tableName dynamic tableName value consumed by this operation.

View source

describeTableView

function describeTableView(state, tableName, options)

Loads a filtered, ordered, and paginated set of detail pages for one table.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
tableName dynamic tableName value consumed by this operation.
options dynamic Options controlling the operation.

View source

detailGridByName

function detailGridByName(state, name)

Returns the structured object-detail grid for a page or void for textual pages.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
name dynamic Name of the affected item.

View source

detailGridFromResponse

function detailGridFromResponse(response)

Converts one successful row response into a native-grid model without formatting loss.

Parameter Type Default Description
response dynamic response value consumed by this operation.

View source

detailTabLines

function detailTabLines(state)

Returns names of the object-detail notebook pages.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

detailTextByName

function detailTextByName(state, name)

Returns the selected detail-page text by its tab label.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
name dynamic Name of the affected item.

View source

editableKeyColumns

function editableKeyColumns(details)

Selects a primary key, or the first unique key, for safe single-row mutations.

Parameter Type Default Description
details dynamic details value consumed by this operation.

View source

editorSqlForExecution

function editorSqlForExecution(text, selectionStart, selectionEnd, wholeScript)

Chooses the whole script, an explicit selection, or the caret's current statement.

Parameter Type Default Description
text dynamic Text consumed by the operation.
selectionStart dynamic selectionStart value consumed by this operation.
selectionEnd dynamic selectionEnd value consumed by this operation.
wholeScript dynamic wholeScript value consumed by this operation.

View source

editorSqlLiteral

function editorSqlLiteral(metadataRow, editorValue, allowDefault)

Converts one row-editor value into a type-aware SQL literal.

Parameter Type Default Description
metadataRow dynamic metadataRow value consumed by this operation.
editorValue dynamic editorValue value consumed by this operation.
allowDefault dynamic allowDefault value consumed by this operation.

View source

editorValueFromData

function editorValueFromData(metadataRow, value)

Converts one preview value back into the explicit row-editor sentinel form.

Parameter Type Default Description
metadataRow dynamic metadataRow value consumed by this operation.
value dynamic Value consumed or transformed by the operation.

View source

emptyQueryView

function emptyQueryView()

Returns an empty successful query summary.

View source

emptyTableDetails

function emptyTableDetails()

Returns empty table-detail pages before an object is selected.

View source

endpointText

function endpointText(profile)

Formats the endpoint shown in alias and session status areas.

Parameter Type Default Description
profile dynamic profile value consumed by this operation.

View source

executableSqlFragment

function executableSqlFragment(text)

Returns whether one editor fragment contains executable SQL rather than comments only.

Parameter Type Default Description
text dynamic Text consumed by the operation.

View source

executeAtomicSql

function executeAtomicSql(state, sqlText)

Executes a generated mutation batch atomically, using a savepoint inside an existing transaction.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
sqlText dynamic sqlText value consumed by this operation.

View source

executeSql

function executeSql(state, sqlText)

Executes a semicolon-delimited editor batch and retains bounded, redacted results.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
sqlText dynamic sqlText value consumed by this operation.

View source

explainSql

function explainSql(state, sqlText)

Executes EXPLAIN for the editor selection.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
sqlText dynamic sqlText value consumed by this operation.

View source

fail

function fail(operation, message)

Creates a namespaced structured error for the workbench model.

Parameter Type Default Description
operation dynamic operation value consumed by this operation.
message dynamic Human-readable message associated with the operation.

View source

filterHistory

function filterHistory(history, searchText)

Filters redacted worksheet history case-insensitively for the sidebar search box.

Parameter Type Default Description
history dynamic history value consumed by this operation.
searchText dynamic searchText value consumed by this operation.

View source

gridClipboardText

function gridClipboardText(grid, selectedRows, includeHeader)

Serializes selected grid rows as escaped tab-separated clipboard text.

Parameter Type Default Description
grid dynamic Identifier of gr.
selectedRows dynamic selectedRows value consumed by this operation.
includeHeader dynamic includeHeader value consumed by this operation.

View source

gridCsv

function gridCsv(grid)

Serializes a structured grid as deterministic CRLF-terminated CSV.

Parameter Type Default Description
grid dynamic Identifier of gr.

View source

historySql

function historySql(sqlText)

Redacts account DCL so passwords never enter result, history, or query state.

Parameter Type Default Description
sqlText dynamic sqlText value consumed by this operation.

View source

insertDataSql

function insertDataSql(details, values)

Generates an INSERT statement while omitting identity/default sentinel fields.

Parameter Type Default Description
details dynamic details value consumed by this operation.
values dynamic values value consumed by this operation.

View source

INVALID_ARGUMENT

const INVALID_ARGUMENT = 9001

Defines the invalid argument constant used by the minisql admin fullclient module.

View source

isImplemented

function isImplemented()

Reports that the workbench model is implemented.

View source

isSensitiveSql

function isSensitiveSql(sqlText)

Conservatively identifies account DCL before it can enter long-lived UI state.

Parameter Type Default Description
sqlText dynamic sqlText value consumed by this operation.

View source

keepNewest

function keepNewest(values, maximum)

Bounds an array by retaining its newest entries.

Parameter Type Default Description
values dynamic values value consumed by this operation.
maximum dynamic maximum value consumed by this operation.

View source

lastRowResponse

function lastRowResponse(responses)

Returns the final row response in a multi-statement batch.

Parameter Type Default Description
responses dynamic responses value consumed by this operation.

View source

lineJoin

function lineJoin(values)

Joins display lines using Windows edit-control newlines.

Parameter Type Default Description
values dynamic values value consumed by this operation.

View source

MAX_DATA_PAGE_SIZE

const MAX_DATA_PAGE_SIZE = 1000

Defines the max data page size constant used by the minisql admin fullclient module.

View source

MAX_HISTORY_ITEMS

const MAX_HISTORY_ITEMS = 100

Defines the max history items constant used by the minisql admin fullclient module.

View source

MAX_RESULT_TABS

const MAX_RESULT_TABS = 32

Defines the max result tabs constant used by the minisql admin fullclient module.

View source

newWorksheet

function newWorksheet(index, sqlText)

Creates a sequentially named independent SQL worksheet.

Parameter Type Default Description
index dynamic Zero-based index of the affected item.
sqlText dynamic sqlText value consumed by this operation.

View source

numericColumnType

function numericColumnType(typeText)

Returns whether a DESCRIBE type must be emitted as an unquoted numeric literal.

Parameter Type Default Description
typeText dynamic typeText value consumed by this operation.

View source

numericEditorValue

function numericEditorValue(value)

Performs a conservative lexical check before passing a numeric literal to MiniSQL.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

openProfile

function openProfile(profile, passwordBytes)

Opens a profile and eagerly loads the table tree.

Parameter Type Default Description
profile dynamic profile value consumed by this operation.
passwordBytes dynamic passwordBytes value consumed by this operation.

View source

openTransport

function openTransport(profile, passwordBytes)

Opens the transport selected by a profile and wipes no caller-owned secret.

Parameter Type Default Description
profile dynamic profile value consumed by this operation.
passwordBytes dynamic passwordBytes value consumed by this operation.

View source

parseClipboardRows

function parseClipboardRows(text)

Parses escaped TSV clipboard rows into a rectangular array.

Parameter Type Default Description
text dynamic Text consumed by the operation.

View source

pendingDataChange

function pendingDataChange(kind, sqlText, rowIndex, values)

Creates one validated pending row change for preview and deferred application.

Parameter Type Default Description
kind dynamic kind value consumed by this operation.
sqlText dynamic sqlText value consumed by this operation.
rowIndex dynamic Zero-based index of row.
values dynamic values value consumed by this operation.

View source

pendingDataSql

function pendingDataSql(changes)

Joins pending statements into the exact SQL preview submitted by Apply Changes.

Parameter Type Default Description
changes dynamic changes value consumed by this operation.

View source

previewEditorValue

function previewEditorValue(value)

Converts editor sentinels into the text shown by the optimistic data grid.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

previewRowFromValues

function previewRowFromValues(details, values)

Aligns DESCRIBE-ordered editor values with SELECT result-column order.

Parameter Type Default Description
details dynamic details value consumed by this operation.
values dynamic values value consumed by this operation.

View source

queryForTable

function queryForTable(state, tableName)

Returns a SELECT template for the selected table.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
tableName dynamic tableName value consumed by this operation.

View source

queryOne

function queryOne(state, sqlText)

Executes exactly one statement without changing editor history.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
sqlText dynamic sqlText value consumed by this operation.

View source

quotedColumnList

function quotedColumnList(text)

Quotes a comma-separated identifier list for CREATE INDEX generation.

Parameter Type Default Description
text dynamic Text consumed by the operation.

View source

quotedIdentifier

function quotedIdentifier(value)

Quotes any non-empty MiniSQL identifier and doubles embedded quote characters.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

quotedObjectName

function quotedObjectName(value)

Quotes a one- or two-part MiniSQL object name without treating a dot as data.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

quotedTextLiteral

function quotedTextLiteral(value)

Quotes user-entered text as one SQL string literal and doubles embedded apostrophes.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

refresh

function refresh(state)

Refreshes the object browser from SHOW TABLES without creating a result tab.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

renderResponse

function renderResponse(response)

Renders a response for detail pages and result messages.

Parameter Type Default Description
response dynamic response value consumed by this operation.

View source

responseFailure

function responseFailure(response, operation)

Converts a protocol response into an operation error when the server rejected SQL.

Parameter Type Default Description
response dynamic response value consumed by this operation.
operation dynamic operation value consumed by this operation.

View source

resultTabLines

function resultTabLines(tabs)

Returns compact result-tab labels including status, rows, and elapsed time.

Parameter Type Default Description
tabs dynamic tabs value consumed by this operation.

View source

rollbackTransaction

function rollbackTransaction(state)

Rolls back the current explicit MiniSQL transaction.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.

View source

schemaActionLines

function schemaActionLines()

Returns the schema-designer actions in stable native-list order.

View source

schemaEditorSql

function schemaEditorSql(action, tableName, objectName, definition, optionText)

Generates one previewable schema mutation from the structured designer fields.

Parameter Type Default Description
action dynamic action value consumed by this operation.
tableName dynamic tableName value consumed by this operation.
objectName dynamic objectName value consumed by this operation.
definition dynamic definition value consumed by this operation.
optionText dynamic optionText value consumed by this operation.

View source

splitIndexColumns

function splitIndexColumns(text)

Splits the SHOW INDEXES comma-separated key column list into trimmed identifiers.

Parameter Type Default Description
text dynamic Text consumed by the operation.

View source

SQL_STYLE_COMMENT

const SQL_STYLE_COMMENT = 4

Defines the sql style comment constant used by the minisql admin fullclient module.

View source

SQL_STYLE_KEYWORD

const SQL_STYLE_KEYWORD = 1

Defines the sql style keyword constant used by the minisql admin fullclient module.

View source

SQL_STYLE_NUMBER

const SQL_STYLE_NUMBER = 3

Defines the sql style number constant used by the minisql admin fullclient module.

View source

SQL_STYLE_QUOTED_IDENTIFIER

const SQL_STYLE_QUOTED_IDENTIFIER = 5

Defines the sql style quoted identifier constant used by the minisql admin fullclient module.

View source

SQL_STYLE_STRING

const SQL_STYLE_STRING = 2

Defines the sql style string constant used by the minisql admin fullclient module.

View source

sqlSyntaxSpans

function sqlSyntaxSpans(text)

Lexes presentation-only SQL spans without invoking the parser or changing text. The scanner deliberately colors incomplete input and therefore remains useful while the user is typing. Offsets are UTF-16 units expected by RichEdit.

Parameter Type Default Description
text dynamic Text consumed by the operation.

View source

sqlTitle

function sqlTitle(sqlText)

Derives a compact result-tab title from the submitted SQL.

Parameter Type Default Description
sqlText dynamic sqlText value consumed by this operation.

View source

syntaxSpanArray

function syntaxSpanArray(accumulator)

Materializes a linked syntax sequence into the array consumed by native code.

Parameter Type Default Description
accumulator dynamic accumulator value consumed by this operation.

View source

targetMilestone

function targetMilestone()

Performs the targetMilestone operation for the minisql admin fullclient module.

View source

textContains

function textContains(text, wanted)

Performs a byte-safe substring search without relying on host helpers.

Parameter Type Default Description
text dynamic Text consumed by the operation.
wanted dynamic wanted value consumed by this operation.

View source

textForUtf16Range

function textForUtf16Range(text, startOffset, endOffset)

Decodes one byte range whose boundaries were validated against UTF-16 offsets.

Parameter Type Default Description
text dynamic Text consumed by the operation.
startOffset dynamic startOffset value consumed by this operation.
endOffset dynamic endOffset value consumed by this operation.

View source

transactionCommand

function transactionCommand(state, sqlText, activeAfter)

Executes a transaction-control statement and updates toolbar state.

Parameter Type Default Description
state dynamic Mutable state inspected or updated by the operation.
sqlText dynamic sqlText value consumed by this operation.
activeAfter dynamic activeAfter value consumed by this operation.

View source

updateDataSql

function updateDataSql(details, originalRow, values)

Generates a key-constrained UPDATE statement for a selected preview row.

Parameter Type Default Description
details dynamic details value consumed by this operation.
originalRow dynamic originalRow value consumed by this operation.
values dynamic values value consumed by this operation.

View source

utf16Length

function utf16Length(text)

Counts native RichEdit UTF-16 code units without losing supplementary characters.

Parameter Type Default Description
text dynamic Text consumed by the operation.

View source

utf8Step

function utf8Step(raw, index)

Returns the UTF-8 byte width and UTF-16 code-unit width of one valid scalar.

Parameter Type Default Description
raw dynamic raw value consumed by this operation.
index dynamic Zero-based index of the affected item.

View source

validatedSqlFragment

function validatedSqlFragment(value, description, allowEmpty)

Rejects statement separators and SQL comments from a user-entered SQL fragment.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.
description dynamic description value consumed by this operation.
allowEmpty dynamic allowEmpty value consumed by this operation.

View source

worksheetLines

function worksheetLines(worksheets)

Returns stable worksheet labels for the native tab strip.

Parameter Type Default Description
worksheets dynamic worksheets value consumed by this operation.

View source