/usr/share/doc/libnetsds-perl/examples/testdb.pl is in libnetsds-perl 1.301-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/env perl
use 5.8.0;
use strict;
use warnings;
use NetSDS::DBI;
use NetSDS::DBI::Table;
use Data::Dumper;
my $db = NetSDS::DBI->new(
dsn => 'dbi:Pg:dbname=test_netsds;host=192.168.1.50;port=5432',
login => 'netsds',
passwd => '',
);
#print Dumper($db);
#print Dumper($db->dbh->selectrow_hashref("select md5('sdasd')"));
#print $db->call("select md5(?)", 'zuka')->fetchrow_hashref->{md5};
#print Dumper($db->call('select * from auth.groups where $1 @> array[id]', [2,6])->fetchall_hashref("id"));
my $tbl = NetSDS::DBI::Table->new(
dsn => 'dbi:Pg:dbname=test_netsds;host=192.168.1.50;port=5432',
login => 'netsds',
passwd => '',
table => 'auth.users',
);
#print $tbl->insert_row(
# login => 'vasya',
# password => 'zzz',
#);
#my @uids = $tbl->insert(
# { login => 'masha', password => 'zzz', },
# { login => 'lena', password => 'zzz', active => 'false' },
#);
#
#print "Inserted: " . join (', ', @uids) . "\n";
$tbl->update(
filter => ["login = 'misha'"],
set => {
active => 'false',
}
);
$tbl->update_row(2, active => 'true');
my @res = $tbl->fetch(
fields => [ 'login', 'id', 'active as act' ],
#filter => [ 'active = true', 'expire > now()' ],
order => ['login'],
);
warn Dumper( \@res );
1;
|