PHP Classes

Some error with CSV Handler

Recommend this page to a friend!

      CSV Handler  >  All threads  >  Some error with CSV Handler  >  (Un) Subscribe thread alerts  
Subject:Some error with CSV Handler
Summary:Some error with CSV Handler
Messages:2
Author:Piersante Blasioli
Date:2012-10-09 16:56:28
Update:2012-10-09 22:36:13
 

  1. Some error with CSV Handler   Reply   Report abuse  
Picture of Piersante Blasioli Piersante Blasioli - 2012-10-09 16:56:28
Hi,
i'm trying to use CSV Handler, but I'm having some problem: the "commit" button that recall the update function transform the .csv file in a single line file with only the "committed" data and the "delete" button delete everything in the .csv, not only the single row. Hope you can help me.

  2. Re: Some error with CSV Handler   Reply   Report abuse  
Picture of Andreas Mueller Andreas Mueller - 2012-10-09 22:36:13 - In reply to message 1 from Piersante Blasioli
Hello Piersante,

what you describe looks like a "duplicate primary key".
Please keep in mind that this is not a complete db-management tool and it lacks many functions that might be useful.
In this case it means you have to take care that your KeyField contains unique values [new CSVHandler($Filename, $Separator, $KeyFieldName) uses the cikumn named $KeyFieldName as primary unique key]. CSV Handler does not check for duplicate keys though. The delete function is quite stupid and removes any line having the correspondent value in its keyfield.

If your data do not contain a column with unique values you might just add a simple "ID" field and fill it with with an incremental count, everything should work fine.

Hope this helped,
regards
Andreas