{"id":15041240,"url":"https://github.com/grizz-it/dbal-sql","last_synced_at":"2026-01-06T09:09:58.867Z","repository":{"id":62512772,"uuid":"354294531","full_name":"grizz-it/dbal-sql","owner":"grizz-it","description":"Database abstraction layer package implementing SQL operations","archived":false,"fork":false,"pushed_at":"2021-05-31T20:12:56.000Z","size":34,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-26T17:09:02.863Z","etag":null,"topics":["databases","dbal","php","queries","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grizz-it.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":null,"support":null}},"created_at":"2021-04-03T13:06:25.000Z","updated_at":"2024-04-26T17:09:02.864Z","dependencies_parsed_at":"2022-11-02T13:15:34.854Z","dependency_job_id":null,"html_url":"https://github.com/grizz-it/dbal-sql","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grizz-it%2Fdbal-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grizz-it%2Fdbal-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grizz-it%2Fdbal-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grizz-it%2Fdbal-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grizz-it","download_url":"https://codeload.github.com/grizz-it/dbal-sql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245814748,"owners_count":20676808,"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":["databases","dbal","php","queries","sql"],"created_at":"2024-09-24T20:45:48.014Z","updated_at":"2026-01-06T09:09:58.840Z","avatar_url":"https://github.com/grizz-it.png","language":"PHP","readme":"[![Build Status](https://travis-ci.com/grizz-it/dbal-sql.svg?branch=master)](https://travis-ci.com/grizz-it/dbal-sql)\n\n# GrizzIT DBAL SQL\n\nGrizzIT DBAL SQL provides a SQL implementation for [GrizzIT DBAL](https://github.com/grizz-it/dbal).\nThis package only implements the query assembly part.\n\n## Installation\n\nTo install the package run the following command:\n\n```\ncomposer require grizz-it/dbal-sql\n```\n\n## Usage\n\n### Using filters\n\nSome queries accept filters. Filters are used to narrow down the amount of\nreturned results. These filters are based on the `QueryFilterInterface` from the\n`grizz-it/dbal` package.\n\nFilters can be grouped in the `QueryFilterGroup` object. All filters inside this\ngroup are separated by an AND statement. If a query object accepts multiple filter\ngroups, the filter groups will be separated by an OR statement.\n\n- [QueryFilterGroup](src/Component/Filter/QueryFilterGroup.php): The base filter object\nexpected by most queries.\n\nFilters can be added to the group after instantiation:\n```php\nuse GrizzIt\\Dbal\\Sql\\Component\\Filter\\QueryFilterGroup;\nuse GrizzIt\\Dbal\\Sql\\Component\\Filter\\ComparatorFilter;\nuse GrizzIt\\Dbal\\Sql\\Common\\ComparatorEnum;\n\n// Create the filter group\n$filterGroup = new QueryFilterGroup;\n\n//Create the filter \"column='value'\"\n$filter = new ComparatorFilter(\n    'column',\n    'value',\n    ComparatorEnum::EQ()\n);\n\n//Add the filter\n$filterGroup-\u003eaddFilter($filter);\n```\n\n- [ComparatorFilter](src/Component/Filter/ComparatorFilter.php): Compare a column to a\nvalue with a standard comparator.\n- [ExistsFilter](src/Component/Filter/ExistsFilter.php): Adds an EXISTS statement with a\nsub-query as a filter.\n- [QueryInFilter](src/Component/Filter/QueryInFilter.php): Connects a default comparator\nwith a sub-query as a filter.\n- [QueryOperatorFilter](src/Component/Filter/QueryOperatorFilter.php): Create a ANY or ALL\nfilter in combination with a comparator for a sub-query.\n- [RelationalComparatorFilter](src/Component/Filter/RelationalComparatorFilter.php): Creates\na direct value injected filter. This filter does not use a parameter, but\noperates similar to the `ComparatorFilter`.\n\n### Creating queries\n\nQueries are created by instantiating and configuring and object, before passing\nit to the connection.\n\n#### Traits\n\nSome queries have shared logic and thus implement common traits.\n\n- [FilterableQueryTrait](src/Component/FilterableQueryTrait.php): This trait is\nimplemented by queries that support filters.\n- [JoinableQueryTrait](src/Component/JoinableQueryTrait.php): This trait is\nimplemented by queries that support joining multiple tables in a single query.\n- [PageableQueryTrait](src/Component/PageableQueryTrait.php): This trait is\nimplemented by queries that support paging (`LIMIT` with(out) an `OFFSET`).\n- [SortableQueryTrait](src/Component/SortableQueryTrait.php): This trait is\nimplemented by queries that support sorting.\n\n#### Enums\n\nSome options and queries have a limitation in the options that can be passed to\nthe object. [Enums](https://github.com/grizz-it/enum) are used for this.\n\n- [ColumnAttributeEnum](src/Common/ColumnAttributeEnum.php)\n- [ColumnDefaultEnum](src/Common/ColumnDefaultEnum.php)\n- [ColumnTypeEnum](src/Common/ColumnTypeEnum.php)\n- [ComparatorEnum](src/Common/ComparatorEnum.php)\n- [IndexTypeEnum](src/Common/IndexTypeEnum.php)\n- [OperatorEnum](src/Common/OperatorEnum.php)\n- [ShowTypeEnum](src/Common/ShowTypeEnum.php)\n- [UnionEnum](src/Common/UnionEnum.php)\n\n#### Queries\n\nThe queries are sorted by their affecting goal. There are also a few standard\nqueries which don't fit in any category.\n\n- [BatchQuery](src/Component/Query/BatchQuery.php): Joins multiple queries for a single\nline execution.\n- [RawQuery](src/Component/Query/RawQuery.php): If none of the query object fit the bill,\nthis object can be used to execute a custom query.\n\n##### Context\n\n- [ShowQuery](src/Component/Query/Context/ShowQuery.php)\n- [UseQuery](src/Component/Query/Context/UseQuery.php)\n\n##### Data\n\n- [DeleteQuery](src/Component/Query/Data/DeleteQuery.php)\n- [InsertIntoSelectQuery](src/Component/Query/Data/InsertIntoSelectQuery.php)\n- [InsertQuery](src/Component/Query/Data/InsertQuery.php)\n- [SelectIntoQuery](src/Component/Query/Data/SelectIntoQuery.php)\n- [SelectQuery](src/Component/Query/Data/SelectQuery.php)\n- [UnionQuery](src/Component/Query/Data/UnionQuery.php)\n- [UpdateQuery](src/Component/Query/Data/UpdateQuery.php)\n\n##### Database\n\n- [AlterDatabaseQuery](src/Component/Query/Database/AlterDatabaseQuery.php)\n- [BackupDatabaseQuery](src/Component/Query/Database/BackupDatabaseQuery.php)\n- [CreateDatabaseQuery](src/Component/Query/Database/CreateDatabaseQuery.php)\n- [DropDatabaseQuery](src/Component/Query/Database/DropDatabaseQuery.php)\n\n##### Table\n\n- [AbstractTableQuery](src/Component/Query/Table/AbstractTableQuery.php): Forms the base\nfor the other table queries.\n- [AlterTableQuery](src/Component/Query/Table/AlterTableQuery.php)\n- [CreateTableQuery](src/Component/Query/Table/CreateTableQuery.php)\n- [DropTableQuery](src/Component/Query/Table/DropTableQuery.php)\n\nColumn operations are defined through:\n- [ColumnDefinition](src/Component/Query/Table/ColumnDefinition.php)\n\n##### View\n\n- [CreateOrReplaceViewQuery](src/Component/Query/View/CreateOrReplaceViewQuery.php)\n- [CreateViewQuery](src/Component/Query/View/CreateViewQuery.php)\n- [DropViewQuery](src/Component/Query/View/DropViewQuery.php)\n\n##### Index\n\n- [CreateIndexQuery](src/Component/Query/Index/CreateIndexQuery)\n- [DropIndexQuery](src/Component/Query/Index/DropIndexQuery)\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## MIT License\n\nCopyright (c) GrizzIT\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrizz-it%2Fdbal-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrizz-it%2Fdbal-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrizz-it%2Fdbal-sql/lists"}