Skip to content

Support Dynamic SQL syntax #3688

@yedane

Description

@yedane

Type: LanguageService

Describe the bug

  • OS and Version: Win 10
  • VS Code Version: 1.34
  • C/C++ Extension Version: 0.23.1
  • Other extensions you installed (and if the issue persists after disabling them):

We have to use dynamic SQL statements, and in the synthax we have to put a ":" before a variable, but it seems that break the IntelliSense.
Please have a look on the documentation below: Oracle dynamic statements

Actually when we want to drive into dba_test_with_proc_and_without_colon function it show us the header instead of the function declaration.
But when we drive into dba_test_with_proc_and_without_colon it shows us the declaration.

To Reproduce

  1. Go to the main file
  2. Go to Declaration (F12) on the dba_test_with_proc_and_colon, it drives to the header declaration
  3. Go to Declaration (F12) on the dba_test_without_proc, it drives to the function declaration
  4. Go to Declaration (F12) on the dba_test_with_proc_and_without_colon, it drives to the function declaration

Expected behavior

when we go to Declaration (F12) on the dba_test_with_proc_and_colon, it must drive to the function declaration instead of the header

Code source

main.c

#include "hello.h"

int main()
{
  int vl_err = 0;
  short vl_num = 0;

  vl_err = dba_test_with_proc_and_colon(vl_num);
  vl_err = dba_test_without_proc(vl_num);
  vl_err = dba_test_with_proc_and_without_colon(vl_num);
  return 0;
}

hello.h

int dba_test_with_proc_and_without_colon(short va_num);
int dba_test_with_proc_and_colon(short va_num);
int dba_test_without_proc(short va_num);

hello.c

int dba_test_without_proc(short va_num)
{
  int vl_ret_cod = 0;

  if (va_num > 1)
    vl_ret_cod = 1;
  return vl_ret_cod;
}

int dba_test_with_proc_and_without_colon(short va_num)
{
  int vl_ret_cod = 0;

  EXEC SQL BEGIN DECLARE SECTION;
  char vl_string[2048] = {0};
  EXEC SQL END DECLARE SECTION;
  strcpy(vl_string, "select * from tab");
  EXEC SQL PREPARE select from vl_string;
  return vl_ret_cod;
}

int dba_test_with_proc_and_colon(short va_num)
{
  int vl_ret_cod = 0;

  EXEC SQL BEGIN DECLARE SECTION;
  char vl_string[2048] = {0};
  EXEC SQL END DECLARE SECTION;

  strcpy(vl_string, "select * from tab");
  EXEC SQL PREPARE select from :vl_string;
  return vl_ret_cod;
}

In the zip, you can find the source with we repro the issue
Intellisense.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions