Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy. This forum is not for asking programming related questions.
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...?
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:
// $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 */