summaryrefslogtreecommitdiff
path: root/shared.pl
blob: ea2fdfd3a382b271e2357178e3275f8c1ce1bb46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File to hold shared variables and subroutines


# Wrapper to handle sqlite commands, return an array of returned lines from sqlite output
# 	@_[0]            -> database handle
# 	@_[1]            -> command/statement
# 	@_[2] (optional) -> output statement
sub db_cmd {
	my $sth = $_[0]->prepare($_[1]);

	if ($sth->execute < 0){
		die $DBI::errstr;
	}

	# DEBUG
	if (!$options{quiet} and defined $_[2]){
		print "$_[2]\n";
	}

	# Build output array
	return($sth->fetchrow_array);
}

1;