summaryrefslogtreecommitdiff
path: root/build_playlists.plx
diff options
context:
space:
mode:
Diffstat (limited to 'build_playlists.plx')
-rwxr-xr-xbuild_playlists.plx9
1 files changed, 9 insertions, 0 deletions
diff --git a/build_playlists.plx b/build_playlists.plx
index dd8ec9d..1534fbe 100755
--- a/build_playlists.plx
+++ b/build_playlists.plx
@@ -85,6 +85,7 @@ for (my $i = 0; $i <= $#ARGV; $i++){
}
}
+# Connect to database file
my $dbh = DBI->connect("DBI:SQLite:dbname=$dbname", "", "", { RaiseError => 1}) or die $DBI::errstr;
# DEBUG
print "Opened database successfully\n";
@@ -94,3 +95,11 @@ $statement = "SELECT count(*) FROM sqlite_master WHERE type='table' AND name='$t
if (!db_cmd($dbh, $statement)){
die "Error: table \"$table_name\" does not exist in $dbname";
}
+
+# If sql mode is turned on, build a playlist based on a query
+if ($options{sql}){
+ my @db_output = array_handler(db_cmd($dbh, $statement_arg, "SQL_STATEMENT returned successfully"));
+ for my $i (@db_output){
+ print "$i\n";
+ }
+}