Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-18676

MySQL: Context error when attempting bulk insert

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.4.4
    • Fix Version/s: 7.0.0
    • Component/s: Plugins
    • Labels:
      None

      Description

      Example code:

      IMPORT MYSQL;
      
      childrec := RECORD
         string name,
         integer4 value { default(99999) },
         boolean boolval { default(true) },
         real8 r8 {default(99.99)},
         real4 r4 {default(999.99)},
         DATA d {default (D'999999')},
         DECIMAL10_2 ddd {default(9.99)},
         UTF8 u1 {default(U'9999 ß')},
         UNICODE8 u2 {default(U'9999 ßßßß')}
      END;
      
      staticData := DATASET([{'name1', 1, true, 1.2, 3.4, D'aa55aa55', 1234567.89, U'Straße', U'Straße'},
                             {'name2', 2, false, 5.6, 7.8, D'00', -1234567.89, U'là', U'là'}], childrec);
      
      theData := DATASET('~test::test', childrec, THOR);
      
      //-----------------------
      
      drop() := EMBED(mysql : user('jenkins_test'), password('foo'), database('ba_test'), server('localhost'), port('3306'))
        DROP TABLE IF EXISTS tbl1;
      ENDEMBED;
      
      create() := EMBED(mysql : user('jenkins_test'), password('foo'), database('ba_test'), server('localhost'), port('3306'))
        CREATE TABLE tbl1 ( name VARCHAR(20), value INT, boolval TINYINT, r8 DOUBLE, r4 FLOAT, d BLOB, ddd DECIMAL(10,2), u1 VARCHAR(10), u2 VARCHAR(10) );
      ENDEMBED;
      
      initialize(dataset(childrec) values1) := EMBED(mysql : user('jenkins_test'), password('foo'), database('ba_test'), server('localhost'), port('3306'))
        INSERT INTO tbl1(name, value, boolval, r8, r4, d, ddd, u1, u2) values (?, ?, ?, ?, ?, ?, ?, ?, ?);
      ENDEMBED;
      
      //-----------------------
      
      createDSAction := OUTPUT(staticData,, '~test::test', THOR, OVERWRITE);
      
      testActions := SEQUENTIAL
          (
              drop(),
              create(),
              initialize(theData)
          );
      
      //-----------------------
      
      createDSAction;
      // testActions;
      

      This is largely cribbed from the MySQL tests in the platform code base, where it runs successfully with an inline dataset.

      Run as-is to create a small test file, then switch the comments around on the last two lines to attempt to insert the logical file's contents into the database table. The compiler rejects the code with:

      (0,0): error C4818: INTERNAL: Expected a parent/container context. Likely to be caused by executing something invalid inside a NOTHOR.
      

      The failure is the same when running under Thor and hThor.

        Attachments

          Activity

            People

            • Assignee:
              ghalliday Gavin Halliday
              Reporter:
              dcamper Dan S. Camper
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: