mirror of
https://github.com/foxcpp/maddy.git
synced 2025-04-06 06:27:38 +03:00
table: Fix use of numbered argument placeholders
go-sqlite3 does not implement them properly (in fact, the proper support was just removed, wtf, mattn). Additionally, go-sqlite3 does not handle $name or @name properly despite these being supported by SQLite, only :name works. Closes #241.
This commit is contained in:
parent
3fc8a54924
commit
071d06dbff
4 changed files with 12 additions and 12 deletions
|
@ -67,11 +67,11 @@ func (s *SQLTable) Init(cfg *config.Map) error {
|
|||
},
|
||||
{
|
||||
Name: "lookup",
|
||||
Args: []string{fmt.Sprintf("SELECT %s FROM %s WHERE %s = $1", valueColumn, tableName, keyColumn)},
|
||||
Args: []string{fmt.Sprintf("SELECT %s FROM %s WHERE %s = :key", valueColumn, tableName, keyColumn)},
|
||||
},
|
||||
{
|
||||
Name: "add",
|
||||
Args: []string{fmt.Sprintf("INSERT INTO %s(%s, %s) VALUES($1, $2)", tableName, keyColumn, valueColumn)},
|
||||
Args: []string{fmt.Sprintf("INSERT INTO %s(%s, %s) VALUES(:key, :value)", tableName, keyColumn, valueColumn)},
|
||||
},
|
||||
{
|
||||
Name: "list",
|
||||
|
@ -79,11 +79,11 @@ func (s *SQLTable) Init(cfg *config.Map) error {
|
|||
},
|
||||
{
|
||||
Name: "set",
|
||||
Args: []string{fmt.Sprintf("UPDATE %s SET %s = $2 WHERE %s = $1", tableName, valueColumn, keyColumn)},
|
||||
Args: []string{fmt.Sprintf("UPDATE %s SET %s = :value WHERE %s = :key", tableName, valueColumn, keyColumn)},
|
||||
},
|
||||
{
|
||||
Name: "del",
|
||||
Args: []string{fmt.Sprintf("DELETE FROM %s WHERE %s = $1", tableName, keyColumn)},
|
||||
Args: []string{fmt.Sprintf("DELETE FROM %s WHERE %s = :key", tableName, keyColumn)},
|
||||
},
|
||||
{
|
||||
Name: "init",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue