mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
@@ -129,7 +129,7 @@ func backupAction(ctx *cli.Context) error {
|
|||||||
"-p"+conf.DatabasePassword(),
|
"-p"+conf.DatabasePassword(),
|
||||||
conf.DatabaseName(),
|
conf.DatabaseName(),
|
||||||
)
|
)
|
||||||
case config.SQLite:
|
case config.SQLite3:
|
||||||
cmd = exec.Command(
|
cmd = exec.Command(
|
||||||
conf.SqliteBin(),
|
conf.SqliteBin(),
|
||||||
conf.DatabaseDsn(),
|
conf.DatabaseDsn(),
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ func restoreAction(ctx *cli.Context) error {
|
|||||||
"-f",
|
"-f",
|
||||||
conf.DatabaseName(),
|
conf.DatabaseName(),
|
||||||
)
|
)
|
||||||
case config.SQLite:
|
case config.SQLite3:
|
||||||
log.Infoln("dropping existing tables")
|
log.Infoln("dropping existing tables")
|
||||||
tables.Drop(conf.Db())
|
tables.Drop(conf.Db())
|
||||||
cmd = exec.Command(
|
cmd = exec.Command(
|
||||||
|
|||||||
@@ -475,8 +475,8 @@ func (c *Config) Workers() int {
|
|||||||
cores = cpuid.CPU.PhysicalCores
|
cores = cpuid.CPU.PhysicalCores
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit number of workers when using SQLite to avoid database locking issues.
|
// Limit number of workers when using SQLite3 to avoid database locking issues.
|
||||||
if c.DatabaseDriver() == SQLite && (cores >= 8 && c.options.Workers <= 0 || c.options.Workers > 4) {
|
if c.DatabaseDriver() == SQLite3 && (cores >= 8 && c.options.Workers <= 0 || c.options.Workers > 4) {
|
||||||
return 4
|
return 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,15 +29,15 @@ func (c *Config) DatabaseDriver() string {
|
|||||||
switch strings.ToLower(c.options.DatabaseDriver) {
|
switch strings.ToLower(c.options.DatabaseDriver) {
|
||||||
case MySQL, MariaDB:
|
case MySQL, MariaDB:
|
||||||
c.options.DatabaseDriver = MySQL
|
c.options.DatabaseDriver = MySQL
|
||||||
case SQLite, "sqlite", "sqllite", "test", "file", "":
|
case SQLite3, "sqlite", "sqllite", "test", "file", "":
|
||||||
c.options.DatabaseDriver = SQLite
|
c.options.DatabaseDriver = SQLite3
|
||||||
case "tidb":
|
case "tidb":
|
||||||
log.Warnf("config: database driver 'tidb' is deprecated, using sqlite")
|
log.Warnf("config: database driver 'tidb' is deprecated, using sqlite")
|
||||||
c.options.DatabaseDriver = SQLite
|
c.options.DatabaseDriver = SQLite3
|
||||||
c.options.DatabaseDsn = ""
|
c.options.DatabaseDsn = ""
|
||||||
default:
|
default:
|
||||||
log.Warnf("config: unsupported database driver %s, using sqlite", c.options.DatabaseDriver)
|
log.Warnf("config: unsupported database driver %s, using sqlite", c.options.DatabaseDriver)
|
||||||
c.options.DatabaseDriver = SQLite
|
c.options.DatabaseDriver = SQLite3
|
||||||
c.options.DatabaseDsn = ""
|
c.options.DatabaseDsn = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ func (c *Config) DatabaseDsn() string {
|
|||||||
c.DatabaseHost(),
|
c.DatabaseHost(),
|
||||||
c.DatabasePort(),
|
c.DatabasePort(),
|
||||||
)
|
)
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
return filepath.Join(c.StoragePath(), "index.db")
|
return filepath.Join(c.StoragePath(), "index.db")
|
||||||
default:
|
default:
|
||||||
log.Errorf("config: empty database dsn")
|
log.Errorf("config: empty database dsn")
|
||||||
@@ -227,7 +227,7 @@ func (c *Config) SetDbOptions() {
|
|||||||
c.Db().Set("gorm:table_options", "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci")
|
c.Db().Set("gorm:table_options", "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci")
|
||||||
case Postgres:
|
case Postgres:
|
||||||
// Ignore for now.
|
// Ignore for now.
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
// Not required as unicode is default.
|
// Not required as unicode is default.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ func TestConfig_DatabaseDriver(t *testing.T) {
|
|||||||
c := NewConfig(CliTestContext())
|
c := NewConfig(CliTestContext())
|
||||||
|
|
||||||
driver := c.DatabaseDriver()
|
driver := c.DatabaseDriver()
|
||||||
assert.Equal(t, SQLite, driver)
|
assert.Equal(t, SQLite3, driver)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfig_ParseDatabaseDsn(t *testing.T) {
|
func TestConfig_ParseDatabaseDsn(t *testing.T) {
|
||||||
@@ -73,7 +73,7 @@ func TestConfig_DatabaseDsn(t *testing.T) {
|
|||||||
c := NewConfig(CliTestContext())
|
c := NewConfig(CliTestContext())
|
||||||
|
|
||||||
dsn := c.DatabaseDriver()
|
dsn := c.DatabaseDriver()
|
||||||
assert.Equal(t, SQLite, dsn)
|
assert.Equal(t, SQLite3, dsn)
|
||||||
c.options.DatabaseDsn = ""
|
c.options.DatabaseDsn = ""
|
||||||
c.options.DatabaseDriver = "MariaDB"
|
c.options.DatabaseDriver = "MariaDB"
|
||||||
assert.Equal(t, "photoprism:@tcp(localhost)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true", c.DatabaseDsn())
|
assert.Equal(t, "photoprism:@tcp(localhost)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true", c.DatabaseDsn())
|
||||||
|
|||||||
@@ -8,16 +8,18 @@ import (
|
|||||||
|
|
||||||
_ "github.com/jinzhu/gorm/dialects/mysql"
|
_ "github.com/jinzhu/gorm/dialects/mysql"
|
||||||
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
||||||
"github.com/photoprism/photoprism/pkg/fs"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
|
|
||||||
|
"github.com/photoprism/photoprism/pkg/fs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Database drivers (sql dialects).
|
// Database drivers (sql dialects).
|
||||||
const (
|
const (
|
||||||
MySQL = "mysql"
|
MySQL = "mysql"
|
||||||
MariaDB = "mariadb"
|
MariaDB = "mariadb"
|
||||||
SQLite = "sqlite3"
|
SQLite3 = "sqlite3"
|
||||||
Postgres = "postgres" // TODO: Requires GORM 2.0 for generic column data types
|
Postgres = "postgres" // TODO: Requires GORM 2.0 for generic column data types
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func NewTestOptions() *Options {
|
|||||||
// dbDsn = "photoprism:photoprism@tcp(mariadb:4001)/photoprism?parseTime=true",
|
// dbDsn = "photoprism:photoprism@tcp(mariadb:4001)/photoprism?parseTime=true",
|
||||||
|
|
||||||
if dbDriver == "test" || dbDriver == "sqlite" || dbDriver == "" || dbDsn == "" {
|
if dbDriver == "test" || dbDriver == "sqlite" || dbDriver == "" || dbDsn == "" {
|
||||||
dbDriver = SQLite
|
dbDriver = SQLite3
|
||||||
dbDsn = ".test.db"
|
dbDsn = ".test.db"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ func NewTestOptionsError() *Options {
|
|||||||
OriginalsPath: testDataPath + "/originals",
|
OriginalsPath: testDataPath + "/originals",
|
||||||
ImportPath: testDataPath + "/import",
|
ImportPath: testDataPath + "/import",
|
||||||
TempPath: testDataPath + "/temp",
|
TempPath: testDataPath + "/temp",
|
||||||
DatabaseDriver: SQLite,
|
DatabaseDriver: SQLite3,
|
||||||
DatabaseDsn: ".test-error.db",
|
DatabaseDsn: ".test-error.db",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ func UpdateSubjectCounts() (err error) {
|
|||||||
SET subjects.file_count = CASE WHEN b.subj_files IS NULL THEN 0 ELSE b.subj_files END,
|
SET subjects.file_count = CASE WHEN b.subj_files IS NULL THEN 0 ELSE b.subj_files END,
|
||||||
subjects.photo_count = CASE WHEN b.subj_photos IS NULL THEN 0 ELSE b.subj_photos END
|
subjects.photo_count = CASE WHEN b.subj_photos IS NULL THEN 0 ELSE b.subj_photos END
|
||||||
WHERE ?`, gorm.Expr(subjTable), gorm.Expr(filesTable), gorm.Expr(markerTable), condition)
|
WHERE ?`, gorm.Expr(subjTable), gorm.Expr(filesTable), gorm.Expr(markerTable), condition)
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
// Update files count.
|
// Update files count.
|
||||||
res = Db().Table(subjTable).
|
res = Db().Table(subjTable).
|
||||||
UpdateColumn("file_count", gorm.Expr("(SELECT COUNT(DISTINCT f.id) FROM files f "+
|
UpdateColumn("file_count", gorm.Expr("(SELECT COUNT(DISTINCT f.id) FROM files f "+
|
||||||
@@ -147,7 +147,7 @@ func UpdateLabelCounts() (err error) {
|
|||||||
) p2 GROUP BY p2.label_id
|
) p2 GROUP BY p2.label_id
|
||||||
) b ON b.label_id = labels.id
|
) b ON b.label_id = labels.id
|
||||||
SET photo_count = CASE WHEN b.label_photos IS NULL THEN 0 ELSE b.label_photos END`)
|
SET photo_count = CASE WHEN b.label_photos IS NULL THEN 0 ELSE b.label_photos END`)
|
||||||
} else if IsDialect(SQLite) {
|
} else if IsDialect(SQLite3) {
|
||||||
res = Db().
|
res = Db().
|
||||||
Table("labels").
|
Table("labels").
|
||||||
UpdateColumn("photo_count",
|
UpdateColumn("photo_count",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
// Database drivers (sql dialects).
|
// Database drivers (sql dialects).
|
||||||
const (
|
const (
|
||||||
MySQL = "mysql"
|
MySQL = "mysql"
|
||||||
SQLite = "sqlite3"
|
SQLite3 = "sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var dbProvider DbProvider
|
var dbProvider DbProvider
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ func (m *Photo) EstimateLocation(force bool) {
|
|||||||
Where("taken_src <> '' AND taken_at BETWEEN CAST(? AS DATETIME) AND CAST(? AS DATETIME)", rangeMin, rangeMax).
|
Where("taken_src <> '' AND taken_at BETWEEN CAST(? AS DATETIME) AND CAST(? AS DATETIME)", rangeMin, rangeMax).
|
||||||
Order(gorm.Expr("ABS(TIMESTAMPDIFF(SECOND, taken_at, ?))", m.TakenAt)).Limit(2).
|
Order(gorm.Expr("ABS(TIMESTAMPDIFF(SECOND, taken_at, ?))", m.TakenAt)).Limit(2).
|
||||||
Preload("Place").Find(&mostRecent).Error
|
Preload("Place").Find(&mostRecent).Error
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
err = UnscopedDb().
|
err = UnscopedDb().
|
||||||
Where("photo_lat <> 0 AND photo_lng <> 0").
|
Where("photo_lat <> 0 AND photo_lng <> 0").
|
||||||
Where("place_src <> '' AND place_src <> ? AND place_id IS NOT NULL AND place_id <> '' AND place_id <> 'zz'", SrcEstimate).
|
Where("place_src <> '' AND place_src <> ? AND place_id IS NOT NULL AND place_id <> '' AND place_id <> 'zz'", SrcEstimate).
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ func (m *Photo) Merge(mergeMeta, mergeUuid bool) (original Photo, merged Photos,
|
|||||||
logResult(UnscopedDb().Exec("UPDATE IGNORE `photos_keywords` SET `photo_id` = ? WHERE photo_id = ?", original.ID, merge.ID))
|
logResult(UnscopedDb().Exec("UPDATE IGNORE `photos_keywords` SET `photo_id` = ? WHERE photo_id = ?", original.ID, merge.ID))
|
||||||
logResult(UnscopedDb().Exec("UPDATE IGNORE `photos_labels` SET `photo_id` = ? WHERE photo_id = ?", original.ID, merge.ID))
|
logResult(UnscopedDb().Exec("UPDATE IGNORE `photos_labels` SET `photo_id` = ? WHERE photo_id = ?", original.ID, merge.ID))
|
||||||
logResult(UnscopedDb().Exec("UPDATE IGNORE `photos_albums` SET `photo_uid` = ? WHERE photo_uid = ?", original.PhotoUID, merge.PhotoUID))
|
logResult(UnscopedDb().Exec("UPDATE IGNORE `photos_albums` SET `photo_uid` = ? WHERE photo_uid = ?", original.PhotoUID, merge.PhotoUID))
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
logResult(UnscopedDb().Exec("UPDATE OR IGNORE `photos_keywords` SET `photo_id` = ? WHERE photo_id = ?", original.ID, merge.ID))
|
logResult(UnscopedDb().Exec("UPDATE OR IGNORE `photos_keywords` SET `photo_id` = ? WHERE photo_id = ?", original.ID, merge.ID))
|
||||||
logResult(UnscopedDb().Exec("UPDATE OR IGNORE `photos_labels` SET `photo_id` = ? WHERE photo_id = ?", original.ID, merge.ID))
|
logResult(UnscopedDb().Exec("UPDATE OR IGNORE `photos_labels` SET `photo_id` = ? WHERE photo_id = ?", original.ID, merge.ID))
|
||||||
logResult(UnscopedDb().Exec("UPDATE OR IGNORE `photos_albums` SET `photo_uid` = ? WHERE photo_uid = ?", original.PhotoUID, merge.PhotoUID))
|
logResult(UnscopedDb().Exec("UPDATE OR IGNORE `photos_albums` SET `photo_uid` = ? WHERE photo_uid = ?", original.PhotoUID, merge.PhotoUID))
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ func UpdateAlbumDefaultCovers() (err error) {
|
|||||||
GROUP BY pa.album_uid) p2 WHERE p2.photo_id = f.photo_id AND f.file_primary = 1 AND f.file_error = '' AND f.file_type = 'jpg'
|
GROUP BY pa.album_uid) p2 WHERE p2.photo_id = f.photo_id AND f.file_primary = 1 AND f.file_error = '' AND f.file_type = 'jpg'
|
||||||
) b ON b.album_uid = albums.album_uid
|
) b ON b.album_uid = albums.album_uid
|
||||||
SET thumb = b.file_hash WHERE ?`, condition)
|
SET thumb = b.file_hash WHERE ?`, condition)
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
res = Db().Table(entity.Album{}.TableName()).
|
res = Db().Table(entity.Album{}.TableName()).
|
||||||
UpdateColumn("thumb", gorm.Expr(`(
|
UpdateColumn("thumb", gorm.Expr(`(
|
||||||
SELECT f.file_hash FROM files f
|
SELECT f.file_hash FROM files f
|
||||||
@@ -80,7 +80,7 @@ func UpdateAlbumFolderCovers() (err error) {
|
|||||||
GROUP BY p.photo_path) p2 WHERE p2.photo_id = f.photo_id AND f.file_primary = 1 AND f.file_error = '' AND f.file_type = 'jpg'
|
GROUP BY p.photo_path) p2 WHERE p2.photo_id = f.photo_id AND f.file_primary = 1 AND f.file_error = '' AND f.file_type = 'jpg'
|
||||||
) b ON b.photo_path = albums.album_path
|
) b ON b.photo_path = albums.album_path
|
||||||
SET thumb = b.file_hash WHERE ?`, condition)
|
SET thumb = b.file_hash WHERE ?`, condition)
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
res = Db().Table(entity.Album{}.TableName()).UpdateColumn("thumb", gorm.Expr(`(
|
res = Db().Table(entity.Album{}.TableName()).UpdateColumn("thumb", gorm.Expr(`(
|
||||||
SELECT f.file_hash FROM files f,(
|
SELECT f.file_hash FROM files f,(
|
||||||
SELECT p.photo_path, max(p.id) AS photo_id FROM photos p
|
SELECT p.photo_path, max(p.id) AS photo_id FROM photos p
|
||||||
@@ -128,7 +128,7 @@ func UpdateAlbumMonthCovers() (err error) {
|
|||||||
GROUP BY p.photo_year, p.photo_month) p2 WHERE p2.photo_id = f.photo_id AND f.file_primary = 1 AND f.file_error = '' AND f.file_type = 'jpg'
|
GROUP BY p.photo_year, p.photo_month) p2 WHERE p2.photo_id = f.photo_id AND f.file_primary = 1 AND f.file_error = '' AND f.file_type = 'jpg'
|
||||||
) b ON b.photo_year = albums.album_year AND b.photo_month = albums.album_month
|
) b ON b.photo_year = albums.album_year AND b.photo_month = albums.album_month
|
||||||
SET thumb = b.file_hash WHERE ?`, condition)
|
SET thumb = b.file_hash WHERE ?`, condition)
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
res = Db().Table(entity.Album{}.TableName()).UpdateColumn("thumb", gorm.Expr(`(
|
res = Db().Table(entity.Album{}.TableName()).UpdateColumn("thumb", gorm.Expr(`(
|
||||||
SELECT f.file_hash FROM files f,(
|
SELECT f.file_hash FROM files f,(
|
||||||
SELECT p.photo_year, p.photo_month, max(p.id) AS photo_id FROM photos p
|
SELECT p.photo_year, p.photo_month, max(p.id) AS photo_id FROM photos p
|
||||||
@@ -204,7 +204,7 @@ func UpdateLabelCovers() (err error) {
|
|||||||
) p2 WHERE p2.photo_id = f.photo_id AND f.file_primary = 1 AND f.file_error = '' AND f.file_type = 'jpg' AND f.file_missing = 0
|
) p2 WHERE p2.photo_id = f.photo_id AND f.file_primary = 1 AND f.file_error = '' AND f.file_type = 'jpg' AND f.file_missing = 0
|
||||||
) b ON b.label_id = labels.id
|
) b ON b.label_id = labels.id
|
||||||
SET thumb = b.file_hash WHERE ?`, condition)
|
SET thumb = b.file_hash WHERE ?`, condition)
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
res = Db().Table(entity.Label{}.TableName()).UpdateColumn("thumb", gorm.Expr(`(
|
res = Db().Table(entity.Label{}.TableName()).UpdateColumn("thumb", gorm.Expr(`(
|
||||||
SELECT f.file_hash FROM files f
|
SELECT f.file_hash FROM files f
|
||||||
JOIN photos_labels pl ON pl.label_id = labels.id AND pl.photo_id = f.photo_id AND pl.uncertainty < 100
|
JOIN photos_labels pl ON pl.label_id = labels.id AND pl.photo_id = f.photo_id AND pl.uncertainty < 100
|
||||||
@@ -269,7 +269,7 @@ func UpdateSubjectCovers() (err error) {
|
|||||||
GROUP BY m.subj_uid, m.q
|
GROUP BY m.subj_uid, m.q
|
||||||
) b ON b.subj_uid = subjects.subj_uid
|
) b ON b.subj_uid = subjects.subj_uid
|
||||||
SET thumb = marker_thumb WHERE ?`, gorm.Expr(subjTable), gorm.Expr(markerTable), condition)
|
SET thumb = marker_thumb WHERE ?`, gorm.Expr(subjTable), gorm.Expr(markerTable), condition)
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
from := gorm.Expr(fmt.Sprintf("%s m WHERE m.subj_uid = %s.subj_uid ", markerTable, subjTable))
|
from := gorm.Expr(fmt.Sprintf("%s m WHERE m.subj_uid = %s.subj_uid ", markerTable, subjTable))
|
||||||
res = Db().Table(entity.Subject{}.TableName()).UpdateColumn("thumb", gorm.Expr(`(
|
res = Db().Table(entity.Subject{}.TableName()).UpdateColumn("thumb", gorm.Expr(`(
|
||||||
SELECT m.thumb FROM ? AND m.thumb <> '' ORDER BY m.subj_src DESC, m.q DESC LIMIT 1
|
SELECT m.thumb FROM ? AND m.thumb <> '' ORDER BY m.subj_src DESC, m.q DESC LIMIT 1
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ func FlagHiddenPhotos() error {
|
|||||||
if res.RowsAffected > 0 {
|
if res.RowsAffected > 0 {
|
||||||
log.Infof("index: flagged %s as hidden or missing [%s]", english.Plural(int(res.RowsAffected), "photo", "photos"), time.Since(start))
|
log.Infof("index: flagged %s as hidden or missing [%s]", english.Plural(int(res.RowsAffected), "photo", "photos"), time.Since(start))
|
||||||
}
|
}
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
if res.RowsAffected > 0 {
|
if res.RowsAffected > 0 {
|
||||||
log.Debugf("index: flagged %s as hidden or missing [%s]", english.Plural(int(res.RowsAffected), "photo", "photos"), time.Since(start))
|
log.Debugf("index: flagged %s as hidden or missing [%s]", english.Plural(int(res.RowsAffected), "photo", "photos"), time.Since(start))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ func PhotoSelection(f form.Selection) (results entity.Photos, err error) {
|
|||||||
switch DbDialect() {
|
switch DbDialect() {
|
||||||
case MySQL:
|
case MySQL:
|
||||||
concat = "CONCAT(a.path, '/%')"
|
concat = "CONCAT(a.path, '/%')"
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
concat = "a.path || '/%'"
|
concat = "a.path || '/%'"
|
||||||
default:
|
default:
|
||||||
return results, fmt.Errorf("unknown sql dialect: %s", DbDialect())
|
return results, fmt.Errorf("unknown sql dialect: %s", DbDialect())
|
||||||
@@ -59,7 +59,7 @@ func FileSelection(f form.Selection) (results entity.Files, err error) {
|
|||||||
switch DbDialect() {
|
switch DbDialect() {
|
||||||
case MySQL:
|
case MySQL:
|
||||||
concat = "CONCAT(a.path, '/%')"
|
concat = "CONCAT(a.path, '/%')"
|
||||||
case SQLite:
|
case SQLite3:
|
||||||
concat = "a.path || '/%'"
|
concat = "a.path || '/%'"
|
||||||
default:
|
default:
|
||||||
return results, fmt.Errorf("unknown sql dialect: %s", DbDialect())
|
return results, fmt.Errorf("unknown sql dialect: %s", DbDialect())
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ var log = event.Log
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
MySQL = "mysql"
|
MySQL = "mysql"
|
||||||
SQLite = "sqlite3"
|
SQLite3 = "sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cols represents a list of database columns.
|
// Cols represents a list of database columns.
|
||||||
|
|||||||
Reference in New Issue
Block a user