commit perl-Mojo-SQLite for openSUSE:Factory

Hello community, here is the log from the commit of package perl-Mojo-SQLite for openSUSE:Factory checked in at 2017-02-21 13:51:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojo-SQLite (Old) and /work/SRC/openSUSE:Factory/.perl-Mojo-SQLite.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Mojo-SQLite" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojo-SQLite/perl-Mojo-SQLite.changes 2017-02-14 00:48:31.661165285 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojo-SQLite.new/perl-Mojo-SQLite.changes 2017-02-21 13:51:46.316349123 +0100 @@ -1,0 +2,10 @@ +Sun Feb 19 07:00:27 UTC 2017 - coolo@suse.com + +- updated to 2.001 + see /usr/share/doc/packages/perl-Mojo-SQLite/Changes + + 2.001 2017-02-18 15:36:16 EST + - Set name_sep in default SQL::Abstract object to support proper quoting of + table and column names. + +------------------------------------------------------------------- Old: ---- Mojo-SQLite-2.000.tar.gz New: ---- Mojo-SQLite-2.001.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojo-SQLite.spec ++++++ --- /var/tmp/diff_new_pack.OpJZfw/_old 2017-02-21 13:51:46.744288891 +0100 +++ /var/tmp/diff_new_pack.OpJZfw/_new 2017-02-21 13:51:46.748288329 +0100 @@ -17,14 +17,14 @@ Name: perl-Mojo-SQLite -Version: 2.000 +Version: 2.001 Release: 0 %define cpan_name Mojo-SQLite Summary: Tiny Mojolicious Wrapper for Sqlite License: Artistic-2.0 Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Mojo-SQLite/ -Source0: http://www.cpan.org/authors/id/D/DB/DBOOK/%{cpan_name}-%{version}.tar.gz +Source0: https://cpan.metacpan.org/authors/id/D/DB/DBOOK/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -132,6 +132,7 @@ %files -f %{name}.files %defattr(-,root,root,755) -%doc Changes CONTRIBUTING.md examples LICENSE README +%doc Changes CONTRIBUTING.md examples README +%license LICENSE %changelog ++++++ Mojo-SQLite-2.000.tar.gz -> Mojo-SQLite-2.001.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/Build.PL new/Mojo-SQLite-2.001/Build.PL --- old/Mojo-SQLite-2.000/Build.PL 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/Build.PL 2017-02-18 21:36:20.000000000 +0100 @@ -84,7 +84,7 @@ "Dan Book <dbook\@cpan.org>" ], "dist_name" => "Mojo-SQLite", - "dist_version" => "2.000", + "dist_version" => "2.001", "license" => "artistic_2", "module_name" => "Mojo::SQLite", "recursive_test_files" => 1, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/Changes new/Mojo-SQLite-2.001/Changes --- old/Mojo-SQLite-2.000/Changes 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/Changes 2017-02-18 21:36:20.000000000 +0100 @@ -1,3 +1,7 @@ +2.001 2017-02-18 15:36:16 EST + - Set name_sep in default SQL::Abstract object to support proper quoting of + table and column names. + 2.000 2017-02-11 17:03:53 EST - Add support for generating queries with SQL::Abstract. (based on Mojo::Pg 3.0) - Add abstract attribute to Mojo::SQLite. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/META.json new/Mojo-SQLite-2.001/META.json --- old/Mojo-SQLite-2.000/META.json 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/META.json 2017-02-18 21:36:20.000000000 +0100 @@ -66,28 +66,28 @@ "provides" : { "Mojo::SQLite" : { "file" : "lib/Mojo/SQLite.pm", - "version" : "2.000" + "version" : "2.001" }, "Mojo::SQLite::Database" : { "file" : "lib/Mojo/SQLite/Database.pm", - "version" : "2.000" + "version" : "2.001" }, "Mojo::SQLite::Migrations" : { "file" : "lib/Mojo/SQLite/Migrations.pm", - "version" : "2.000" + "version" : "2.001" }, "Mojo::SQLite::PubSub" : { "file" : "lib/Mojo/SQLite/PubSub.pm", - "version" : "2.000", + "version" : "2.001", "x_deprecated" : 1 }, "Mojo::SQLite::Results" : { "file" : "lib/Mojo/SQLite/Results.pm", - "version" : "2.000" + "version" : "2.001" }, "Mojo::SQLite::Transaction" : { "file" : "lib/Mojo/SQLite/Transaction.pm", - "version" : "2.000" + "version" : "2.001" } }, "release_status" : "stable", @@ -103,7 +103,7 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "2.000", + "version" : "2.001", "x_Dist_Zilla" : { "perl" : { "version" : "5.024000" @@ -297,7 +297,7 @@ "branch" : null, "changelog" : "Changes", "signed" : 0, - "tag" : "v2.000", + "tag" : "v2.001", "tag_format" : "v%v", "tag_message" : "v%v" }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/META.yml new/Mojo-SQLite-2.001/META.yml --- old/Mojo-SQLite-2.000/META.yml 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/META.yml 2017-02-18 21:36:20.000000000 +0100 @@ -26,23 +26,23 @@ provides: Mojo::SQLite: file: lib/Mojo/SQLite.pm - version: '2.000' + version: '2.001' Mojo::SQLite::Database: file: lib/Mojo/SQLite/Database.pm - version: '2.000' + version: '2.001' Mojo::SQLite::Migrations: file: lib/Mojo/SQLite/Migrations.pm - version: '2.000' + version: '2.001' Mojo::SQLite::PubSub: file: lib/Mojo/SQLite/PubSub.pm - version: '2.000' + version: '2.001' x_deprecated: 1 Mojo::SQLite::Results: file: lib/Mojo/SQLite/Results.pm - version: '2.000' + version: '2.001' Mojo::SQLite::Transaction: file: lib/Mojo/SQLite/Transaction.pm - version: '2.000' + version: '2.001' requires: Carp: '0' DBD::SQLite: '1.50' @@ -61,7 +61,7 @@ bugtracker: https://github.com/Grinnz/Mojo-SQLite/issues homepage: https://github.com/Grinnz/Mojo-SQLite repository: https://github.com/Grinnz/Mojo-SQLite.git -version: '2.000' +version: '2.001' x_Dist_Zilla: perl: version: '5.024000' @@ -211,7 +211,7 @@ branch: ~ changelog: Changes signed: 0 - tag: v2.000 + tag: v2.001 tag_format: v%v tag_message: v%v Dist::Zilla::Role::Git::Repo: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/README new/Mojo-SQLite-2.001/README --- old/Mojo-SQLite-2.000/README 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/README 2017-02-18 21:36:20.000000000 +0100 @@ -26,26 +26,21 @@ # Use SQL::Abstract to generate simple CRUD queries for you $db->insert('names', {name => 'Isabel'}); - say $db->select('names', ['id'], {name => 'Isabel'})->hash->{id}; - $db->update('names', {name => 'Bel'}, {name => 'Isabel'}); + my $id = $db->select('names', ['id'], {name => 'Isabel'})->hash->{id}; + $db->update('names', {name => 'Bel'}, {id => $id}); $db->delete('names', {name => 'Bel'}); - # Insert a few rows - $db->query('insert into names (name) values (?)', 'Sara'); - $db->query('insert into names (name) values (?)', 'Stefan'); - - # Insert more rows in a transaction + # Insert a few rows in a transaction with SQL and placeholders eval { my $tx = $db->begin; - $db->query('insert into names (name) values (?)', 'Baerbel'); - $db->query('insert into names (name) values (?)', 'Wolfgang'); + $db->query('insert into names (name) values (?)', 'Sara'); + $db->query('insert into names (name) values (?)', 'Stefan'); $tx->commit; }; say $@ if $@; - # Insert another row and return the generated id - say $db->query('insert into names (name) values (?)', 'Daniel') - ->last_insert_id; + # Insert another row with SQL::Abstract and return the generated id + say $db->insert('names', {name => 'Daniel'})->last_insert_id; # JSON roundtrip say $db->query('select ? as foo', {json => {bar => 'baz'}}) @@ -57,8 +52,8 @@ say $next->{name}; } - # Select all rows - say $_->{name} for $db->query('select * from names')->hashes->each; + # Select all rows with SQL::Abstract + say $_->{name} for $db->select('names')->hashes->each; DESCRIPTION @@ -163,9 +158,11 @@ $sql = $sql->abstract(SQL::Abstract->new); SQL::Abstract object used to generate CRUD queries for - Mojo::SQLite::Database. + Mojo::SQLite::Database, defaults to setting name_sep to . and + quote_char to ". - my($stmt, @bind) = $sql->abstract->select('names'); + # Generate WHERE clause and bind values + my($stmt, @bind) = $sql->abstract->where({foo => 'bar', baz => 'yada'}); auto_migrate @@ -251,11 +248,12 @@ my $db = $sql->db; - Get a database object based on "database_class" for a cached or newly - established database connection. The DBD::SQLite database handle will - be automatically cached again when that object is destroyed, so you can - handle problems like connection timeouts gracefully by holding on to it - only for short amounts of time. + Get a database object based on "database_class" (which is usually + Mojo::SQLite::Database) for a cached or newly established database + connection. The DBD::SQLite database handle will be automatically + cached again when that object is destroyed, so you can handle problems + like connection timeouts gracefully by holding on to it only for short + amounts of time. # Add up all the money say $sql->db->select('accounts') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/examples/blog/lib/Blog.pm new/Mojo-SQLite-2.001/examples/blog/lib/Blog.pm --- old/Mojo-SQLite-2.000/examples/blog/lib/Blog.pm 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/examples/blog/lib/Blog.pm 2017-02-18 21:36:20.000000000 +0100 @@ -18,7 +18,7 @@ # Migrate to latest version if necessary my $path = $self->home->child('migrations', 'blog.sql'); - $self->sqlite->migrations->name('blog')->from_file($path)->migrate; + $self->sqlite->auto_migrate(1)->migrations->name('blog')->from_file($path); # Controller my $r = $self->routes; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/lib/Mojo/SQLite/Database.pm new/Mojo-SQLite-2.001/lib/Mojo/SQLite/Database.pm --- old/Mojo-SQLite-2.000/lib/Mojo/SQLite/Database.pm 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/lib/Mojo/SQLite/Database.pm 2017-02-18 21:36:20.000000000 +0100 @@ -10,7 +10,7 @@ use Mojo::Util qw(deprecated monkey_patch); use Scalar::Util 'weaken'; -our $VERSION = '2.000'; +our $VERSION = '2.001'; our @CARP_NOT = qw(Mojo::SQLite::Migrations); @@ -24,7 +24,7 @@ has results_class => 'Mojo::SQLite::Results'; for my $name (qw(delete insert select update)) { - monkey_patch __PACKAGE__, lc $name, sub { + monkey_patch __PACKAGE__, $name, sub { my ($self, @cb) = (shift, ref $_[-1] eq 'CODE' ? pop : ()); return $self->query($self->sqlite->abstract->$name(@_), @cb); }; @@ -393,6 +393,18 @@ }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running; +Use all the same argument variations you would pass to the C<delete> method of +L<SQL::Abstract>. + + # "delete from some_table" + $db->delete('some_table'); + + # "delete from some_table where foo = 'bar'" + $db->delete('some_table', {foo => 'bar'}); + + # "delete from some_table where foo like '%test%'" + $db->delete('some_table', {foo => {-like => '%test%'}}); + =head2 disconnect $db->disconnect; @@ -414,6 +426,12 @@ }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running; +Use all the same argument variations you would pass to the C<insert> method of +L<SQL::Abstract>. + + # "insert into some_table (foo, baz) values ('bar', 'yada')" + $db->insert('some_table', {foo => 'bar', baz => 'yada'}); + =head2 is_listening This method is L<DEPRECATED|Mojo::SQLite::PubSub/"DESCRIPTION">. @@ -440,11 +458,12 @@ my $results = $db->query('select ? as foo', {json => {bar => 'baz'}}); Execute a blocking L<SQL|http://www.postgresql.org/docs/current/static/sql.html> -statement and return a results object based on L</"results_class"> with the -query results. The L<DBD::SQLite> statement handle will be automatically reused -when it is not active anymore, to increase the performance of future queries. -You can also append a callback for API compatibility with L<Mojo::Pg>; the -query is still executed in a blocking manner. +statement and return a results object based on L</"results_class"> (which is +usually L<Mojo::SQLite::Results>) with the query results. The L<DBD::SQLite> +statement handle will be automatically reused when it is not active anymore, to +increase the performance of future queries. You can also append a callback for +API compatibility with L<Mojo::Pg>; the query is still executed in a blocking +manner. $db->query('insert into foo values (?, ?, ?)' => @values => sub { my ($db, $err, $results) = @_; @@ -480,6 +499,24 @@ }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running; +Use all the same argument variations you would pass to the C<select> method of +L<SQL::Abstract>. + + # "select * from some_table" + $db->select('some_table'); + + # "select id, foo from some_table" + $db->select('some_table', ['id', 'foo']); + + # "select * from some_table where foo = 'bar'" + $db->select('some_table', undef, {foo => 'bar'}); + + # "select * from some_table where foo = 'bar' order by id desc" + $db->select('some_table', undef, {foo => 'bar'}, {-desc => 'id'}); + + # "select * from some_table where foo like '%test%'" + $db->select('some_table', undef, {foo => {-like => '%test%'}}); + =head2 tables my $tables = $db->tables; @@ -512,6 +549,15 @@ }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running; +Use all the same argument variations you would pass to the C<update> method of +L<SQL::Abstract>. + + # "update some_table set foo = 'bar' where id = 23" + $db->update('some_table', {foo => 'bar'}, {id => 23}); + + # "update some_table set foo = 'bar' where foo like '%test%'" + $db->update('some_table', {foo => 'bar'}, {foo => {-like => '%test%'}}); + =head1 BUGS Report any issues on the public bugtracker. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/lib/Mojo/SQLite/Migrations.pm new/Mojo-SQLite-2.001/lib/Mojo/SQLite/Migrations.pm --- old/Mojo-SQLite-2.000/lib/Mojo/SQLite/Migrations.pm 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/lib/Mojo/SQLite/Migrations.pm 2017-02-18 21:36:20.000000000 +0100 @@ -8,7 +8,7 @@ use constant DEBUG => $ENV{MOJO_MIGRATIONS_DEBUG} || 0; -our $VERSION = '2.000'; +our $VERSION = '2.001'; has name => 'migrations'; has 'sqlite'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/lib/Mojo/SQLite/PubSub.pm new/Mojo-SQLite-2.001/lib/Mojo/SQLite/PubSub.pm --- old/Mojo-SQLite-2.000/lib/Mojo/SQLite/PubSub.pm 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/lib/Mojo/SQLite/PubSub.pm 2017-02-18 21:36:20.000000000 +0100 @@ -5,7 +5,7 @@ use Mojo::Util 'deprecated'; use Scalar::Util 'weaken'; -our $VERSION = '2.000'; +our $VERSION = '2.001'; has [qw(poll_interval sqlite)]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/lib/Mojo/SQLite/Results.pm new/Mojo-SQLite-2.001/lib/Mojo/SQLite/Results.pm --- old/Mojo-SQLite-2.000/lib/Mojo/SQLite/Results.pm 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/lib/Mojo/SQLite/Results.pm 2017-02-18 21:36:20.000000000 +0100 @@ -5,7 +5,7 @@ use Mojo::JSON 'from_json'; use Mojo::Util 'tablify'; -our $VERSION = '2.000'; +our $VERSION = '2.001'; has 'sth'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/lib/Mojo/SQLite/Transaction.pm new/Mojo-SQLite-2.001/lib/Mojo/SQLite/Transaction.pm --- old/Mojo-SQLite-2.000/lib/Mojo/SQLite/Transaction.pm 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/lib/Mojo/SQLite/Transaction.pm 2017-02-18 21:36:20.000000000 +0100 @@ -3,7 +3,7 @@ use Carp 'croak'; -our $VERSION = '2.000'; +our $VERSION = '2.001'; has 'db'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/lib/Mojo/SQLite.pm new/Mojo-SQLite-2.001/lib/Mojo/SQLite.pm --- old/Mojo-SQLite-2.000/lib/Mojo/SQLite.pm 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/lib/Mojo/SQLite.pm 2017-02-18 21:36:20.000000000 +0100 @@ -14,9 +14,9 @@ use URI; use URI::db; -our $VERSION = '2.000'; +our $VERSION = '2.001'; -has abstract => sub { SQL::Abstract->new(quote_char => '"') }; +has abstract => sub { SQL::Abstract->new(name_sep => '.', quote_char => '"') }; has 'auto_migrate'; has database_class => 'Mojo::SQLite::Database'; has dsn => sub { _url_from_file(shift->_tempfile)->dbi_dsn }; @@ -148,26 +148,21 @@ # Use SQL::Abstract to generate simple CRUD queries for you $db->insert('names', {name => 'Isabel'}); - say $db->select('names', ['id'], {name => 'Isabel'})->hash->{id}; - $db->update('names', {name => 'Bel'}, {name => 'Isabel'}); + my $id = $db->select('names', ['id'], {name => 'Isabel'})->hash->{id}; + $db->update('names', {name => 'Bel'}, {id => $id}); $db->delete('names', {name => 'Bel'}); - # Insert a few rows - $db->query('insert into names (name) values (?)', 'Sara'); - $db->query('insert into names (name) values (?)', 'Stefan'); - - # Insert more rows in a transaction + # Insert a few rows in a transaction with SQL and placeholders eval { my $tx = $db->begin; - $db->query('insert into names (name) values (?)', 'Baerbel'); - $db->query('insert into names (name) values (?)', 'Wolfgang'); + $db->query('insert into names (name) values (?)', 'Sara'); + $db->query('insert into names (name) values (?)', 'Stefan'); $tx->commit; }; say $@ if $@; - # Insert another row and return the generated id - say $db->query('insert into names (name) values (?)', 'Daniel') - ->last_insert_id; + # Insert another row with SQL::Abstract and return the generated id + say $db->insert('names', {name => 'Daniel'})->last_insert_id; # JSON roundtrip say $db->query('select ? as foo', {json => {bar => 'baz'}}) @@ -179,8 +174,8 @@ say $next->{name}; } - # Select all rows - say $_->{name} for $db->query('select * from names')->hashes->each; + # Select all rows with SQL::Abstract + say $_->{name} for $db->select('names')->hashes->each; =head1 DESCRIPTION @@ -280,9 +275,11 @@ $sql = $sql->abstract(SQL::Abstract->new); L<SQL::Abstract> object used to generate CRUD queries for -L<Mojo::SQLite::Database>. +L<Mojo::SQLite::Database>, defaults to setting C<name_sep> to C<.> and +C<quote_char> to C<">. - my($stmt, @bind) = $sql->abstract->select('names'); + # Generate WHERE clause and bind values + my($stmt, @bind) = $sql->abstract->where({foo => 'bar', baz => 'yada'}); =head2 auto_migrate @@ -369,11 +366,11 @@ my $db = $sql->db; -Get a database object based on L</"database_class"> for a cached or newly -established database connection. The L<DBD::SQLite> database handle will be -automatically cached again when that object is destroyed, so you can handle -problems like connection timeouts gracefully by holding on to it only for short -amounts of time. +Get a database object based on L</"database_class"> (which is usually +L<Mojo::SQLite::Database>) for a cached or newly established database +connection. The L<DBD::SQLite> database handle will be automatically cached +again when that object is destroyed, so you can handle problems like connection +timeouts gracefully by holding on to it only for short amounts of time. # Add up all the money say $sql->db->select('accounts') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-SQLite-2.000/t/crud.t new/Mojo-SQLite-2.001/t/crud.t --- old/Mojo-SQLite-2.000/t/crud.t 2017-02-11 23:03:56.000000000 +0100 +++ new/Mojo-SQLite-2.001/t/crud.t 2017-02-18 21:36:20.000000000 +0100 @@ -62,6 +62,19 @@ ->hashes->to_array, [{id => 2, name => 'bar'}], 'right structure'; $db->delete('crud_test'); is_deeply $db->select('crud_test')->hashes->to_array, [], 'right structure'; + + # Quoting + $db->query( + 'create table if not exists crud_test2 ( + id integer primary key autoincrement, + "t e s t" text + )' + ); + $db->insert('crud_test2', {'t e s t' => 'foo'}); + $db->insert('main.crud_test2', {'t e s t' => 'bar'}); + is_deeply $db->select('main.crud_test2')->hashes->to_array, + [{id => 1, 't e s t' => 'foo'}, {id => 2, 't e s t' => 'bar'}], + 'right structure'; } done_testing();
participants (1)
-
root@hilbertn.suse.de