How do I use strcspn() to extract values in an SQL argument?
Posted on 2009-05-16
I'm trying to extract MySQL insert values into a PHP array. Each field value is delimited by a comma, though surrounding each comma can be a single quote, a closed bracket, an uppercase letter denoting the start of a MySQL function or an integer. Finding the start and end of each value is made more complicated by concatenated values. I don't want to use regex as I need greater efficiency for this particular code and was looking into strcspn - can anyone show me some code demonstrating strcspn splitting an SQL expression?