Sha256: 84e73f6ff4bcc827eb155f9b27fc28058aa66000a6d9a35046f24c47608d02c6

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

= SQLTree

SQLTree is a pure Ruby library to represent SQL queries with a syntax tree
for inspection and modification.

The library can parse an SQL query (a string) to represent the query using
a syntax tree, and it can generate an SQL query from a syntax tree. The syntax
tree ca be used to inspect to query, or to modify it.

This library is currently under heavy development. This means that not all
SQL constructs are supported yet. For now, only SQL <tt>SELECT</tt> queries
are supported.

== Installation

The SQLTree library is distributed as a gem on Gemcutter.org. To install:

  gem install sql_tree --source http://gemcutter.org
  
== Usage

Consider the following example:

  require 'sql_tree'
  tree  = SQLTree["SELECT * FROM table WHERE field = 'value'"]
  where = SQLTree::Node::Expression["username = 'user' AND password = MD5('$secret')"]
  tree.where = where # replace WHERE expression
  puts tree.to_sql
  # "SELECT * FROM "table" WHERE (("username" = 'user') AND ("password" = MD5('$secret')))"

== Additional information

* See the project wiki at http://wiki.github.com/wvanbergen/sql_tree for more
  information about using this library.
* This plugin is written by Willem van Bergen and is MIT licensed (see the
  LICENSE file).

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sql_tree-0.1.0 README.rdoc
sql_tree-0.0.3 README.rdoc