question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prepared statements failing (mysql/MariaDB, sqlpad > 4.3)

See original GitHub issue

Running sqlpad 4.4 and latest (from docker hub; MariaDB container pinned to 10.5.3) i can’t use prepare/execute statements. Even simple examples based on https://mariadb.com/kb/en/prepare-statement/#example fail:

PREPARE stmt FROM 'SELECT @x;';
SET @x = 1;
EXECUTE stmt;

–> ER_UNKNOWN_STMT_HANDLER: Unknown prepared statement handler (stmt) given to EXECUTE

SET @table = "some_table";
SET @sql = CONCAT('SELECT * FROM ', @table);
PREPARE stmt FROM @sql;
EXECUTE stmt;

–> ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1

Both examples work with sqlpad 4.3 (from docker hub) and using MariaDBs console.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
rickbergfalkcommented, Jun 19, 2020

Yeah it is all related.

Once the updated implementation lands it’ll allow for transactions across query executions. The underlying database connection will be held open and kept alive while browser tab is open. If user opts into it that is. Otherwise if falls back to 1 query run = one connection. (or today in the event your query has many statements, it could be many connections)

1reaction
rickbergfalkcommented, Jun 20, 2020

Fix for this will be in latest docker image. Limits are enforced by sql-limiter now so there could potentially be some quirks introduced with that… hopefully not though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PREPARE Statement - MariaDB Knowledge Base
If the prepared statement contains a syntax error, PREPARE will fail. As a side effect, stored procedures can use it to check if...
Read more >
Problems with prepared statements for a select query
Here's how I would code it: function password_matches($mysqli, $user, $pass) { $stmt = $mysqli->prepare("SELECT pswHash FROM user_list WHERE ...
Read more >
Repreparation of prepared statements in MySQL/MariaDB ...
An error occurs if all attempts fail. Metadata changes occur for DDL statements such as those that create, drop, alter, rename, or truncate ......
Read more >
Prepared-Statement fails when MySQL-Server under load
Description: Hello As backup-procedure we use 4 concurrent mysql-dump processes. When these processes are running, ...
Read more >
injection - CVE - Search Results
This issue has been patched in version 1.7.0 by using Javas PreparedStatements, which allow object setting without the risk of SQL injection.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found