Page 1 of 1
CSV still used
Posted: Sat Apr 29, 2006 7:47 pm
by alex.barylski
A few years back I did alot of CSV conversion and such for a guy I was working for, but since then I've done very little, opting to usually store data in SQL as opposed to CSV...
Yesterday I wrote a CSV class and after toying with it today I had some cool ideas which I could implement to really extend a normal CSV class...
Basically add functionality to so it executed much like an Excel spreadsheet or SQL table...using a hybrid of SQL...
I could personally use the class...as I often write applications which run without SQL, but could use a limited bit of it's functionality...
So I ask, does anyone else ever find the need to work with CSV and more importantly...work with it programmatically, not just indirectly through dumping email addy's from outlook, etc...?
Cheers

Posted: Sat Apr 29, 2006 7:48 pm
by Charles256
give me said class! If I have to work with one more CSV sheet I will kill myself. Make my life easier! Please! Sorry, I'm excited.

Posted: Sat Apr 29, 2006 8:02 pm
by Burrito
would've been nice for me to have about 4 months ago...
I'm sure the need will crop up again.
post it when you're done.
Posted: Sat Apr 29, 2006 8:21 pm
by alex.barylski
Charles256 wrote:give me said class! If I have to work with one more CSV sheet I will kill myself. Make my life easier! Please! Sorry, I'm excited.

It's no where near what I have said would be ideal (for my own interests) currently it's just a simple API...
looks like:
Code: Select all
function CxCSV($delim = ',', $arr_colnames=null)
function csvLoad($file_name) /* public */
function csvSave($file_name) /* public */
function csvAppend($args) /* public */
function csvUpdate($args) /* public */
function csvDelete($args) /* public */
function csvFields(){ return $this->m_arrColNames; }
function csvList($args, $sort_order = true, $start, $offset) /* public */
function _setEntry($args, $idx=-1) /* protected */
function _findIndex($args) /* protected */
function _compareArgsToColNames($args) /* protected */
However after some thought I think I'm going to change the API quite drastically:
Code: Select all
// $arr_colnames is used if the first line in CSV file isn't field names
// this way programmer can explicitly define them in ctor()
function CxCSV($delim = ',', $arr_colnames=null)
function csvLoad($file_name) /* public */
function csvSave($file_name) /* public */
function csvMerge($arr_files) /* public */
// Locate the index of a given record based on field comparison criteria
function findIndex(&$args) /* public */
function appendRow($args) /* public */
function insertRow($idx, $args) /* public */
function updateRow($idx, $args) /* public */
function deleteRow($idx, $args) /* public */
function swapRow($idx1, $idx2) /* public */
// Return array with names of columns
function getColNames() /* public */
function listRows($args, $filter=null, $cb_func=null) /* public */
Or something to that effect
Comments, suggestions, etc...?
Cheers

Posted: Sun Apr 30, 2006 11:38 pm
by alex.barylski
Charles256 wrote:give me said class! If I have to work with one more CSV sheet I will kill myself. Make my life easier! Please! Sorry, I'm excited.

viewtopic.php?t=47855
Take a looksie and gimme feedback

Posted: Mon May 01, 2006 12:25 pm
by Charles256
i'll test when i get back home