You are here

function coder_upgrade_count_sql_fields in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/conversions/db.inc \coder_upgrade_count_sql_fields()

Returns count of sql fields that need a replacement value.

Parameters

array fields: Array of sql fields.

Return value

integer Count of fields.

1 call to coder_upgrade_count_sql_fields()
coder_upgrade_parse_update_query_string in coder_upgrade/conversions/db.inc
Replaces D6 database API call with D7 equivalent.

File

coder_upgrade/conversions/db.inc, line 602
Provides conversion routines applied to database API function calls and hooks.

Code

function coder_upgrade_count_sql_fields($fields) {
  $count = 0;
  foreach ($fields as $field) {
    list($field, $value) = explode("=", $field);
    if (is_null($value)) {
      cdp($field, '$field');
    }
    if (preg_match('/%[sdbf]/', $value)) {

      // Value is a placeholder.
      $count++;
    }
  }
  return $count;
}