Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Rose::DB::Object::QueryBuilder 0.764

    Download button

    No screenshots available
    Downloads: 387  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    John C. Siracusa | More programs
    Perl Artistic License / FREE
    July 4th, 2007, 04:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    Rose::DB::Object::QueryBuilder description

    Rose::DB::Object::QueryBuilder is a Perl module that can build SQL queries on behalf of Rose::DB::Object::Manager.

    Rose::DB::Object::QueryBuilder is a Perl module that can build SQL queries on behalf of Rose::DB::Object::Manager.

    SYNOPSIS

    use Rose::DB::Object::QueryBuilder qw(build_select);

    # Build simple query
    $sql = build_select
    (
    dbh => $dbh,
    select => 'COUNT(*)',
    tables => [ 'articles' ],
    columns => { articles => [ qw(id category type title date) ] },
    query =>
    [
    category => [ 'sports', 'science' ],
    type => 'news',
    title => { like => [ '%million%',
    '%resident%' ] },
    ],
    query_is_sql => 1);

    $sth = $dbh->prepare($sql);
    $dbh->execute;
    $count = $sth->fetchrow_array;

    ...

    # Return query with placeholders, plus bind values
    ($sql, $bind) = build_select
    (
    dbh => $dbh,
    tables => [ 'articles' ],
    columns => { articles => [ qw(id category type title date) ] },
    query =>
    [
    category => [ 'sports', 'science' ],
    type => 'news',
    title => { like => [ '%million%',
    '%resident%' ] },
    ],
    query_is_sql => 1,
    sort_by => 'title DESC, category',
    limit => 5);

    $sth = $dbh->prepare($sql);
    $dbh->execute(@$bind);

    while($row = $sth->fetchrow_hashref) { ... }

    ...

    # Coerce query values into the right format
    ($sql, $bind) = build_select
    (
    db => $db,
    tables => [ 'articles' ],
    columns => { articles => [ qw(id category type title date) ] },
    classes => { articles => 'Article' },
    query =>
    [
    type => 'news',
    date => { lt => 'now' },
    date => { gt => DateTime->new(...) },
    ],
    sort_by => 'title DESC, category',
    limit => 5);

    $sth = $dbh->prepare($sql);
    $dbh->execute(@$bind);

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    build SQL queries | Rose::DB::Object::Manager query builder | Perl module | Rose::DB::Object::Qu | build | SQL

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM