{"id":18420515,"url":"https://github.com/fluentmigrator/batch-parser","last_synced_at":"2025-08-16T02:17:20.255Z","repository":{"id":114887730,"uuid":"128236476","full_name":"fluentmigrator/batch-parser","owner":"fluentmigrator","description":"Implementation of a SQL batch parser","archived":false,"fork":false,"pushed_at":"2018-04-24T20:01:51.000Z","size":92,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-13T11:54:17.727Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluentmigrator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-05T16:53:02.000Z","updated_at":"2023-01-16T14:23:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9396cdf-03ce-4f5e-96ce-2d19e1b21d3b","html_url":"https://github.com/fluentmigrator/batch-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fluentmigrator/batch-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentmigrator%2Fbatch-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentmigrator%2Fbatch-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentmigrator%2Fbatch-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentmigrator%2Fbatch-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluentmigrator","download_url":"https://codeload.github.com/fluentmigrator/batch-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluentmigrator%2Fbatch-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270657715,"owners_count":24623465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T04:22:00.633Z","updated_at":"2025-08-16T02:17:20.227Z","avatar_url":"https://github.com/fluentmigrator.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL Batch Parser\n\nThis is a work-in-progress and **not** for production use.\n\n## Intent\n\nThis project tries to solve the problem of finding (batches of) SQL statements\nto solve problems like `GO` in a command in an embedded SQL script in the\nFluentMigrator project.\n\n## Structure\n\nThe main components are:\n\n- `IRangeSearcher`\n- `ISpecialTokenSearcher`\n\n### `IRangeSearcher`\n\nSearch for a range of things - like comments, quoted identifiers and SQL\nstrings.\n\n### `ISpecialTokenSearcher`\n\nSearch for special tokens like `GO`, or `;`. This allows\nsplitting the SQL script into SQL statements and batches.\n\n## Example\n\n```csharp\n// This is the variable with your SQL script\nvar sqlScript = \"...\";\n\n// This is the found SQL text\nstring sqlText = null;\n\n// The parser does all the work for us\nvar parser = new SqlServerBatchParser();\n\n// Handle the GO token\nparser.SpecialToken += (sender, evt) =\u003e {\n    // Handle the special token (e.g. GO)\n    if (string.IsNullOrEmpty(sqlText)) {\n        // A GO was found, but no SQL statements\n        return;\n    }\n\n    // Execute the sqlText\n    // TODO...\n\n    // Reset the variable to avoid\n    // executing the same SQL code\n    // twice when a second GO follows\n    // without SQL text in between.\n    sqlText = null;\n};\n\n// Store the found SQL text\nparser.SqlText += (sender, evt) =\u003e {\n    sqlText = evt.SqlText.Trim();\n};\n\n// Define the source to be used by the parser\nusing (var source = new TextReaderSource(new StringReader(sqlScript), takeOwnership: true))\n{\n    // This is where the hard stuff happens\n    parser.Process(source, stripComments: true);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluentmigrator%2Fbatch-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluentmigrator%2Fbatch-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluentmigrator%2Fbatch-parser/lists"}