PDO::ATTR_CASE breaks Editor record count query

PDO::ATTR_CASE breaks Editor record count query

abaucomabaucom Posts: 1Questions: 0Answers: 0

In my php server scripts I use "$db->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER);" to force all sql server column names to come back as upper case in fetches so that $row['COLNAME'] always matches and I don't have to guess what case I used elsewhere. For better or worse, this works for me.

In the Editor.php script, where it counts the records and filtered records, it references $ssp_full_count['cnt'] and I've had to change this to $ssp_full_count['CNT'] since my database handle has CASE_UPPER attribute set otherwise it fails to set the record counts correctly.

Replies

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Thanks for letting me know about this. I'll look at implementing support for PDO::ATTR_CASE in 1.7.1.

    Regards,
    Allan

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Just been looking at this again, and you can do:

    $db->resource()->setAttribute( PDO::ATTR_CASE, PDO::CASE_UPPER);
    

    The resource() method of the Database class just returns the PDO connection, so you can use any PDO methods on it.

    Allan

This discussion has been closed.