You are here

function coder_upgrade_upgrade_call_db_rewrite_sql_alter in Coder 7

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

Implements hook_upgrade_call_db_rewrite_sql_alter().

@todo db_rewrite_sql() replaced with hook_query_alter()

See also

http://drupal.org/node/224333#db_rewrite_sql

File

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

Code

function coder_upgrade_upgrade_call_db_rewrite_sql_alter(&$node, &$reader) {

  // TODO This is not ready as the call to arrayitize() on a SELECT will
  // look at the count of parameters to db_rewrite_sql() which are not the
  // same as count of parameters to db_query().
  return;

  // Create helper objects.
  //  $editor = PGPEditor::getInstance();
  // Get the function call object.
  $item =& $node->data;

  /*
   * Use cases
   * - query is a string: parse directly
   * - query is a variable; find the variable and see if it is a string
   * - query is an expression
   */

  // Process function call.
  $name =& $item->name;

  // NOT DONE - Copied from db_query above
  $p0 = $item
    ->getParameter(0)
    ->stripComments();
  if ($p0
    ->count() == 1) {
    $operand0 = $p0
      ->getElement();
    if (is_array($operand0) && $operand0['type'] == T_CONSTANT_ENCAPSED_STRING) {

      // Convert values to strings.
      // Parse the string.
      coder_upgrade_parse_query_string($node, $operand0);

      // Add $query->addTag('node_access' /* TODO Please indicate the appropriate tag */);
    }
  }
}