[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] SqlStatement 1.0.0 - hide the syntax of SQL behind familiar ruby syntax

Ken Bloom

10/9/2006 2:45:00 PM

sqlstatement - Generate complex SQL statements programmatically

The main goal of this library is to be able to construct an SQL
statement from "slices" that concern different aspects of the final
query (perhaps in different places in your code) and then combine them
all together into one statement easily.

Another important goal of this library is to give some consistent Ruby
syntax to three statements (INSERT, SELECT, and UPDATE) that seem to
have different enough syntax that one has two write different code to
generate each kind of statement.

I use my SQL database (specifically MySQL) largely as a bulk data
processing engine, by doing INSERT...SELECT or CREATE TABLE...SELECT
statements. This library is intended to make that kind of coding easier.
I expect that Object Relational mappers (such as ActiveRecord) are more
useful for most people, who are performing queries and
inserting/updating/querying for individual records. I have nevertheless
added INSERT...VALUES statements, and will add other statements soon, for
consistency.

This library is inspired by CLSQL for Common LISP, or SchemeQL for
Scheme, although it is very different from these two libraries. Scheme
and LISPâ??s use of s-expressions make it very easy to construct an entire
sublanguage for the WHERE clause, simply by list parsing. The Criteria
library for Ruby has attempted this, but in a more limited manner than
SchemeQL or CLSQL. My library aims to cover much of the functionality in
these libraries.

This library doesnâ??t try to abstract out the limitations of your DBMS,
and I think that the SQL it uses should be fairly portable, in large
measure because it hasnâ??t attempted to deal with serious CREATE TABLE
statements, where a lot of syntax concerning types, keys and sequences
is much more variable.

This library can be downloaded from
http://rubyforge.org/projects/sql...
Its rdoc documentation is online at http://sqlstatement.ruby...

License: BSD license

--
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu...
I've added a signing subkey to my GPG key. Please update your keyring.
3 Answers

Ezra Zygmuntowicz

10/9/2006 6:22:00 PM

0


On Oct 9, 2006, at 7:50 AM, Ken Bloom wrote:

> sqlstatement - Generate complex SQL statements programmatically
>
> The main goal of this library is to be able to construct an SQL
> statement from "slices" that concern different aspects of the final
> query (perhaps in different places in your code) and then combine them
> all together into one statement easily.
>
> Another important goal of this library is to give some consistent Ruby
> syntax to three statements (INSERT, SELECT, and UPDATE) that seem to
> have different enough syntax that one has two write different code to
> generate each kind of statement.
>
> I use my SQL database (specifically MySQL) largely as a bulk data
> processing engine, by doing INSERT...SELECT or CREATE TABLE...SELECT
> statements. This library is intended to make that kind of coding
> easier.
> I expect that Object Relational mappers (such as ActiveRecord) are
> more
> useful for most people, who are performing queries and
> inserting/updating/querying for individual records. I have
> nevertheless
> added INSERT...VALUES statements, and will add other statements
> soon, for
> consistency.
>
> This library is inspired by CLSQL for Common LISP, or SchemeQL for
> Scheme, although it is very different from these two libraries. Scheme
> and LISP‘s use of s-expressions make it very easy to construct an
> entire
> sublanguage for the WHERE clause, simply by list parsing. The Criteria
> library for Ruby has attempted this, but in a more limited manner than
> SchemeQL or CLSQL. My library aims to cover much of the
> functionality in
> these libraries.
>
> This library doesn‘t try to abstract out the limitations of your DBMS,
> and I think that the SQL it uses should be fairly portable, in large
> measure because it hasn‘t attempted to deal with serious CREATE TABLE
> statements, where a lot of syntax concerning types, keys and sequences
> is much more variable.
>
> This library can be downloaded from
> http://rubyforge.org/projects/sql...
> Its rdoc documentation is online at http://sqlstatement.ruby...
>
> License: BSD license
>
> --
> Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
>


Hi Ken-

This sounds really cool. But I don't see any examples really in the
docs. Do you have a page with some simple examples of how you would
use this and why its so cool?

Cheers-
-Ezra




Ken Bloom

10/9/2006 6:32:00 PM

0

On Tue, 10 Oct 2006 03:21:35 +0900, Ezra Zygmuntowicz wrote:

> On Oct 9, 2006, at 7:50 AM, Ken Bloom wrote:
>
>> sqlstatement - Generate complex SQL statements programmatically
>>
>> The main goal of this library is to be able to construct an SQL
>> statement from "slices" that concern different aspects of the final
>> query (perhaps in different places in your code) and then combine them
>> all together into one statement easily.
>>
>> Another important goal of this library is to give some consistent Ruby
>> syntax to three statements (INSERT, SELECT, and UPDATE) that seem to
>> have different enough syntax that one has two write different code to
>> generate each kind of statement.
>>
>> I use my SQL database (specifically MySQL) largely as a bulk data
>> processing engine, by doing INSERT...SELECT or CREATE TABLE...SELECT
>> statements. This library is intended to make that kind of coding
>> easier.
>> I expect that Object Relational mappers (such as ActiveRecord) are
>> more
>> useful for most people, who are performing queries and
>> inserting/updating/querying for individual records. I have
>> nevertheless
>> added INSERT...VALUES statements, and will add other statements
>> soon, for
>> consistency.
>>
>> This library is inspired by CLSQL for Common LISP, or SchemeQL for
>> Scheme, although it is very different from these two libraries. Scheme
>> and LISPâ??s use of s-expressions make it very easy to construct an
>> entire
>> sublanguage for the WHERE clause, simply by list parsing. The Criteria
>> library for Ruby has attempted this, but in a more limited manner than
>> SchemeQL or CLSQL. My library aims to cover much of the
>> functionality in
>> these libraries.
>>
>> This library doesnâ??t try to abstract out the limitations of your DBMS,
>> and I think that the SQL it uses should be fairly portable, in large
>> measure because it hasnâ??t attempted to deal with serious CREATE TABLE
>> statements, where a lot of syntax concerning types, keys and sequences
>> is much more variable.
>>
>> This library can be downloaded from
>> http://rubyforge.org/projects/sql...
>> Its rdoc documentation is online at http://sqlstatement.ruby...
>>
>> License: BSD license
>>
>> --
>> Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
>>
>
>
> Hi Ken-
>
> This sounds really cool. But I don't see any examples really in the
> docs. Do you have a page with some simple examples of how you would
> use this and why its so cool?
>
> Cheers-
> -Ezra

I've got an example.rb file in the gem (in bin/). I wasn't sure where the
best place was to put it in the gem, so if you know of another more
visible place (where it won't get documented like it's part of the
library), I'll happily move it there.

--Ken

--
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu...
I've added a signing subkey to my GPG key. Please update your keyring.

Ara.T.Howard

10/9/2006 6:47:00 PM

0