Skip to content

SQL database functions

SyncJS provides a generalized, fluent client object for interacting with SQL databases: SqlCli.

Supported databases include:

  • Couchbase
  • FirebirdSQL
  • Google BigQuery
  • MS SQL Server
  • MySQL/MariaDB
  • Oracle
  • Postgres
  • SQLite

SqlCli can be used in both traditional and fluent styles. Below are two equivalent examples:

Example 1: Traditional (non-fluent)

ts
var cli = new SqlCli();
cli.Driver("sqlite");
cli.ConnString(":memory:");
if (cli.Connect()) {
  // Perform SQL tasks...
  cli.Close();
}

Example 2: Fluent

ts
var cli = new SqlCli().Driver("sqlite").ConnString(":memory:");
if (cli.Connect()) {
  // Perform SQL tasks...
  cli.Close();
}