You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Named Parameters Does not Work for prepare() function #207
So I have a simple test table that looks like this:
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| id | int(11) | YES | | <null> | |
| pname | varchar(255) | YES | | <null> | |
+-------+--------------+------+-----+---------+-------+
I connect to the database successfully and then try to insert some values using named arguments such as this,
stmt = DBInterface.prepare(conn,"insert into test values(:id, :pname) ;")
This results in the error:
julia> stmt = DBInterface.prepare(conn,"insert into test values(:id, :pname) ;")
ERROR: (1064): 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 ':id, :pname)' at line 1
Stacktrace:
[1] prepare
@ ~/.julia/packages/MySQL/tCDUl/src/api/papi.jl:4 [inlined]
[2] prepare(conn::MySQL.Connection, sql::String; mysql_date_and_time::Bool)
@ MySQL ~/.julia/packages/MySQL/tCDUl/src/prepare.jl:48
[3] prepare(conn::MySQL.Connection, sql::String)
@ MySQL ~/.julia/packages/MySQL/tCDUl/src/prepare.jl:45
[4] top-level scope
@ /data/projects/Stocks/testsql.jl:17
If I use positional arguments it works fine. However positional arguments can't handle more complicated queries wherein a given argument must appear multiple times within the query.
Relabeled as a 2.x feature request. The MySQL protocol's prepared statements take positional ? parameters only, which v2.0.0 supports; named parameters would be a client-side rewrite of the statement text, planned for 2.x.
Activity
quinnj commentedon Sep 9, 2026
Relabeled as a 2.x feature request. The MySQL protocol's prepared statements take positional
?parameters only, which v2.0.0 supports; named parameters would be a client-side rewrite of the statement text, planned for 2.x.