MySQL++

Ticket Change Details
Login
Overview

Artifact ID: bb1f022b52c03b40c03eca1e0f83d0152fdf1e74c8762ca4a14e949ccfdf0be2
Ticket: 8075e2d150258d4c9c77c9f7650b7861edc5c8f6
Bug found when execute(...) with template query
User & Date: anonymous 2018-12-20 09:13:04
Changes

  1. foundin changed to: "mysql++-3.2.4"
  2. icomment:
    MySQL version: mysql-5.7.23-win32
    OS: Windows 10 1809
    Visual Studio: vs2015 update 3
    
        I built mysql++-3.2.4 in its vc2005 project and got the x86 lib. I did some modification in the resetdb.cpp and ran the resetdb project, then I found a problem.
    
    ```
                    // Now create empty images table, for testing BLOB and auto-
    		// increment column features.
    		cout << "Creating empty images table..." << endl;
    		query.reset();		// forget template query info
    		query << 
    				"CREATE TABLE images (" <<
    				"  id INT UNSIGNED AUTO_INCREMENT, " <<
    				"  data BLOB, " <<
    				"  PRIMARY KEY (id)" <<
    				")";
    		query.execute();
            query.execute( "insert into images (data) values (\"def\")");
    
            query << "insert into %1:tab (%2:field) values (%0q:val1)";
            //query << "insert into %0:table values (\"def\")";
            query.parse();
            query.template_defaults["tab"] = "images";
            query.template_defaults["field"] = "data";
            query.template_defaults["val1"] = "abc";
            //query.template_defaults["field"] = "data";
            cout << query.str() << endl;
            query.execute("abc", "images");
            query.execute("images");
            query.reset();
    ```
    
        A BadQuery was caught when executing `query.execute("images");`. I debuged and waited in mysql_real_query(...), then I found that the `qstr` is "images".
    
        I think it's something wrong when there're more than one placeholder but pass only one parameter into execute(...).
    
        If it's not a bug, please give me some advice on how to do in this situation.
    
  3. login: "anonymous"
  4. mimetype: "text/x-fossil-plain"
  5. private_contact changed to: "0efae30de6243cd4e4a987402a972c4d3d740c40"
  6. severity changed to: "Important"
  7. status changed to: "Open"
  8. title changed to: "Bug found when execute(...) with template query"
  9. type changed to: "Code Defect"