diff --git a/database/gdb/gdb_model_cache.go b/database/gdb/gdb_model_cache.go index e05d40740..914f315dc 100644 --- a/database/gdb/gdb_model_cache.go +++ b/database/gdb/gdb_model_cache.go @@ -34,9 +34,10 @@ type CacheOption struct { Force bool } +// selectCacheItem is the cache item for SELECT statement result. type selectCacheItem struct { - Result Result - FirstResultColumn string + Result Result // Sql result of SELECT statement. + FirstResultColumn string // The first column name of result, for Value/Count functions. } // Cache sets the cache feature for the model. It caches the result of the sql, which means @@ -128,7 +129,6 @@ func (m *Model) makeSelectCacheKey(sql string, args ...interface{}) string { if len(cacheKey) == 0 { cacheKey = fmt.Sprintf( `GCache@Schema(%s):%s`, - m.db.GetSchema(), gmd5.MustEncryptString(sql+", @PARAMS:"+gconv.String(args)), ) } diff --git a/database/gdb/gdb_model_select.go b/database/gdb/gdb_model_select.go index ebe8432c9..02e8b8be5 100644 --- a/database/gdb/gdb_model_select.go +++ b/database/gdb/gdb_model_select.go @@ -176,7 +176,10 @@ func (m *Model) Value(fieldsAndWhere ...interface{}) (Value, error) { return v, nil } } - return nil, gerror.NewCode(gcode.CodeInternalError, `query value error`) + return nil, gerror.NewCode( + gcode.CodeInternalError, + `query value error: the internal context data is missing. there's' internal issue should be fixed'`, + ) } // Array queries and returns data values as slice from database. @@ -390,7 +393,10 @@ func (m *Model) Count(where ...interface{}) (int, error) { return v.Int(), nil } } - return 0, gerror.NewCode(gcode.CodeInternalError, `query count error`) + return 0, gerror.NewCode( + gcode.CodeInternalError, + `query count error: the internal context data is missing. there's' internal issue should be fixed'`, + ) } return 0, nil }