use strict; use DBI; my $pc_csv_query_string = shift or die "usage perflogquery "; my $pc_csv_file_name = "perfdata.csv"; my $pc_csv_db_handle; my $pc_query_stmt_handle; $@ = ""; eval{ #Connect to CSV file or database if you will. $pc_csv_db_handle = DBI->connect( "DBI:CSV:f_dir=.", { PrintError => 1, RaiseError => 1, AutoCommit => 0 } ); #Turn on tracing with trace_level 2 DBI->trace( 2, 'parse_csv_trace.log' ); #We will be working with individual files for now. Maybe in the #future, we can move to using multiple files. Here we are binding #the perfmon table to a csv file. $pc_csv_db_handle -> {csv_tables} -> {perfmon} = { file => $pc_csv_file_name, }; #$pc_csv_db_handle -> {raw_header} = 1; not much use even if we use raw_header. #Prepare statement for exection. $pc_query_stmt_handle = $pc_csv_db_handle -> prepare("$pc_csv_query_string"); #Execute the statement $pc_query_stmt_handle -> execute(); # Retrieve the returned rows of data.Need to work on this. while ( my @row = $pc_query_stmt_handle->fetchrow_array() ) { print ("@row \n"); } #Clean up $pc_query_stmt_handle -> finish(); $pc_csv_db_handle -> disconnect(); }; $@ and die "SQL database error: $@";