SMQL is a JSON-based query langauage similar to MQL. This gem convertes these querys to ActiveRecord.
Find a file
2011-09-09 00:02:24 +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 readme: translationfixes 2011-09-09 00:02:24 +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 allows queries on your database but in a JSON-based language.

This query language is SQL-injection-safe. However, expensive queries can slow down your machine.

Usage

Example: An easy query in ruby: User is a ActiveRecord-Model and has a column username. We want to find all users where 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 my gem to the Gemfile:

gem 'smql'