Repository navigation
QueryGrammar
Viames Marino edited this page Feb 23, 2026
·
1 revision
Pair\Orm\QueryGrammar compiles a Query object into raw SQL.
It handles clause compilation and identifier wrapping.
- compile select/from/join/where/group/having/order/limit/offset
- compile nested/exists/in/between/null where clauses
- compile join clause variations from
JoinClause - safely wrap identifiers and aliased identifiers
Produces final SQL for a select query.
Query::toSql() delegates to this compiler.
compileColumns()compileFrom()compileJoins()compileWheres()compileGroups()compileHavings()compileOrders()compileLimit()compileOffset()
You usually do not call QueryGrammar directly, but understanding it helps when:
- diagnosing generated SQL
- mixing raw clauses with fluent builder
- working on query builder internals
use Pair\Orm\Query;
$query = Query::table('users')
->where('active', 1)
->orderBy('created_at', 'desc')
->limit(10);
$sql = $query->toSql();
$bindings = $query->getBindings();See also: Query, JoinClause, Database.
Maintained by Viames Marino — VM Ingegneria · Professional enquiries
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4