___
/\_ \
____ __ \//\ \ __ __ ____ __ _ __
/',__\ /'__`\ \ \ \ /\ \/\ \/\_ ,`\ /'__`\/\`'__\
/\__, `\/\ \L\ \ \_\ \_\ \ \_\ \/_/ /_/\ __/\ \ \/
\/\____/\ \___, \/\____\\/`____ \/\____\ \____\\ \_\
\/___/ \/___/\ \/____/ `/___/> \/____/\/____/ \/_/
\ \_\ /\___/
\/_/ \/__/ version 0.1





= What is Sqlyzer ?

Sqlyzer is a Ruby Mixin able to store, load, update and delete Ruby objects and their relationships in a database by automatically generate adapted tables and queries without a line of Sql from the user.

Current version is : *0.1*

Here is the list of currently supported Sql types :
* TEXT,
* VARCHAR,
* INT,
* INT2,
* INT4,
* INT8,
* FLOAT,
* FLOAT4,
* FLOAT8,
* BOOL,
* DATE,
* TIME,
* DATETIME.

The final goal is to handle object inheritance, associations, resource handling (for various optimizations) and request caching.


= Okay, give me a sample code

require 'rubygems'
require 'sqlyzer'

class Test
include Sqlyzer::Serializer

sql_has_keys :lastname, :firstname/SQL_TEXT
sql_has_values :age/SQL_INT2, :birth/Time.now, :male/SQL_BOOL

def initialize(firstname, lastname, age, male = false)
@firstname = firstname
@lastname = lastname
@age = age
@male = male
end

end

Sqlyzer::Db::connect DB_API, DB_HOST, DB_NAME, DB_USER, DB_PASS
Test.new('sexy', 'jimmy', 42).sql_new

Congratulations ! You have just generated :

1. a 'Test' Sql table containing :
* 'firstname' and 'lastname' as TEXT primary keys;
* 'age' as INT2;
* 'birth' as DATETIME with current date as default value;
* 'male' as BOOL flag.
2. a unique index constraint on 'Test' primary keys;
3. an INSERT request to the 'Test' table with the data from the created 'Test' Ruby object.

Run the code a second time, 'sql_new' will load previously saved data from 'Test' table : the first run 'Time.now' return value is restored to a 'birth' public method of the fresh instance of class 'Test'.


= How do I help ?

This space has a Trac Tool
* Ticket list
* Timeline

The Subversion URL for this space is: http://tools.assembla.com/svn/sqlyzer

The owner is [email protected]

Send me an email to my gmail account if you are interested in helping this project.