Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-423

SQL batch with PREPARE/EXECUTE statements via .NET gives AccessViolationException

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Done
    • 3.1.20
    • 3.2.2
    • General
    • None
    • Windows .net 4.8

    Description

      When I try to execute from .NET via ODBC multistatement with PREPARE and EXECUTE, it ends with exception like:

      System.AccessViolationException : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
         at System.Data.Common.UnsafeNativeMethods.SQLMoreResults(OdbcStatementHandle StatementHandle)
         at System.Data.Odbc.OdbcStatementHandle.MoreResults()
         at System.Data.Odbc.OdbcDataReader.NextResult(Boolean disposing, Boolean allresults)
         at System.Data.Odbc.OdbcDataReader.Close(Boolean disposing)
         at System.Data.Odbc.OdbcDataReader.Dispose(Boolean disposing)
         at System.Data.Common.DbDataReader.Dispose()
         at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
         at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
         at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
         at System.Data.Odbc.OdbcCommand.ExecuteReader()
      

      Example of query we executed:

      SELECT COUNT(*) FROM information_schema.tables
      WHERE TABLE_SCHEMA='information_schema' AND TABLE_NAME='TABLESPACES'
      INTO @tableExists;
       
      SELECT 
      	IF(@tableExists>0 
      	,'SELECT    tablespace_name,    engine,    tablespace_type,    logfile_group_name,    extent_size FROM    information_schema.tablespaces ORDER BY tablespace_name , engine'
      	,'SELECT NULL LIMIT 0')
      INTO @query;
       
      PREPARE s FROM @query;
      EXECUTE s;
       
      DEALLOCATE PREPARE s;
      

      Is supported to use EXECUTE statment via ODBC connector?

      Attachments

        Issue Links

          Activity

            People

              Lawrin Lawrin Novitsky
              tomas.vladik Tomas Vladik
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.