perl - DBD::CSV: Returns header in lower case -
I have a problem with the module DBD :: CSV v0.30 after updating the new version From, all headers in fetch_hashref are fewer cases instead of mixed cases.
The Finili data will be committed to a MySQL database and the column header must be mixed case.
It is a snippet of my script using DBD :: CSV
My $ Csv_dbh = dbi- & gt; Connect ("DBI: CSV: F_DIIR = \. Csv_eol = \ n"); $ Csv_dbh- & gt; {F_dir} = $ ElementConfig-> {_ DIR} if defined ($ ElementConfig-> {_ DIR}); $ Csv_dbh- & gt; {Csv_sep_char} = "$ separator" if (defined ($ separator)); $ Csv_dbh- & gt; {Csv_eol} = $ csv_eol if (defined ($ csv_eol)); $ Csv_dbh- & gt; {Csv_allow_whitespace} = $ csv_allow_whitespace if (defined ($ csv_allow_whitespace)); My $ CSV_Select; Unless (defined ($ ref_FullSQLSt)) {// standard "SELECT * FROM filname.txt" $ CSV_Select = "SELECT". $ {$ Ref_CSV Select} "$ From File" $ {$ Ref_CSVWhere}; } And {$ CSV_Select = $ {$ ref_FullSQLSt}; } My $ sth = $ csv_dbh- & gt; Ready ($ CSV_Select); My $ res = $ sth- & gt; carry about (); While (my $ line = $ sth-> fetchrow_hashref ()) {my $ PKeys = $ index; ($ ElementConfig- & gt; {_ FILES} - & gt; {$ File} - & gt; {_dkey}) {my $ NewPKeys = ""; My $ key (partition (/ \ s * {If (defined) ($ line-> $ {Key} - {$ {$ FILE} - {ElementConfig- & gt; {_ FILES} - & gt; {$ file} - & gt; {_dkey}) }} {$ NewPKeys. $$ line-> {$ key};}} $ PKeys = $ NewPKeys if ($ NewPKeys);} {$ DATA->) {$ DataHash-> {$ DBConfig- & Gt; {TBLPREFIX} $ ElementConfig-> - & gt; {$ File} - & gt; {_ dtbl}} - & gt; {$ PKeys} = $ line; $ index ++;} }
This is a snippet of csv file:
CELL DATE avgRxLevUl avgRxLevDl RXQUALUL0 RTAL3D 08.12.2009 15:50 -96.25072834-92.32065149 179594
Really fetchrow_hashref looks like this:
$ var-> {'cell' => 'RTAL3D', 'Date' => '08 .12.2009 ',' avgrxlevu1 '=> -96.25072834 ...}
I have tried many things with the $ sth-> fetchrow_hashref () method I used the parameter "NAME", "NAME_lc" and "NAME_uc" first and second headers lowercase and the third Converts from uppercase to
Thank you for your help.
If you are using q (SELECT * FROM tbl),
, SQL :: statement
converts short case identifier. Due to some internal issues in processing it was necessary. To get mixed case column names, ask them with the names you need:
q (SELECT CELL, DATE, avgRxLevUl, avgRxLevDl, RXQUALUL0 to Tbl)
Comments
Post a Comment