Console.WriteLine("[ OK ] Connection established.");
}
}
publicvoidcreateDatabase()
{
StringBuildersql=newStringBuilder();
sql.Append("create database if not exists ").Append(this.dbName);
execute(sql.ToString());
}
publicvoiduseDatabase()
{
StringBuildersql=newStringBuilder();
sql.Append("use ").Append(this.dbName);
execute(sql.ToString());
}
publicvoidcheckSelect()
{
StringBuildersql=newStringBuilder();
sql.Append("select * from test.weather");
execute(sql.ToString());
}
publicvoidcreateTable()
{
StringBuildersql=newStringBuilder();
sql.Append("create table if not exists ").Append(this.dbName).Append(".").Append(this.tbName).Append("(ts timestamp, temperature float, humidity int)");
execute(sql.ToString());
}
publicvoidcheckInsert()
{
StringBuildersql=newStringBuilder();
sql.Append("insert into test.weather (ts, temperature, humidity) values(now, 20.5, 34)");
execute(sql.ToString());
}
publicvoidcheckDropTable()
{
StringBuildersql=newStringBuilder();
sql.Append("drop table if exists ").Append(this.dbName).Append(".").Append(this.tbName).Append("");