Uploaded image for project: 'MariaDB Connector/node.js'
  1. MariaDB Connector/node.js
  2. CONJS-363

typeCast accessors return corrupted values with prepared statements

    XMLWordPrintable

Details

    Description

      typeCast's column.string() and column.buffer() are wired to length-encoded readers in the binary decoder, where only variable-length values are length-encoded. On any fixed-width column they read the first data byte as a length prefix, returning garbage and desynchronizing the packet cursor, corrupting every remaining column of the row. This makes typeCast effectively unusable with execute().

      const conn = await mariadb.createConnection({ ...cfg, typeCast: (field, next) => field.string() });
      await conn.query('SELECT v FROM t');    // [{ v: '7' }]   correct (text)
      await conn.execute('SELECT v FROM t');  // [{ v: '' }]    wrong (binary)
      

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.