使用 xorm 和 gorm 操作 doris2.0 都不成功,看文档没有说支持 doris ,但是 doris 本身应该高度兼容 mysql 的吧,这些 orm 框架这么严格?还是代码上有问题?
xorm code:
func SelectAd() {
engine := _init_db("10.22.xx", "9030", "abc")
ad := new(FlowAdUrlStat)
if _, err := engine.Where("opt_YYYYMMDD=?", 20240626).Get(ad); err != nil {
log.Fatal(err)
}
fmt.Println(ad)
}
报错:
2024/06/27 10:55:37 Error 1105 (HY000): errCode = 2, detailMessage = Only support prepare SelectStmt point query now
gorm code:
var ad FlowAdUrlStat
stmt := db.Session(&gorm.Session{DryRun: true}).Where("opt_YYYYMMDD = ?", 20240626).Take(&ad).Statement
fmt.Println(stmt.SQL.String())
fmt.Println(stmt.Vars)
if err := db.Where("opt_YYYYMMDD = ?", 20240626).Take(&ad).Error; err != nil {
log.Fatal(err)
}
fmt.Println(ad)
报错:
output:
Type 'dlv help' for list of commands.
SELECT * FROM flow_ad_url_stat WHERE opt_YYYYMMDD = ? LIMIT ?
[20240626 1]
2024/06/26 18:07:03 Error 1105 (HY000): errCode = 2, detailMessage = Syntax error in line 1:
...RE opt_YYYYMMDD = ? LIMIT ?
^
Encountered: ?
Expected
2024/06/26 18:07:03 D:/goproject/cloudsvc/dbutils/mysqlutil.go:63 Error 1105 (HY000): errCode = 2, detailMessage = Syntax error in line 1:
...RE opt_YYYYMMDD = ? LIMIT ?
^
Encountered: ?
Expected
[58.356ms] [rows:0] SELECT * FROM flow_ad_url_stat WHERE opt_YYYYMMDD = 20240626 LIMIT 1
Process 48512 has exited with status 1
Detaching