Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@codemirror/lang-sql
Advanced tools
Changelog
6.6.3 (2024-04-08)
Fix a bug where Postgres-style dollar-quoted strings were enabled for all dialects, and the doubleDollarQuotedStrings
options was ignored.
Readme
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This package implements SQL language support for the CodeMirror code editor.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
sql(config?: SQLConfig = {}) → LanguageSupport
SQL language support for the given SQL dialect, with keyword completion, and, if provided, schema-based completion as extra extensions.
interface
SQLConfigOptions used to configure an SQL extension.
dialect?: SQLDialect
The dialect to use. Defaults to
StandardSQL
.
schema?: Object<readonly (string | Completion)[]>
An object that maps table names, optionally prefixed with a
schema name ("schema.table"
) to options (columns) that can be
completed for that table. Use lower-case names here.
tables?: readonly Completion[]
By default, the completions for the table names will be
generated from the schema
object. But if you want to
customize them, you can pass an array of completions through
this option.
schemas?: readonly Completion[]
Similar to tables
, if you want to provide completion objects
for your schemas rather than using the generated ones, pass them
here.
defaultTable?: string
When given, columns from the named table can be completed directly at the top level.
defaultSchema?: string
When given, tables prefixed with this schema name can be completed directly at the top level.
upperCaseKeywords?: boolean
When set to true, keyword completions will be upper-case.
class
SQLDialectRepresents an SQL dialect.
language: LRLanguage
The language for this dialect.
spec: SQLDialectSpec
The spec used to define this dialect.
extension: Extension
Returns the language for this dialect as an extension.
static define(spec: SQLDialectSpec) → SQLDialect
Define a new dialect.
type
SQLDialectSpecConfiguration for an SQL Dialect.
keywords?: string
A space-separated list of keywords for the dialect.
builtin?: string
A space-separated string of built-in identifiers for the dialect.
types?: string
A space-separated string of type names for the dialect.
backslashEscapes?: boolean
Controls whether regular strings allow backslash escapes.
hashComments?: boolean
Controls whether # creates a line comment.
slashComments?: boolean
Controls whether //
creates a line comment.
spaceAfterDashes?: boolean
When enabled --
comments are only recognized when there's a
space after the dashes.
doubleDollarQuotedStrings?: boolean
When enabled, things quoted with "$" are treated as strings, rather than identifiers.
doubleQuotedStrings?: boolean
When enabled, things quoted with double quotes are treated as strings, rather than identifiers.
charSetCasts?: boolean
Enables strings like _utf8'str'
or N'str'
.
operatorChars?: string
The set of characters that make up operators. Defaults to
"*+\-%<>!=&|~^/"
.
specialVar?: string
The set of characters that start a special variable name.
Defaults to "?"
.
identifierQuotes?: string
The characters that can be used to quote identifiers. Defaults
to "\""
.
unquotedBitLiterals?: boolean
Controls whether bit values can be defined as 0b1010. Defaults to false.
treatBitsAsBytes?: boolean
Controls whether bit values can contain other characters than 0 and 1. Defaults to false.
StandardSQL: SQLDialect
The standard SQL dialect.
PostgreSQL: SQLDialect
Dialect for PostgreSQL.
MySQL: SQLDialect
MySQL dialect.
MariaSQL: SQLDialect
MSSQL: SQLDialect
SQL dialect for Microsoft SQL Server.
SQLite: SQLDialect
SQLite dialect.
Cassandra: SQLDialect
Dialect for Cassandra's SQL-ish query language.
PLSQL: SQLDialect
PL/SQL dialect.
keywordCompletionSource(dialect: SQLDialect, upperCase?: boolean = false) → CompletionSource
Returns a completion source that provides keyword completion for the given SQL dialect.
schemaCompletionSource(config: SQLConfig) → CompletionSource
Returns a completion sources that provides schema-based completion for the given configuration.
FAQs
SQL language support for the CodeMirror code editor
The npm package @codemirror/lang-sql receives a total of 200,910 weekly downloads. As such, @codemirror/lang-sql popularity was classified as popular.
We found that @codemirror/lang-sql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.