Comments (3)
I've just tried using https://github.com/ExpansiveWorlds/instrumentedsql and got absolutely same error.
Does it have to do something with driver.NamedValue args?
WARN[May 23 15:00:21.891] sql-tx-begin [err <nil>] category=sql
WARN[May 23 15:00:21.893] sql-conn-query [query SELECT * FROM "labels" WHERE (user_id = 0 AND is_system = 1 AND label IN (?,?,?,?)) args []driver.NamedValue{
{
Name: "",
Ordinal: 1,
Value: "Inbox",
},
{
Name: "",
Ordinal: 2,
Value: "Archive",
},
{
Name: "",
Ordinal: 3,
Value: "Trash",
},
{
Name: "",
Ordinal: 4,
Value: "Snoozed",
},
} err driver: skip fast-path; continue as if unimplemented] category=sql
WARN[May 23 15:00:21.894] sql-prepare [err Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"labels" WHERE (user_id = 0 AND is_system = 1 AND label IN (?,?,?,?))' at line 1] category=sql
(/Users/dobegor/go/src/smartback/v2/service/label_service.go:65)
[2018-05-23 15:00:21] Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"labels" WHERE (user_id = 0 AND is_system = 1 AND label IN (?,?,?,?))' at line 1
from sqlhooks.
note that gorm.Open
first parameter is dialect
not driverName
. It passes the dialect
as the driverName
to sql.Open
though. If you look at the gorm source code is maintains a map from dialect
to how it treats the strings. So you just need to tell gorm which dialect to use for mysqlWithHooks
.
If I am not mistaken something like this should work:
dialect, ok := gorm.GetDialect("mysql")
if !ok {
// oh noes
}
gorm.RegisterDialect("mysqlWithHooks", dialect)
from sqlhooks.
@keegancsmith Yes, thanks! Unfortunately, it's only in master branch, but thanks for the tip!
from sqlhooks.
Related Issues (20)
- Add Error handler
- Improve performance HOT 13
- Compose hook HOT 4
- Before+after hooks for prepare HOT 1
- Tag latest commit HOT 3
- Include Go version requirement in README HOT 3
- can't use transactions with sqlhooks HOT 6
- QueryerContext interface and prepared statements HOT 1
- Actual resulting query? HOT 9
- SQL commands inside hook methods HOT 1
- how to log sql when sql execute failed? HOT 9
- Run a linter in the CI HOT 2
- driver.ErrSkip error with sqlx HOT 4
- add sqlhooks on awesome-go
- [Discussion] onError hook error ignore HOT 4
- when using wraper driver, table name has Double quotes HOT 1
- How get the query's Result on After Hook? HOT 1
- runtime error: comparing uncomparable type mssql.Error HOT 4
- Add Benchmarks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlhooks.