Sha256: 805477c5b60e76772e873dc8b12860d6f177a601c88cc106291963cb5ed5555e
Contents?: true
Size: 1.76 KB
Versions: 5
Compression:
Stored size: 1.76 KB
Contents
# Alf::Sql [![Build Status](https://secure.travis-ci.org/alf-tool/alf-sql.png)](http://travis-ci.org/alf-tool/alf-sql) [![Dependency Status](https://gemnasium.com/alf-tool/alf-sql.png)](https://gemnasium.com/alf-tool/alf-sql) [![Code Climate](https://codeclimate.com/github/alf-tool/alf-sql.png)](https://codeclimate.com/github/alf-tool/alf-sql) An abstract SQL compiler for Alf expressions ## Links * [http://github.com/alf-tool/alf](http://github.com/alf-tool/alf#synopsis) * [http://github.com/alf-tool/alf-sql](http://github.com/alf-tool/alf-sql#synopsis) * [http://github.com/alf-tool/alf-sequel](http://github.com/alf-tool/alf-sequel#synopsis) ## Synopsis This sub-module provides an abstract SQL compiler for Alf expressions. It is NOT aimed at being used by end-users (the API illustrated below is considered private and may change at any time). Instead, it provides a basis for concrete translators converting the resulting SQL abstract syntax tree to a concrete SQL dialect through third-party libraries. See [alf-sequel](https://github.com/alf-tool/alf-sequel) for a translator built on top of [Sequel](http://sequel.rubyforge.org/). ## Example ```ruby require 'alf-sql' Alf.connect("sap.db") do |conn| # Let parse some relational expression expr = conn.parse{ restrict(suppliers, city: 'London') } # Translate to SQL # (non-portable SQL output unless you require alf-sequel as well) puts expr.to_sql # => SELECT t1.sid, t1.name, t1.status, t1.city # FROM suppliers AS t1 # WHERE t1.city = 'London' # Alternatively (for translator implementers), # compile to an abstract cog (cannot be iterated) cog = Alf::Sql::Compiler.new.call(expr) # Let see the SQL AST puts cog.to_sexpr.inspect # => [ :select_exp, [:select_list, ...] ] end ```
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
alf-sql-0.16.3 | README.md |
alf-sql-0.16.2 | README.md |
alf-sql-0.16.1 | README.md |
alf-sql-0.16.0 | README.md |
alf-sql-0.15.0 | README.md |