8
0
Files
perl-SQL-Abstract/perl-SQL-Abstract.spec
Stephan Kulow 4706e7316f Accepting request 177566 from home:coolo:update-perl
- updated to 1.73
    - Fix parsing of ORDER BY foo + ?
    - Stop filling in placeholders in `format-sql` since it does not support
      passing values for them anyway
    - Fix parsing of NOT EXISTS
    - Fix over-eager parenthesis unrolling
    - Fix deep recursion warnings while parsing obnoxiously long sql statements
    - Fix incorrect comparison of malformed lists
    - Fix incorrect reporting of mismatch-members in SQLA::Test
    - Migrate the -ident operator from DBIC into SQLA
    - Migrate the -value operator from DBIC into SQLA

OBS-URL: https://build.opensuse.org/request/show/177566
OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-SQL-Abstract?expand=0&rev=8
2013-06-04 18:17:14 +00:00

121 lines
4.1 KiB
RPMSpec

#
# spec file for package perl-SQL-Abstract
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-SQL-Abstract
Version: 1.73
Release: 0
%define cpan_name SQL-Abstract
Summary: Generate SQL from Perl data structures
License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/SQL-Abstract/
Source: http://www.cpan.org/authors/id/F/FR/FREW/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Class::Accessor::Grouped) >= 0.10005
BuildRequires: perl(Getopt::Long::Descriptive) >= 0.091
BuildRequires: perl(Hash::Merge) >= 0.12
BuildRequires: perl(Test::Exception)
BuildRequires: perl(Test::More) >= 0.92
BuildRequires: perl(Test::Warn)
#BuildRequires: perl(CPANPLUS::Backend)
#BuildRequires: perl(DBIx::Class::Storage::Debug::PrettyPrint)
#BuildRequires: perl(DBIx::Class::Storage::Statistics)
#BuildRequires: perl(inc::Module::Install) >= 1.06
#BuildRequires: perl(JSON)
#BuildRequires: perl(LWP::Simple)
#BuildRequires: perl(Module::AutoInstall)
#BuildRequires: perl(Module::Build)
#BuildRequires: perl(Module::Install::Base)
#BuildRequires: perl(Parse::CPAN::Meta)
#BuildRequires: perl(SQL::Abstract)
#BuildRequires: perl(SQL::Abstract::Test)
#BuildRequires: perl(SQL::Abstract::Tree)
#BuildRequires: perl(YAML::Tiny)
Requires: perl(Class::Accessor::Grouped) >= 0.10005
Requires: perl(Getopt::Long::Descriptive) >= 0.091
Requires: perl(Hash::Merge) >= 0.12
%{perl_requires}
%description
This module was inspired by the excellent the DBIx::Abstract manpage.
However, in using that module I found that what I really wanted to do was
generate SQL, but still retain complete control over my statement handles
and use the DBI interface. So, I set out to create an abstract SQL
generation module.
While based on the concepts used by the DBIx::Abstract manpage, there are
several important differences, especially when it comes to WHERE clauses. I
have modified the concepts used to make the SQL easier to generate from
Perl data structures and, IMO, more intuitive. The underlying idea is for
this module to do what you mean, based on the data structures you provide
it. The big advantage is that you don't have to modify your code every time
your data changes, as this module figures it out.
To begin with, an SQL INSERT is as easy as just specifying a hash of
'key=value' pairs:
my %data = (
name => 'Jimbo Bobson',
phone => '123-456-7890',
address => '42 Sister Lane',
city => 'St. Louis',
state => 'Louisiana',
);
The SQL can then be generated with this:
my($stmt, @bind) = $sql->insert('people', \%data);
Which would give you something like this:
$stmt = "INSERT INTO people
(address, city, name, phone, state)
VALUES (?, ?, ?, ?, ?)";
@bind = ('42 Sister Lane', 'St. Louis', 'Jimbo Bobson',
'123-456-7890', 'Louisiana');
These are then used directly in your DBI code:
my $sth = $dbh->prepare($stmt);
$sth->execute(@bind);
%prep
%setup -q -n %{cpan_name}-%{version}
find . -type f -print0 | xargs -0 chmod 644
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes examples
%changelog