returnnil,fmt.Errorf("error getting schema version (need to init database with 'camtool dbinit %s'?): %v",file,err)
}
iferr:=kv.ping();err!=nil{
returnnil,err
}
ifversion!=requiredSchemaVersion{
ifos.Getenv("CAMLI_DEV_CAMLI_ROOT")!=""{
// Good signal that we're using the devcam server, so help out
// the user with a more useful tip:
returnnil,fmt.Errorf("database schema version is %d; expect %d (run \"devcam server --wipe\" to wipe both your blobs and re-populate the database schema)",version,requiredSchemaVersion)
}
returnnil,fmt.Errorf("database schema version is %d; expect %d (need to re-init/upgrade database?)",
version,requiredSchemaVersion)
}
returnkv,nil
}
typekeyValuestruct{
*sqlkv.KeyValue
filestring
db*sql.DB
}
varcompiled=false
// CompiledIn returns whether SQLite support is compiled in.
// If it returns false, the build tag "with_sqlite" was not specified.
funcCompiledIn()bool{
returncompiled
}
varErrNotCompiled=errors.New("camlistored was not built with SQLite support. If you built with make.go, use go run make.go --sqlite=true. If you used go get or get install, use go {get,install} --tags=with_sqlite"+compileHint())