{"id":40587119,"url":"https://github.com/ortus-docs/qb-docs","last_synced_at":"2026-01-21T03:07:31.809Z","repository":{"id":28877420,"uuid":"102521562","full_name":"ortus-docs/qb-docs","owner":"ortus-docs","description":"The documentation for QB, a CFML Query Builder","archived":false,"fork":false,"pushed_at":"2026-01-14T20:07:06.000Z","size":626,"stargazers_count":3,"open_issues_count":0,"forks_count":17,"subscribers_count":1,"default_branch":"9.8.0","last_synced_at":"2026-01-15T00:35:02.251Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"https://www.gitbook.com/book/elpete/qb/details","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ortus-docs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing-and-filing-issues.md","funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-09-05T19:27:50.000Z","updated_at":"2023-05-03T13:09:43.000Z","dependencies_parsed_at":"2024-03-18T18:31:15.915Z","dependency_job_id":"2ac163f2-5c3c-42be-85c4-47a5f12f9ab7","html_url":"https://github.com/ortus-docs/qb-docs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ortus-docs/qb-docs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortus-docs%2Fqb-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortus-docs%2Fqb-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortus-docs%2Fqb-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortus-docs%2Fqb-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ortus-docs","download_url":"https://codeload.github.com/ortus-docs/qb-docs/tar.gz/refs/heads/9.8.0","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ortus-docs%2Fqb-docs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28624344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hacktoberfest"],"created_at":"2026-01-21T03:07:31.752Z","updated_at":"2026-01-21T03:07:31.804Z","avatar_url":"https://github.com/ortus-docs.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\n![Master Branch Build Status](https://img.shields.io/travis/coldbox-modules/qb/master.svg?style=flat-square\\\u0026label=master)\n\n![Development Branch Build Status](https://img.shields.io/travis/coldbox-modules/qb/development.svg?style=flat-square\\\u0026label=development)\n\n## Introduction\n\nqb is a fluent query builder for CFML. It is **heavily** inspired by [Eloquent](https://laravel.com/docs/5.3/eloquent) from [Laravel](https://laravel.com/).\n\nUsing qb, you can:\n\n* Quickly scaffold simple queries\n* Make complex, out-of-order queries possible\n* Abstract away differences between database engines\n\n## Requirements\n\n* Adobe ColdFusion 2018+\n* Lucee 5+\n\nqb supports four major database grammars:\n\n* MySQL (`MySQLGrammar@qb`)\n* Oracle (`OracleGrammar@qb`)\n* Postgres (`PostgresGrammar@qb`)\n* Microsoft SQL Server (`SqlServerGrammar@qb`)\n* SQLite (`SQLiteGrammar@qb`)\n\n### Discussion \u0026 Help\n\nThe Box modules discussion group and community can be found here:\n\n[https://community.ortussolutions.com/c/box-modules/qb/27](https://community.ortussolutions.com/c/box-modules/qb/27)\n\n## Installation\n\nInstallation is easy through [CommandBox](https://www.ortussolutions.com/products/commandbox) and [ForgeBox](https://www.coldbox.org/forgebox). Simply type `box install qb` to get started.\n\n## Code Samples\n\nCompare these two examples:\n\n```cfscript\n// Plain old CFML\nvar results = queryExecute( \"SELECT * FROM users\" );\n\n// qb\nvar qb = wirebox.getInstance( \"QueryBuilder@qb\" );\nvar results = qb.from( \"users\" ).get();\n```\n\nThe differences become even more stark when we introduce more complexity:\n\n```cfscript\n// Plain old CFML\nvar results = queryExecute(\n    \"SELECT * FROM posts WHERE published_at IS NOT NULL AND author_id IN ?\",\n    [ { value = \"5,10,27\", cfsqltype = \"CF_SQL_NUMERIC\", list = true } ]\n);\n\n// qb\nvar qb = wirebox.getInstance( \"QueryBuilder@qb\" );\nvar results = qb.from( \"posts\" )\n    .whereNotNull( \"published_at\" )\n    .whereIn( \"author_id\", [ 5, 10, 27 ] )\n    .get();\n```\n\nWith qb you can easily handle setting order by statements before the columns you want or join statements after a where clause:\n\n```cfscript\nvar qb = wirebox.getInstance( \"QueryBuilder@qb\" );\nvar results = qb.from( \"posts\" )\n         .orderBy( \"published_at\" )\n         .select( \"post_id\", \"author_id\", \"title\", \"body\" )\n         .whereLike( \"author\", \"Ja%\" )\n         .join( \"authors\", \"authors.id\", \"=\", \"posts.author_id\" )\n         .get();\n\n// Becomes\nvar results = queryExecute(\n    \"SELECT post_id, author_id, title, body FROM posts INNER JOIN authors ON authors.id = posts.author_id WHERE author LIKE ? ORDER BY published_at\",\n    [ { value = \"Ja%\", cfsqltype = \"CF_SQL_VARCHAR\", list = false, null = false } ]\n);\n```\n\nqb enables you to explore new ways of organizing your code by letting you pass around a query builder object that will compile down to the right SQL without you having to keep track of the order, whitespace, or other SQL gotchas!\n\nHere's a gist with an example of the powerful models you can create with this! [https://gist.github.com/elpete/80d641b98025f16059f6476561d88202](https://gist.github.com/elpete/80d641b98025f16059f6476561d88202)\n\n## Usage\n\nTo start a new query, instantiate a new Builder: `wirebox.getInstance( \"QueryBuilder@qb\" )`.\n\nBy default, qb uses a generic Grammar. You can specify your specific grammar in ColdBox by setting the `defaultGrammar` in your `moduleSettings`.\n\n```cfscript\nmoduleSettings = {\n    qb = {\n        defaultGrammar = \"MySQLGrammar@qb\"\n    }\n};\n```\n\nIf you are not using WireBox, just make sure to wire up the `Builder` object with the correct grammar:\n\n```cfscript\nvar grammar = new qb.models.Query.Grammars.MySQLGrammar();\nvar builder = new qb.models.Query.Builder( grammar );\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fortus-docs%2Fqb-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fortus-docs%2Fqb-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fortus-docs%2Fqb-docs/lists"}