File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // sqlsimpleparser client
2+ import { SqlSimpleParser } from "../src" ;
3+
4+ interface Window {
5+ sqlsimpleparser : SqlSimpleParser ;
6+ }
7+
8+ declare let window : Window ;
9+ window . sqlsimpleparser = new SqlSimpleParser ;
Original file line number Diff line number Diff line change 1313 "test:watch" : " jest --watchAll" ,
1414 "lint" : " eslint" ,
1515 "build" : " tsc" ,
16- "build:client" : " browserify src/index.ts -p [ tsify --noImplicitAny ] > dist/sqlsimpleparser.js"
16+ "build:help" : " tsc --help" ,
17+ "build:drawio" : " tsc ./src/index.ts --moduleResolution node --outFile ./lib/single.js --module amd" ,
18+ "build:client" : " browserify client/index.ts -p [ tsify --noImplicitAny ] > dist/sqlsimpleparser.js"
1719 },
1820 "author" : " lastlink" ,
1921 "license" : " MIT" ,
2931 "jest" : " ^29.0.3" ,
3032 "jest-junit" : " ^12.0.0" ,
3133 "jest-serial-runner" : " ^1.1.0" ,
34+ "tsify" : " ^5.0.2" ,
3235 "ts-jest" : " ^29.0.1" ,
3336 "ts-node" : " ^10.9.1" ,
3437 "typescript" : " ^4.8.3"
Original file line number Diff line number Diff line change @@ -485,20 +485,6 @@ export class SqlSimpleParser {
485485 }
486486 return new RegExp ( "//(.+)/.*/" , "//.+/(.*)/" ) ;
487487 }
488- private GetColumnQuantifiers ( ) {
489- let chars : ColumnQuantifiers = {
490- Start : '"' ,
491- End : '"' ,
492- } ;
493- if ( this . dialect == "mysql" ) {
494- chars . Start = "`" ;
495- chars . End = "`" ;
496- } else if ( this . dialect == "sqlserver" ) {
497- chars . Start = "[" ;
498- chars . End = "]" ;
499- }
500- return chars ;
501- }
502488
503489 private CreatePrimaryKey (
504490 primaryKeyName : string ,
@@ -774,7 +760,43 @@ export class SqlSimpleParser {
774760 private static isQuoteChar ( char : string ) : boolean {
775761 return char === '"' || char === "'" || char === "`" ;
776762 }
777-
763+ /**
764+ * return text quantifiers for dialect
765+ * @returns json
766+ */
767+ GetColumnQuantifiers ( ) {
768+ let chars : ColumnQuantifiers = {
769+ Start : '"' ,
770+ End : '"' ,
771+ } ;
772+ if ( this . dialect == "mysql" ) {
773+ chars . Start = "`" ;
774+ chars . End = "`" ;
775+ } else if ( this . dialect == "sqlserver" ) {
776+ chars . Start = "[" ;
777+ chars . End = "]" ;
778+ }
779+ return chars ;
780+ }
781+ ToTableList ( ) {
782+ return this . tableList ;
783+ }
784+ ToPrimaryKeyList ( ) {
785+ return this . primaryKeyList ;
786+ }
787+ ToForeignKeyList ( ) {
788+ return this . foreignKeyList ;
789+ }
790+ ResetModel ( ) {
791+ this . tableList = [ ] ;
792+ this . primaryKeyList = [ ] ;
793+ this . foreignKeyList = [ ] ;
794+ return this ;
795+ }
796+ /**
797+ * return full sql model
798+ * @returns
799+ */
778800 ToModel ( ) : DatabaseModel {
779801 return {
780802 TableList : this . tableList ,
You can’t perform that action at this time.
0 commit comments