Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21425

When using Dynamic Query, There is some Problem.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.3, 10.3.13
    • Fix Version/s: N/A
    • Component/s: Prepared Statements
    • Labels:
      None

      Description

      I want to use several Dynamic Queries in one Variable.

      IF we set several dynamic queries in one variable, MariaDB can't execute the Dynamic queries.

      However If we use 'IF (1=1)' Then we can use dynamic queries in one variable.

      Is this intentional behavior or bug?

      IF it is not bug, I want to know there is any problem using like this.

      (ex)

      ## PROCEDURE  CREATE
      DROP PROCEDURE IF EXISTS ACCT.MYSQL_MULTI_TEST;
      CREATE PROCEDURE ACCT.`MYSQL_MULTI_TEST`(
          $SQL             VARCHAR(8000) 
      )
      BEGIN
         DECLARE count INT DEFAULT 0;
       
         SET @SQL = $SQL;
         SET @COUNT = 1;
        PREPARE STMT_CONTENT FROM @SQL;
        EXECUTE STMT_CONTENT;    
        DEALLOCATE PREPARE STMT_CONTENT;	
       
      END;
      

      ##  PROCEDURE  CALL ( error) 
       
      CALL  MYSQL_MULTI_TEST(' 
        DELETE FROM MYSQL_MULTI_DELETE_1;  
        DELETE FROM MYSQL_MULTI_DELETE_2;
        DELETE FROM MYSQL_MULTI_DELETE_3; 
       '); 
       

       ## PROCEDURE  CALL ( ok )
       
       CALL  MYSQL_MULTI_TEST('
          IF( 1 = 1 )  THEN 
              DELETE FROM MYSQL_MULTI_DELETE_1;
              DELETE FROM MYSQL_MULTI_DELETE_2;
              DELETE FROM MYSQL_MULTI_DELETE_3;
          END IF;      
       '); 
      

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            90son Songuyoung
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: