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

Discussion in 'Ruby' started by Ken Bloom, Oct 9, 2006.

  1. Ken Bloom

    Ken Bloom Guest

    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/sqlstatement/
    Its rdoc documentation is online at http://sqlstatement.rubyforge.org/

    License: BSD license

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

  2. Re: [ANN] SqlStatement 1.0.0 - hide the syntax of SQL behind familiar ruby syntax

    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 =20
    > easier.
    > I expect that Object Relational mappers (such as ActiveRecord) are =20
    > more
    > useful for most people, who are performing queries and
    > inserting/updating/querying for individual records. I have =20
    > nevertheless
    > added INSERT...VALUES statements, and will add other statements =20
    > 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=91s use of s-expressions make it very easy to construct an =20=


    > 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 =20
    > functionality in
    > these libraries.
    >
    > This library doesn=91t 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=91t 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/sqlstatement/
    > Its rdoc documentation is online at http://sqlstatement.rubyforge.org/
    >
    > License: BSD license
    >
    > --=20
    > Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
    >



    Hi Ken-

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

    Cheers-
    -Ezra
    Ezra Zygmuntowicz, Oct 9, 2006
    #2
    1. Advertising

  3. Ken Bloom

    Ken Bloom Guest

    Re: [ANN] SqlStatement 1.0.0 - hide the syntax of SQL behindfamiliar ruby syntax

    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/sqlstatement/
    >> Its rdoc documentation is online at http://sqlstatement.rubyforge.org/
    >>
    >> 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/~kbloom1/
    I've added a signing subkey to my GPG key. Please update your keyring.
    Ken Bloom, Oct 9, 2006
    #3
  4. Ken Bloom

    Guest

    On Tue, 10 Oct 2006, Ken Bloom wrote:

    > 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


    here's the gemspec i use. it's for directories named 'libname-x.x.x', but you
    can ignore that part if you wish.


    ~: > cat a.rb
    lib, version = File::basename(File::dirname(File::expand_path(__FILE__))).split %r/-/, 2

    require 'rubygems'

    Gem::Specification::new do |spec|
    spec.name = lib
    spec.version = version
    spec.platform = Gem::platform::RUBY
    spec.summary = lib

    #
    # the important part
    #
    spec.files = Dir::glob "**/**"
    spec.executables = Dir::glob("bin/*").map{|exe| File::basename exe}

    spec.require_path = "lib"
    spec.autorequire = lib

    spec.has_rdoc = File::exist? "doc"
    spec.test_suite_file = "test/#{ lib }.rb" if File::directory? "test"

    spec.author = "Ara T. Howard"
    spec.email = ""
    spec.homepage = "http://codeforpeople.com/lib/ruby/#{ lib }/"
    end


    so, this just grabs everything. then you can make a dir called samples/,
    examples/, or whatever and it gets included.

    regards.

    -a
    --
    in order to be effective truth must penetrate like an arrow - and that is
    likely to hurt. -- wei wu wei
    , Oct 9, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    563
    Alphonse Giambrone
    Jun 28, 2003
  2. Jennyfer J Barco

    Menu options hide behind a grid

    Jennyfer J Barco, Sep 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    509
    Curt_C [MVP]
    Sep 22, 2004
  3. jef
    Replies:
    1
    Views:
    4,384
    Steve C. Orr [MVP, MCSD]
    Mar 21, 2005
  4. Gabriel

    Hide HTML section from code behind

    Gabriel, Aug 19, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    676
    Siva M
    Aug 19, 2006
  5. Ken Bloom
    Replies:
    1
    Views:
    201
    Ken Bloom
    Jan 20, 2008
Loading...

Share This Page