Introduction

MultiSQL is a highly modular SQL database engine library written in Rust. It enables flexible querying via Rust interfaces.

This documentation describes the available functions, capabilities and syntax of MultiSQL.

Note that MultiSQL uses sqlparser-rs for SQL parsing and as such their syntax is ours.

They try to follow SQL:2016 standards.

Download

Download the CLI here

SELECT

Returns all data requested.

Fundamentally, gets data from tables to return. Practically, can manipulate data greatly.

Syntax

VALUES

Syntax

Notes

Each (x) should have the same number for expressions.

INSERT

Syntax

DELETE

Syntax

CREATE

Syntax

Functions

Functions can take varying numbers of expressions as parameters and act upon them in order to create a expressions result.

CAST

Return $1 casted to $A

Syntax

CAST($1 AS $A)

Parameters

$1

May be anything

$A

Should be a type name

IIF

If $1, return $2, else return $3.

Syntax

IIF($1, $2, $3)

Parameters

$1

Should evaluate to a boolean

$2

May be anything

$3

May be anything

Same as

CASE
	WHEN $1 THEN $2
	END $3
END

IFNULL

If $1 is NULL, return $2, else return $1.

Syntax

IFNULL($1, $2)

Parameters

$1

May be anything

$2

May be anything

Same as

IIF($1 IS NULL, $2, $1)

NULLIF

If $1 equals $2, return NULL, else return $1.

Syntax

NULLIF($1, $2)

Parameters

$1

May be anything

$2

May be anything

Same as

IIF($1 = $2, NULL, $1)

LEFT

If $1 has more than $2 characters, return the left-most $2 characters. Else return $1.

Syntax

LEFT($1, $2)

Parameters

$1

Should evaluate to a string

$2

Should evaluate to an integer

RIGHT

If $1 has more than $2 characters, return the right-most $2 characters. Else return $1.

Syntax

LEFT($1, $2)

Parameters

$1

Should evaluate to a string

$2

Should evaluate to an integer

UPPER

Return $1 with all characters in lowercase.

Syntax

UPPER($1)

Parameters

$1

Should evaluate to a string

LOWER

Return $1 with all characters in lowercase.

Syntax

LOWER($1)

Parameters

$1

Should evaluate to a string

Database Types

Currently, a few database types are supported:

  • Sled
  • CSV
  • XLSX
  • Memory

Concepts

Is a column, function, operation or value.

Operation

Is an alternative name for a type of function; typically comparative binary ones.

Source

SELECT or VALUES.

Column

Is a field in a table. Each row will have a value or "cell" per one of these.

Rust Documentation

You can find the rust crate's documentation here.