| Index | index by Group | index by Distribution | index by Vendor | index by creation date | index by Name | Mirrors | Help | Search |
| Name: perl-Mojo-SQL | Distribution: openSUSE Tumbleweed |
| Version: 0.20.0 | Vendor: openSUSE |
| Release: 1.3 | Build date: Fri May 22 12:27:28 2026 |
| Group: Unspecified | Build host: reproducible |
| Size: 17090 | Source RPM: perl-Mojo-SQL-0.20.0-1.3.src.rpm |
| Packager: http://bugs.opensuse.org | |
| Url: https://metacpan.org/release/Mojo-SQL | |
| Summary: Safely generate and compose SQL statements | |
Mojo::SQL safely generates and composes SQL statements. To prevent SQL
injection attacks, every '?' in the input becomes a placeholder in the
generated query, with the corresponding value bound to it. Partial
statements can be composed recursively to build more complex queries.
Literal question marks can be escaped with '??'.
use Mojo::SQL qw(sql);
my $role = 'admin';
my $partial = sql('AND role = ?', $role);
my $name = 'root';
my $query = sql('SELECT * FROM users WHERE name = ? ?', $name, $partial)->to_query;
Make partial statements optional to dynamically generate 'WHERE' clauses.
my $optional = $foo ? sql('AND foo IS NOT NULL') : sql('');
my $query = sql('SELECT * FROM users WHERE name = ? ?', 'sebastian', $optional)->to_query;
If you need a little more control over the generated SQL query, you can
also bypass safety features with "sql_unsafe". But make sure to handle
unsafe values yourself with appropriate escaping functions for your
database. For PostgreSQL there are "escape_literal" and "escape_identifier"
functions included with this module.
use Mojo::SQL qw(sql sql_unsafe escape_literal);
my $role = 'role = ' . escape_literal('power user');
my $partial = sql_unsafe 'AND ?', $role;
my $name = 'root';
my $query = sql('SELECT * FROM users WHERE name = ? ?', $name, $partial)->to_query;
For databases that do not support numbered placeholders like '$1' and '$2',
you can set a custom character with the 'placeholder' option.
my $query = sql('SELECT * FROM users WHERE name = ?', 'root')->to_query({placeholder => '?'});
MIT
* Fri May 22 2026 Tina Müller <tina.mueller@suse.com>
- initial package 0.20.0 (0.02)
* created by cpanspec 1.84.01
/usr/lib/perl5/vendor_perl/5.44.0/Mojo /usr/lib/perl5/vendor_perl/5.44.0/Mojo/SQL /usr/lib/perl5/vendor_perl/5.44.0/Mojo/SQL.pm /usr/lib/perl5/vendor_perl/5.44.0/Mojo/SQL/Statement.pm /usr/share/doc/packages/perl-Mojo-SQL /usr/share/doc/packages/perl-Mojo-SQL/Changes /usr/share/doc/packages/perl-Mojo-SQL/README.md /usr/share/licenses/perl-Mojo-SQL /usr/share/licenses/perl-Mojo-SQL/LICENSE /usr/share/man/man3/Mojo::SQL.3pm.gz /usr/share/man/man3/Mojo::SQL::Statement.3pm.gz
Generated by rpm2html 1.8.1
Fabrice Bellet, Sun Aug 2 03:14:27 2026