SQL::Abstract

SQL::Abstract

Latest version: 2.000003 registry icon
Maintenance score
49
Safety score
90
Popularity score
17
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
2.000003 0 0 0 0 0
2.000003 0 0 0 0 0
2.000002 0 0 0 1 0
2.000002 0 0 0 1 0
2.000001_05 0 0 0 1 0
2.000001_05 0 0 0 1 0
2.000001_04 0 0 0 1 0
2.000001_04 0 0 0 1 0
2.000001_03 0 0 0 1 0
2.000001_03 0 0 0 1 0
2.000001_02 0 0 0 1 0
2.000001_02 0 0 0 1 0
2.000001_01 0 0 0 1 0
2.000001_01 0 0 0 1 0
2.000001 0 0 0 1 0
2.000000 0 0 0 1 0
2.000000 0 0 0 1 0
2.000000 0 0 0 1 0
1.99_01 0 0 0 1 0
1.90_03 0 0 0 1 0
1.90_02 0 0 0 1 0
1.90_01 0 0 0 1 0
1.87 0 0 0 1 0
1.86 0 0 0 1 0
1.85 0 0 0 1 0
1.84 0 0 0 1 0
1.83 0 0 0 1 0
1.82 0 0 0 1 0
1.81_01 0 0 0 1 0
1.81 0 0 0 1 0
1.80 0 0 0 1 0
1.79_01 0 0 0 1 0
1.79 0 0 0 1 0
1.78_05 0 0 0 1 0
1.78_04 0 0 0 1 0
1.78_03 0 0 0 1 0
1.78_02 0 0 0 1 0
1.78_01 0 0 0 1 0
1.78 0 0 0 1 0
1.77 0 0 0 1 0
1.76 0 0 0 1 0
1.75_01 0 0 0 1 0
1.75 0 0 0 1 0
1.74_02 0 0 0 1 0
1.74_01 0 0 0 1 0
1.74 0 0 0 1 0
1.73_01 0 0 0 1 0
1.73 0 0 0 1 0
1.72_01 0 0 0 1 0
1.72 0 0 0 1 0
1.70 0 0 0 1 0
1.70 0 0 0 1 0
1.69 0 0 0 1 0
1.68 0 0 0 1 0
1.67_03 0 0 0 1 0
1.67_02 0 0 0 1 0
1.67_01 0 0 0 1 0
1.67 0 0 0 1 0
1.66 0 0 0 1 0
1.65 0 0 0 1 0
1.64 0 0 0 1 0
1.63 0 0 0 1 0
1.62 0 0 0 1 0
1.61 0 0 0 1 0
1.60 0 0 0 1 0
1.59 0 0 0 1 0
1.58 0 0 0 1 0
1.57 0 0 0 1 0
1.56 0 0 0 1 0
1.55 0 0 0 1 0
1.54 0 0 0 1 0
1.53 0 0 0 1 0
1.52 0 0 0 1 0
1.51 0 0 0 1 0
1.50 0 0 0 1 0
1.49_04 0 0 0 1 0
1.49_03 0 0 0 1 0
1.49_02 0 0 0 1 0
1.49_01 0 0 0 1 0
1.24 0 0 0 1 0
1.23 0 0 0 1 0
1.22 0 0 0 1 0
1.21 0 0 0 1 0
1.20 0 0 0 1 0
1.19 0 0 0 1 0
1.18 0 0 0 1 0
1.17 0 0 0 1 0
1.15 0 0 0 1 0
1.14 0 0 0 1 0
1.13 0 0 0 1 0
1.10 0 0 0 1 0
1.09 0 0 0 1 0

Stability
Latest release:

2.000003 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Artistic-1.0   -   Artistic License 1.0

Not a wildcard

Not proprietary

OSI Compliant


GPL-1.0-or-later   -   GNU General Public License v1.0 or later

Not a wildcard

Not proprietary

OSI Compliant



SQL::Abstract

Generate SQL from Perl data structures.

SQL::Abstract turns Perl hashes and arrays into an SQL statement plus a list of bind values, ready for DBI. Values always end up as bind values, never in the SQL text.

use SQL::Abstract;

my $sql = SQL::Abstract->new;

my ($stmt, @bind) = $sql->select(
  'people',
  [qw(name email)],
  { status => 'active', age => { '>' => 18 } },
  'name',
);
# $stmt: SELECT name, email FROM people WHERE ( age > ? AND status = ? ) ORDER BY name
# @bind: (18, 'active')

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

The same works for insert, update, delete and plain where. See the full documentation on MetaCPAN.

The distribution also contains:

Installation

cpanm SQL::Abstract

From a git checkout:

perl Makefile.PL
make
make test
make install

DBIx::Class and DBIO

DBIx::Class no longer uses this module: since 0.082842 it uses SQL::Abstract::Classic, a frozen copy of the 1.x line.

DBIO, a fork of DBIx::Class, builds its SQL with SQL::Abstract 2.x and uses SQL::Abstract::Tree for its query trace.

Support

Security issues: please do not report them publicly, see SECURITY.md.

License

Copyright (c) 2001-2026 Nathan Wiger and the SQL::Abstract contributors.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. See LICENSE.