sqlparser/cobol.cpp
// Convert variable or parameter referenced in SQL (should contain : prefix)
Convert variable or parameter referenced in SQL (should contain : prefix)
Convert variable or parameter referenced in SQL ( should contain : prefix )
Token* Cobol::ConvertDeclaredIdentifierInSql(Token *name)
{
	if(name == NULL || name->str == NULL || name->str[0] != ':')
		return name;
	Token *name2 = Token::GetCopy(name);
	name2->str++;
	name2->len--;
	Token *var = _sqlparser->GetVariable(name2);
	if(var != NULL && var->t_len != 0)
		_sqlparser->ConvertVariableIdentifier(name, var);
	Token *param = NULL;
	if(var == NULL)
		param = _sqlparser->GetParameter(name2);
	if(param != NULL && param->t_len != 0)
		_sqlparser->ConvertParameterIdentifier(name, param);	
	return name;
}
Token * Cobol :: ConvertDeclaredIdentifierInSql ( Token * name ) { if ( name == NULL || name -> str == NULL || name -> str [ 0 ] != ' ' ) return name ; Token * name2 = Token :: GetCopy ( name ) ; name2 -> str ++ ; name2 -> len -- ; Token * var = _sqlparser -> GetVariable ( name2 ) ; if ( var != NULL && var -> t_len != 0 ) _sqlparser -> ConvertVariableIdentifier ( name , var ) ; Token * param = NULL ; if ( var == NULL ) param = _sqlparser -> GetParameter ( name2 ) ; if ( param != NULL && param -> t_len != 0 ) _sqlparser -> ConvertParameterIdentifier ( name , param ) ; return name ; }
Convert variable or parameter referenced in SQL (should contain : prefix)
Convert variable or parameter referenced in SQL ( should contain : prefix )
// Remove prefix : // Check if a variable exists with this name // Change only if it was changed at the declaration // Check if a parameter exists with this name // Change only if it was changed at the declaration