{"id":13591730,"url":"https://github.com/JaCraig/SQLParser","last_synced_at":"2025-04-08T17:32:25.569Z","repository":{"id":65413652,"uuid":"103445374","full_name":"JaCraig/SQLParser","owner":"JaCraig","description":"An SQL Parser/Lexer for C#","archived":false,"fork":false,"pushed_at":"2025-01-28T20:47:51.000Z","size":35138,"stargazers_count":115,"open_issues_count":1,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-01T17:18:18.298Z","etag":null,"topics":["sql","sql-parser","tsql","tsql-parser"],"latest_commit_sha":null,"homepage":"https://jacraig.github.io/SQLParser/","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/JaCraig.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-13T20:08:12.000Z","updated_at":"2025-04-01T06:12:34.000Z","dependencies_parsed_at":"2023-01-22T09:25:10.492Z","dependency_job_id":"229e4910-6ca6-4384-8711-c7d49f253b3d","html_url":"https://github.com/JaCraig/SQLParser","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSQLParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSQLParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSQLParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSQLParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JaCraig","download_url":"https://codeload.github.com/JaCraig/SQLParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247892692,"owners_count":21013765,"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","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":["sql","sql-parser","tsql","tsql-parser"],"created_at":"2024-08-01T16:01:01.332Z","updated_at":"2025-04-08T17:32:20.559Z","avatar_url":"https://github.com/JaCraig.png","language":"C#","readme":"## SQLParser\n\nThis C# library provides a SQL parser and lexer implementation using ANTLR. It allows you to parse SQL queries into an abstract syntax tree (AST) and perform various operations on the parsed queries.\n\n## Features\n\n- Lexical analysis: Tokenizing SQL queries into individual tokens.\n- Syntactic analysis: Parsing SQL queries into an abstract syntax tree.\n- Query manipulation: Modifying and transforming the parsed SQL queries.\n- Query analysis: Extracting metadata and information from SQL queries.\n\n## Installation\n\nYou can install the library via NuGet:\n\n```\ndotnet add package SQLParser\n```\n\n## Usage\n\nTo use this library in your C# project, follow these steps:\n\n1. Add a reference to the `SQLParser` package in your project.\n2. Import the `SQLParser` namespace in your code:\n\n   ```csharp\n   using SQLParser.Parsers.TSql;\n   using SQLParser;\n   ```\n\n3. Create a parser listener class:\n\n    ```csharp\n    /// \u003csummary\u003e\n    /// This is an example of a printer that can be used to parse a statement.\n    /// \u003c/summary\u003e\n    /// \u003cseealso cref=\"TSqlParserBaseListener\" /\u003e\n    internal class Printer : TSqlParserBaseListener\n    {\n        /// \u003csummary\u003e\n        /// Gets or sets a value indicating whether [statement found].\n        /// \u003c/summary\u003e\n        /// \u003cvalue\u003e\n        ///   \u003cc\u003etrue\u003c/c\u003e if [statement found]; otherwise, \u003cc\u003efalse\u003c/c\u003e.\n        /// \u003c/value\u003e\n        public bool StatementFound { get; set; }\n\n        /// \u003csummary\u003e\n        /// Enter a parse tree produced by \u003csee cref=\"M:SQLParser.Parsers.TSql.TSqlParser.dml_clause\" /\u003e.\n        /// \u003cpara\u003eThe default implementation does nothing.\u003c/para\u003e\n        /// \u003c/summary\u003e\n        /// \u003cparam name=\"context\"\u003eThe parse tree.\u003c/param\u003e\n        public override void EnterDml_clause([NotNull] TSqlParser.Dml_clauseContext context)\n        {\n            // This is a select statement if the select_statement_standalone is not null\n            StatementFound |= context.select_statement_standalone() != null;\n            base.EnterDml_clause(context);\n        }\n    }\n\n    ```\n\n4. Parse the query:\n\n   ```csharp\n   Parser.Parse(\"SELECT * FROM Somewhere\", ExamplePrinter, Enums.SQLType.TSql);\n   ```\n\n## Contributing\n\nContributions are welcome! If you encounter any bugs, issues, or have feature requests, please [create an issue](https://github.com/JaCraig/SQLParser/issues) on this repository.\n\nIf you want to contribute to the codebase, follow these steps:\n\n1. Fork the repository.\n2. Create a new branch for your feature/bug fix.\n3. Make your changes and write tests if applicable.\n4. Submit a pull request.\n\nPlease ensure that your code follows the existing code style and passes the tests before submitting a pull request.\n\n## License\n\nThis library is released under the [Apache 2 License](https://github.com/JaCraig/SQLParser/blob/master/LICENSE).\n\n## Acknowledgments\n\n- This library was built using ANTLR (version 4).","funding_links":[],"categories":["C#","C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJaCraig%2FSQLParser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJaCraig%2FSQLParser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJaCraig%2FSQLParser/lists"}