aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/mysql/mysql_store.go
diff options
context:
space:
mode:
authorLazyDBA247-Anyvision <yonin@anyvision.co>2021-03-29 09:58:13 +0300
committerLazyDBA247-Anyvision <yonin@anyvision.co>2021-03-29 09:58:13 +0300
commit4a02389eb08c3b7fcb7fe157f51e526df5220ac4 (patch)
treef185ed87cb15b6cd02726dffdd95154468d162b3 /weed/filer/mysql/mysql_store.go
parentbd7471d877614db267b8ada1bbb28544a8c401ec (diff)
downloadseaweedfs-4a02389eb08c3b7fcb7fe157f51e526df5220ac4.tar.xz
seaweedfs-4a02389eb08c3b7fcb7fe157f51e526df5220ac4.zip
Adding custom insertQuery support for postgres/2 mysql/2
Diffstat (limited to 'weed/filer/mysql/mysql_store.go')
-rw-r--r--weed/filer/mysql/mysql_store.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/weed/filer/mysql/mysql_store.go b/weed/filer/mysql/mysql_store.go
index 501ab1d39..4b73faacf 100644
--- a/weed/filer/mysql/mysql_store.go
+++ b/weed/filer/mysql/mysql_store.go
@@ -3,9 +3,10 @@ package mysql
import (
"database/sql"
"fmt"
- "github.com/chrislusf/seaweedfs/weed/filer"
"time"
+ "github.com/chrislusf/seaweedfs/weed/filer"
+
"github.com/chrislusf/seaweedfs/weed/filer/abstract_sql"
"github.com/chrislusf/seaweedfs/weed/util"
_ "github.com/go-sql-driver/mysql"
@@ -29,6 +30,7 @@ func (store *MysqlStore) GetName() string {
func (store *MysqlStore) Initialize(configuration util.Configuration, prefix string) (err error) {
return store.initialize(
+ configuration.GetString(prefix+"insertQuery"),
configuration.GetString(prefix+"username"),
configuration.GetString(prefix+"password"),
configuration.GetString(prefix+"hostname"),
@@ -41,13 +43,14 @@ func (store *MysqlStore) Initialize(configuration util.Configuration, prefix str
)
}
-func (store *MysqlStore) initialize(user, password, hostname string, port int, database string, maxIdle, maxOpen,
+func (store *MysqlStore) initialize(insertQuery, user, password, hostname string, port int, database string, maxIdle, maxOpen,
maxLifetimeSeconds int, interpolateParams bool) (err error) {
store.SupportBucketTable = false
store.SqlGenerator = &SqlGenMysql{
CreateTableSqlTemplate: "",
DropTableSqlTemplate: "drop table `%s`",
+ InsertQueryTemplate: insertQuery,
}
sqlUrl := fmt.Sprintf(CONNECTION_URL_PATTERN, user, password, hostname, port, database)