Backend half
This commit is contained in:
+70
@@ -0,0 +1,70 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (c) 2015-2025 MariaDB Corporation Ab
|
||||
|
||||
/**
|
||||
* Capabilities list ( with 'CLIENT_' removed)
|
||||
* see : https://mariadb.com/kb/en/library/1-connecting-connecting/#capabilities
|
||||
*/
|
||||
/* mysql/old mariadb server/client */
|
||||
module.exports.MYSQL = 1n;
|
||||
/* Found instead of affected rows */
|
||||
module.exports.FOUND_ROWS = 2n;
|
||||
/* get all column flags */
|
||||
module.exports.LONG_FLAG = 4n;
|
||||
/* one can specify db on connect */
|
||||
module.exports.CONNECT_WITH_DB = 8n;
|
||||
/* don't allow database.table.column */
|
||||
module.exports.NO_SCHEMA = 1n << 4n;
|
||||
/* can use compression protocol */
|
||||
module.exports.COMPRESS = 1n << 5n;
|
||||
/* odbc client */
|
||||
module.exports.ODBC = 1n << 6n;
|
||||
/* can use LOAD DATA LOCAL */
|
||||
module.exports.LOCAL_FILES = 1n << 7n;
|
||||
/* ignore spaces before '' */
|
||||
module.exports.IGNORE_SPACE = 1n << 8n;
|
||||
/* new 4.1 protocol */
|
||||
module.exports.PROTOCOL_41 = 1n << 9n;
|
||||
/* this is an interactive client */
|
||||
module.exports.INTERACTIVE = 1n << 10n;
|
||||
/* switch to ssl after handshake */
|
||||
module.exports.SSL = 1n << 11n;
|
||||
/* IGNORE sigpipes */
|
||||
module.exports.IGNORE_SIGPIPE = 1n << 12n;
|
||||
/* client knows about transactions */
|
||||
module.exports.TRANSACTIONS = 1n << 13n;
|
||||
/* old flag for 4.1 protocol */
|
||||
module.exports.RESERVED = 1n << 14n;
|
||||
/* new 4.1 authentication */
|
||||
module.exports.SECURE_CONNECTION = 1n << 15n;
|
||||
/* enable/disable multi-stmt support */
|
||||
module.exports.MULTI_STATEMENTS = 1n << 16n;
|
||||
/* enable/disable multi-results */
|
||||
module.exports.MULTI_RESULTS = 1n << 17n;
|
||||
/* multi-results in ps-protocol */
|
||||
module.exports.PS_MULTI_RESULTS = 1n << 18n;
|
||||
/* client supports plugin authentication */
|
||||
module.exports.PLUGIN_AUTH = 1n << 19n;
|
||||
/* permits connection attributes */
|
||||
module.exports.CONNECT_ATTRS = 1n << 20n;
|
||||
/* Enable authentication response packet to be larger than 255 bytes. */
|
||||
module.exports.PLUGIN_AUTH_LENENC_CLIENT_DATA = 1n << 21n;
|
||||
/* Don't close the connection for a connection with expired password. */
|
||||
module.exports.CAN_HANDLE_EXPIRED_PASSWORDS = 1n << 22n;
|
||||
/* Capable of handling server state change information. It's a hint to the
|
||||
server to include the state change information in Ok packet. */
|
||||
module.exports.SESSION_TRACK = 1n << 23n;
|
||||
/* Client no longer needs EOF packet */
|
||||
module.exports.DEPRECATE_EOF = 1n << 24n;
|
||||
module.exports.SSL_VERIFY_SERVER_CERT = 1n << 30n;
|
||||
|
||||
/* MariaDB extended capabilities */
|
||||
|
||||
/* Permit bulk insert*/
|
||||
module.exports.MARIADB_CLIENT_STMT_BULK_OPERATIONS = 1n << 34n;
|
||||
/* Clients supporting extended metadata */
|
||||
module.exports.MARIADB_CLIENT_EXTENDED_METADATA = 1n << 35n;
|
||||
/* permit metadata caching */
|
||||
module.exports.MARIADB_CLIENT_CACHE_METADATA = 1n << 36n;
|
||||
/* permit returning all bulk individual results */
|
||||
module.exports.BULK_UNIT_RESULTS = 1n << 37n;
|
||||
+1409
File diff suppressed because it is too large
Load Diff
+16
@@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (c) 2015-2024 MariaDB Corporation Ab
|
||||
|
||||
'use strict';
|
||||
|
||||
const Status = {
|
||||
NOT_CONNECTED: 1,
|
||||
CONNECTING: 2,
|
||||
AUTHENTICATING: 3,
|
||||
INIT_CMD: 4,
|
||||
CONNECTED: 5,
|
||||
CLOSING: 6,
|
||||
CLOSED: 7
|
||||
};
|
||||
|
||||
module.exports.Status = Status;
|
||||
+1306
File diff suppressed because it is too large
Load Diff
+38
@@ -0,0 +1,38 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (c) 2015-2024 MariaDB Corporation Ab
|
||||
|
||||
/**
|
||||
* Column definition packet "Field detail" flag value
|
||||
* see : https://mariadb.com/kb/en/library/resultset/#field-detail-flag
|
||||
*/
|
||||
|
||||
// field cannot be null
|
||||
module.exports.NOT_NULL = 1;
|
||||
// field is a primary key
|
||||
module.exports.PRIMARY_KEY = 2;
|
||||
//field is unique
|
||||
module.exports.UNIQUE_KEY = 4;
|
||||
//field is in a multiple key
|
||||
module.exports.MULTIPLE_KEY = 8;
|
||||
//is this field a Blob
|
||||
module.exports.BLOB = 1 << 4;
|
||||
// is this field unsigned
|
||||
module.exports.UNSIGNED = 1 << 5;
|
||||
//is this field a zerofill
|
||||
module.exports.ZEROFILL_FLAG = 1 << 6;
|
||||
//whether this field has a binary collation
|
||||
module.exports.BINARY_COLLATION = 1 << 7;
|
||||
//Field is an enumeration
|
||||
module.exports.ENUM = 1 << 8;
|
||||
//field auto-increment
|
||||
module.exports.AUTO_INCREMENT = 1 << 9;
|
||||
//field is a timestamp value
|
||||
module.exports.TIMESTAMP = 1 << 10;
|
||||
//field is a SET
|
||||
module.exports.SET = 1 << 11;
|
||||
//field doesn't have default value
|
||||
module.exports.NO_DEFAULT_VALUE_FLAG = 1 << 12;
|
||||
//field is set to NOW on UPDATE
|
||||
module.exports.ON_UPDATE_NOW_FLAG = 1 << 13;
|
||||
//field is num
|
||||
module.exports.NUM_FLAG = 1 << 14;
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (c) 2015-2024 MariaDB Corporation Ab
|
||||
|
||||
/**
|
||||
* Field types
|
||||
* see https://mariadb.com/kb/en/library/resultset/#field-types
|
||||
*/
|
||||
|
||||
module.exports.DECIMAL = 0;
|
||||
module.exports.TINY = 1;
|
||||
module.exports.SHORT = 2;
|
||||
module.exports.INT = 3;
|
||||
module.exports.FLOAT = 4;
|
||||
module.exports.DOUBLE = 5;
|
||||
module.exports.NULL = 6;
|
||||
module.exports.TIMESTAMP = 7;
|
||||
module.exports.BIGINT = 8;
|
||||
module.exports.INT24 = 9;
|
||||
module.exports.DATE = 10;
|
||||
module.exports.TIME = 11;
|
||||
module.exports.DATETIME = 12;
|
||||
module.exports.YEAR = 13;
|
||||
module.exports.NEWDATE = 14;
|
||||
module.exports.VARCHAR = 15;
|
||||
module.exports.BIT = 16;
|
||||
module.exports.TIMESTAMP2 = 17;
|
||||
module.exports.DATETIME2 = 18;
|
||||
module.exports.TIME2 = 19;
|
||||
module.exports.JSON = 245; //only for MySQL
|
||||
module.exports.NEWDECIMAL = 246;
|
||||
module.exports.ENUM = 247;
|
||||
module.exports.SET = 248;
|
||||
module.exports.TINY_BLOB = 249;
|
||||
module.exports.MEDIUM_BLOB = 250;
|
||||
module.exports.LONG_BLOB = 251;
|
||||
module.exports.BLOB = 252;
|
||||
module.exports.VAR_STRING = 253;
|
||||
module.exports.STRING = 254;
|
||||
module.exports.GEOMETRY = 255;
|
||||
|
||||
const typeNames = [];
|
||||
typeNames[0] = 'DECIMAL';
|
||||
typeNames[1] = 'TINY';
|
||||
typeNames[2] = 'SHORT';
|
||||
typeNames[3] = 'INT';
|
||||
typeNames[4] = 'FLOAT';
|
||||
typeNames[5] = 'DOUBLE';
|
||||
typeNames[6] = 'NULL';
|
||||
typeNames[7] = 'TIMESTAMP';
|
||||
typeNames[8] = 'BIGINT';
|
||||
typeNames[9] = 'INT24';
|
||||
typeNames[10] = 'DATE';
|
||||
typeNames[11] = 'TIME';
|
||||
typeNames[12] = 'DATETIME';
|
||||
typeNames[13] = 'YEAR';
|
||||
typeNames[14] = 'NEWDATE';
|
||||
typeNames[15] = 'VARCHAR';
|
||||
typeNames[16] = 'BIT';
|
||||
typeNames[17] = 'TIMESTAMP2';
|
||||
typeNames[18] = 'DATETIME2';
|
||||
typeNames[19] = 'TIME2';
|
||||
typeNames[245] = 'JSON';
|
||||
typeNames[246] = 'NEWDECIMAL';
|
||||
typeNames[247] = 'ENUM';
|
||||
typeNames[248] = 'SET';
|
||||
typeNames[249] = 'TINY_BLOB';
|
||||
typeNames[250] = 'MEDIUM_BLOB';
|
||||
typeNames[251] = 'LONG_BLOB';
|
||||
typeNames[252] = 'BLOB';
|
||||
typeNames[253] = 'VAR_STRING';
|
||||
typeNames[254] = 'STRING';
|
||||
typeNames[255] = 'GEOMETRY';
|
||||
|
||||
module.exports.TYPES = typeNames;
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (c) 2015-2024 MariaDB Corporation Ab
|
||||
|
||||
/**
|
||||
* possible server status flag value
|
||||
* see https://mariadb.com/kb/en/library/ok_packet/#server-status-flag
|
||||
* @type {number}
|
||||
*/
|
||||
//A transaction is currently active
|
||||
module.exports.STATUS_IN_TRANS = 1;
|
||||
//Autocommit mode is set
|
||||
module.exports.STATUS_AUTOCOMMIT = 2;
|
||||
//more results exists (more packet follow)
|
||||
module.exports.MORE_RESULTS_EXISTS = 8;
|
||||
module.exports.QUERY_NO_GOOD_INDEX_USED = 16;
|
||||
module.exports.QUERY_NO_INDEX_USED = 32;
|
||||
//when using COM_STMT_FETCH, indicate that current cursor still has result (deprecated)
|
||||
module.exports.STATUS_CURSOR_EXISTS = 64;
|
||||
//when using COM_STMT_FETCH, indicate that current cursor has finished to send results (deprecated)
|
||||
module.exports.STATUS_LAST_ROW_SENT = 128;
|
||||
//database has been dropped
|
||||
module.exports.STATUS_DB_DROPPED = 1 << 8;
|
||||
//current escape mode is "no backslash escape"
|
||||
module.exports.STATUS_NO_BACKSLASH_ESCAPES = 1 << 9;
|
||||
//A DDL change did have an impact on an existing PREPARE (an automatic re-prepare has been executed)
|
||||
module.exports.STATUS_METADATA_CHANGED = 1 << 10;
|
||||
module.exports.QUERY_WAS_SLOW = 1 << 11;
|
||||
//this result-set contain stored procedure output parameter
|
||||
module.exports.PS_OUT_PARAMS = 1 << 12;
|
||||
//current transaction is a read-only transaction
|
||||
module.exports.STATUS_IN_TRANS_READONLY = 1 << 13;
|
||||
//session state change. see Session change type for more information
|
||||
module.exports.SESSION_STATE_CHANGED = 1 << 14;
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (c) 2015-2024 MariaDB Corporation Ab
|
||||
|
||||
/**
|
||||
* Session change type.
|
||||
* see : https://mariadb.com/kb/en/library/ok_packet/#session-change-type
|
||||
* @type {number}
|
||||
*/
|
||||
|
||||
module.exports.SESSION_TRACK_SYSTEM_VARIABLES = 0;
|
||||
module.exports.SESSION_TRACK_SCHEMA = 1;
|
||||
module.exports.SESSION_TRACK_STATE_CHANGE = 2;
|
||||
module.exports.SESSION_TRACK_GTIDS = 3;
|
||||
module.exports.SESSION_TRACK_TRANSACTION_CHARACTERISTICS = 4;
|
||||
module.exports.SESSION_TRACK_TRANSACTION_STATE = 5;
|
||||
Reference in New Issue
Block a user