Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are several bugs here:</p> <ol> <li><p>You've turned off exceptions (<code>conn(false)</code>) but you're also not checking return values for error codes. Your second <code>execute()</code> call is failing, but without asking the <code>Query</code> object why, you're running blind.</p> <p>Instead of adding error checking to all MySQL++ calls, though, I think it's cleaner to allow MySQL++ to throw exceptions (<code>conn()</code>) and wrap the whole thing in a <code>try</code> block.</p></li> <li><p>You don't need the <code>MultiStatementsOption</code> to do what you're asking the way you currently show. You have two separate statements here, not one compound statement. That in combination with the semicolons may be confusing MySQL, which is why the second call fails.</p> <p>The <code>mysql</code> command line tool demands semicolons to terminate SQL statements, but when using a database API like MySQL++, they're only necessary to separate multiple statements.</p> <p>You can either combine both <code>CREATE</code> statements into a single string (and one <code>execute()</code>) or you can drop the semicolons and the <code>MultiStatementsOption</code>.</p></li> <li><p>The <code>reset()</code> calls between queries haven't been necessary since MySQL++ 2.<em>x</em>. The only reason the method is still available is that it's necessary if you want to reuse a <code>Query</code> object that had been used for template queries; they're the only type that still don't auto-reset, for fairly obvious reasons.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload