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

Classic asp SUM() retrieve wrong data type

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 3.1.19
    • None
    • General
    • None
    • windows 10, IIS 10, classic asp

    Description

      in the following example the sum field get a wrong data type and script go in error

      <%
      set conn = server.CreateObject("ADODB.Connection")
      conn_string = "DRIVER=

      {MariaDB ODBC 3.1 Driver}

      ;port=3306;SERVER=127.0.0.1;UID=user;PWD=pwd;database=unit_test;charset=UTF8"
      conn.open (conn_string)

      set RS = server.CreateObject("ADODB.Recordset")
      SQL = "SELECT number, SUM(number) AS total FROM testnumeric ORDER BY number"
      RS.open SQL, Conn

      Response.Write "work: "& RS("number") &"<br>"
      sum = RS("number") + 1
      Response.Write "work: "& sum &"<br>"

      sum_number = RS("total") + 1 '<------ ERROR HERE
      Response.Write "not work:"& sum_number

      RS.close
      set RS = Nothing

      conn.close
      set conn = Nothing

      %>

      can be avoided using Cint(RS("total"))

      the table structure is
      – --------------------------------------------------------
      – Host: 127.0.0.1
      – Versione server: 10.11.2-MariaDB - mariadb.org binary distribution
      – S.O. server: Win64
      – HeidiSQL Versione: 12.5.0.6677
      – --------------------------------------------------------

      /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
      /*!40101 SET NAMES utf8 */;
      /*!50503 SET NAMES utf8mb4 */;
      /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
      /*!40103 SET TIME_ZONE='+00:00' */;
      /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
      /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
      /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

      – Dump della struttura di tabella unit_test.testnumeric
      CREATE TABLE IF NOT EXISTS `testnumeric` (
      `number` int(11) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

      – Dump dei dati della tabella unit_test.testnumeric: ~6 rows (circa)
      INSERT INTO `testnumeric` (`number`) VALUES
      (1),
      (2),
      (3),
      (4),
      (5),
      (6);

      /*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
      /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
      /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
      /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
      /*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;

      Attachments

        Activity

          People

            Lawrin Lawrin Novitsky
            abellos Simone Abello
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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