1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-29 18:19:44 +02:00

Make store SQL Server compatible

This commit is contained in:
Harvey Kandola 2019-04-01 12:02:23 +01:00
parent 9ec858286f
commit 64403c402b
17 changed files with 112 additions and 50 deletions

View file

@ -14,6 +14,7 @@ package store
import (
"database/sql"
"fmt"
"github.com/documize/community/core/env"
"github.com/jmoiron/sqlx"
"github.com/pkg/errors"
@ -36,6 +37,8 @@ func (c *Context) Bind(sql string) string {
switch c.Runtime.StoreProvider.Type() {
case env.StoreTypePostgreSQL:
bindParam = sqlx.DOLLAR
case env.StoreTypeSQLServer:
bindParam = sqlx.AT
}
return sqlx.Rebind(bindParam, sql)
@ -106,3 +109,13 @@ func (c *Context) EmptyJSON() string {
func (c *Context) GetJSONValue(column, attribute string) string {
return c.Runtime.StoreProvider.JSONGetValue(column, attribute)
}
// IsTrue return string representation of TRUE for storage provider.
func (c *Context) IsTrue() string {
return c.Runtime.StoreProvider.IsTrue()
}
// IsFalse return string representation of FALSE for storage provider.
func (c *Context) IsFalse() string {
return c.Runtime.StoreProvider.IsFalse()
}