-
Notifications
You must be signed in to change notification settings - Fork 10
Add support for MySQL DELIMITER directive #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
8df7518
95b23fa
67783ff
f50a6c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,7 @@ export type StatementType = | |
| | 'COMMIT' | ||
| | 'ROLLBACK' | ||
| | 'ANON_BLOCK' | ||
| | 'DELIMITER' | ||
| | 'UNKNOWN'; | ||
|
|
||
| export type ExecutionType = | ||
|
|
@@ -83,6 +84,7 @@ export type ExecutionType = | |
| | 'INFORMATION' | ||
| | 'ANON_BLOCK' | ||
| | 'TRANSACTION' | ||
| | 'NO_OP' | ||
| | 'UNKNOWN'; | ||
|
|
||
| export interface ParamTypes { | ||
|
|
@@ -126,6 +128,18 @@ export interface IdentifyResult { | |
| parameters: string[]; | ||
| tables: TableReference[]; | ||
| columns: ColumnReference[]; | ||
| /** | ||
| * The terminator string (e.g. `;`, `$`, `$$`) that ended this statement. | ||
| * `undefined` when the statement ran to EOF without a terminator, or for | ||
| * `DELIMITER` statements (which are terminated by end-of-line, not a | ||
| * delimiter). | ||
| */ | ||
| endStatement?: string; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not call this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call — renamed in f50a6c3. The field is now
All tests, docs, and the README consumer-example snippet updated accordingly. Generated by Claude Code |
||
| /** | ||
| * Only set for statements of type `DELIMITER`. The new terminator string | ||
| * that should be used for statements that follow. | ||
| */ | ||
| newDelimiter?: string; | ||
| } | ||
|
|
||
| export interface Statement { | ||
|
|
@@ -142,6 +156,7 @@ export interface Statement { | |
| tables: TableReference[]; | ||
| columns: ColumnReference[]; | ||
| isCte?: boolean; | ||
| newDelimiter?: string; | ||
| } | ||
|
|
||
| export interface ConcreteStatement extends Statement { | ||
|
|
@@ -162,7 +177,7 @@ export interface Token { | |
| | 'comment-inline' | ||
| | 'comment-block' | ||
| | 'string' | ||
| | 'semicolon' | ||
| | 'delimiter' | ||
| | 'keyword' | ||
| | 'parameter' | ||
| | 'table' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an example to the readme of identifying a set of queries after a DELIMITER change and how the user should use the information provided by the library to interpret each query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a "Working with MySQL DELIMITER" section to the README. It shows:
CREATE PROCEDUREand a reset to;.identify()output withnewDelimiter/endStatementpopulated on the relevant statements.type === 'DELIMITER'(client-side only,NO_OP) and stripendStatementfrom each remaining statement'stextbefore sending it to the server.Also added an "Each returned statement has…" bullet list in the API section documenting every field, including the new
endStatementandnewDelimiter.Generated by Claude Code