File: run-sql.pl

package info (click to toggle)
libdbix-runsql-perl 0.25-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 248 kB
  • sloc: perl: 786; sql: 26; makefile: 10
file content (79 lines) | stat: -rw-r--r-- 1,287 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/perl -w
use strict;
use warnings;
use DBIx::RunSQL;

our $VERSION = '0.25';

my $exitcode = DBIx::RunSQL->handle_command_line('myapp', \@ARGV);
exit $exitcode;

=head1 NAME

run-db.pl - Run SQL

=head1 SYNOPSIS

  run-sql.pl "select * from mytable where 1=0"

  run-sql.pl --sql create-table.sql

  echo "select * from mytable where 1=0" | run-sql.pl

=head1 ABSTRACT

This sets up the database. The following
options are recognized:

=head1 OPTIONS

=over 4

=item C<--user> USERNAME

=item C<--password> PASSWORD

=item C<--dsn> DSN

The DBI DSN to use for connecting to
the database

=item C<--sql> SQLFILE

The alternative SQL file to use
instead of what is passed on the command line.

=item C<--quiet>

Output no headers for empty SELECT resultsets

=item C<--bool>

Set the exit code to 1 if at least one result row was found

=item C<--string>

Output the (single) column that the query returns as a string without
any headers

=item C<--format> formatter

Use a different formatter for table output. Supported formatters are

  tab - output results as tab delimited columns

  Text::Table - output results as ASCII table

  Text::Table::Any - output results as various formats

=item C<--force>

Don't stop on errors

=item C<--help>

Show this message.

=back

=cut