On this page
std/parsesql
Source EditThe parsesql
module implements a high performance SQL file parser. It parses PostgreSQL syntax and the SQL ANSI standard.
Unstable API.
Imports
Types
-
SqlNodeKind = enum nkNone, nkIdent, nkQuotedIdent, nkStringLit, nkBitStringLit, nkHexStringLit, nkIntegerLit, nkNumericLit, nkPrimaryKey, nkForeignKey, nkNotNull, nkNull, nkStmtList, nkDot, nkDotDot, nkPrefix, nkInfix, nkCall, nkPrGroup, nkColumnReference, nkReferences, nkDefault, nkCheck, nkConstraint, nkUnique, nkIdentity, nkColumnDef, ## name, datatype, constraints nkInsert, nkUpdate, nkDelete, nkSelect, nkSelectDistinct, nkSelectColumns, nkSelectPair, nkAsgn, nkFrom, nkFromItemPair, nkGroup, nkLimit, nkOffset, nkHaving, nkOrder, nkJoin, nkDesc, nkUnion, nkIntersect, nkExcept, nkColumnList, nkValueList, nkWhere, nkCreateTable, nkCreateTableIfNotExists, nkCreateType, nkCreateTypeIfNotExists, nkCreateIndex, nkCreateIndexIfNotExists, nkEnumDef
- kind of SQL abstract syntax tree Source Edit
Procs
-
proc parseSql(input: Stream; filename: string): SqlNode {....raises: [IOError, OSError, IOError, OSError, ValueError, SqlParseError, Exception], tags: [ReadIOEffect, RootEffect, WriteIOEffect], forbids: [].}
-
parses the SQL from
input
into an AST and returns the AST.filename
is only used for error messages. Syntax errors raise anSqlParseError
exception. Source Edit -
proc parseSql(input: string; filename = ""): SqlNode {. ...raises: [IOError, OSError, ValueError, SqlParseError, Exception], tags: [ReadIOEffect, RootEffect, WriteIOEffect], forbids: [].}
-
parses the SQL from
input
into an AST and returns the AST.filename
is only used for error messages. Syntax errors raise anSqlParseError
exception. Source Edit
© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/parsesql.html