SMQL is a JSON-based query langauage similar to MQL. This gem convertes these querys to ActiveRecord.
Find a file
Denis Knauf c61dbfe31d init
2011-09-08 17:03:52 +02:00
lib init 2011-09-08 17:03:52 +02:00
.gitignore init 2011-09-08 17:03:52 +02:00
AUTHORS init 2011-09-08 17:03:52 +02:00
LICENSE init 2011-09-08 17:03:52 +02:00
Rakefile init 2011-09-08 17:03:52 +02:00
README.md init 2011-09-08 17:03:52 +02:00
TODO init 2011-09-08 17:03:52 +02:00
VERSION init 2011-09-08 17:03:52 +02:00

Idea

Similar to MQL: SMQL allowes SQL-queries on your database but in a JSON-based language.

This query language is SQL-injection-safe. Only expencive queries can slow down your machine.

Usage

Easy query in ruby: User is a AR-Model and has a column username. We want to find all users which has the username "auser".

require 'smql'

SmqlToAR.to_ar User, '{"username": "auser"}' # Query in JSON
SmqlToAR.to_ar User, username: "auser"       # Query in Ruby

In Rails:

SmqlToAR.to_ar User, params[:smql]

Don't forget to add gem to Gemfile:

gem 'smql'