func (mi *Indexer) SchemaVersion() (version int, err os.Error) { var client *mysql.Client client, err = mi.getConnection() if err != nil { return } defer mi.releaseConnection(client) err = client.Query("SELECT value FROM meta WHERE metakey='version'") if err != nil { return } res, err := client.UseResult() if err != nil { return } row := res.FetchRow() if row == nil { return 0, nil } version, err = strconv.Atoi(row[0].(string)) client.FreeResult() return }
func (mi *Indexer) IsAlive() (ok bool, err os.Error) { var client *mysql.Client client, err = mi.getConnection() if err != nil { return } defer mi.releaseConnection(client) err = client.Query("SELECT 1 + 1") if err != nil { return } _, err = client.UseResult() if err != nil { return } client.FreeResult() return true, nil }