DBD::CSV, or at least the current version 0.48 
<http://search.cpan.org/~hmbrand/DBD-CSV-0.48/lib/DBD/CSV.pm> uses 
SQL::Statement for it’s syntax . See 
<http://search.cpan.org/~rehsack/SQL-Statement-1.407/lib/SQL/Statement/Syntax.pod#Identifiers_(table_&_column_names)>

This might help you get started.

Another, cruder, solution might be to simply change the column header “DESC” to 
something acceptable to SQL in the csv file before parsing it with your sql 
statement, then changing it back before exporting it. 

And this is quite old, but relevant to your question 
<http://www.perlmonks.org/?node_id=673399> indicating that this line of 
research is on the right track, I think.


> 
> 
> On 2015-08-18 7:21 AM, Adkins, Blake wrote:
>> Let me do a better job of explaining the situation. We use GE's Cimplicity 
>> to monitor and control a SCADA system. GE provides an interface to the 
>> database but it's very limited. The easiest way is to export to a .csv file 
>> and operate on that and then import changes. My script works on the .csv 
>> file using dbi:CSV:f_dir and pointing to different files for different 
>> projects. The problem comes when I try to include DESC in SELECT or WHERE. I 
>> have tried 'DESC', "DESC" and `DESC`. The last two fail at run-time. The 
>> first one doesn't fail but it returns something like
>>      PT_ID,DESC
>>      PT_1,DESC
>>      PT_2,DESC
>>      ...
>>      PT_N,DESC.
>> I'm using the DBI module in Perl, would this be better with the other 
>> modules mentioned?


-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs

Reply via email to