本文整理汇总了Java中org.knowm.yank.Yank.queryBean方法的典型用法代码示例。如果您正苦于以下问题:Java Yank.queryBean方法的具体用法?Java Yank.queryBean怎么用?Java Yank.queryBean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.knowm.yank.Yank
的用法示例。
在下文中一共展示了Yank.queryBean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGuild
import org.knowm.yank.Yank; //导入方法依赖的package包/类
public DbGuild getGuild(IGuild guild){
if(Karren.conf.getAllowSQLRW()){
if(!dbGuildCache.containsKey(guild.getStringID())) {
String sql = "INSERT IGNORE Guild (GuildID, GuildOwner, GuildName, CommandPrefix, RollDifficulty, MaxVolume, RandomRange, OverrideChannel) VALUES (?, ?, ?, null, -1, 40, 0, 0)";
Object[] params = {guild.getStringID(), guild.getOwner().getName(), guild.getName()};
Yank.execute(sql, params);
sql = "SELECT * FROM Guild WHERE GuildID=?";
Object[] params2 = {guild.getStringID()};
DbGuild dbGuild = Yank.queryBean(sql, DbGuild.class, params2);
dbGuildCache.put(guild.getStringID(), dbGuild);
return dbGuild;
} else {
return dbGuildCache.get(guild.getStringID());
}
}
return null;
}
示例2: getWordCount
import org.knowm.yank.Yank; //导入方法依赖的package包/类
public DbWordcount getWordCount(String word){
if(Karren.conf.getAllowSQLRW()) {
if(!dbWordcountCache.containsKey(word)) {
String sql = "INSERT IGNORE WordCounts (WordID, Word, Count, CountStarted) VALUES (null, ?, 1, null)";
Object[] params = {word};
Yank.execute(sql, params);
sql = "SELECT * FROM WordCounts WHERE Word=?";
DbWordcount dbWordcount = Yank.queryBean(sql, DbWordcount.class, params);
dbWordcountCache.put(word, dbWordcount);
return dbWordcount;
} else {
return dbWordcountCache.get(word);
}
}
return null;
}
示例3: getUserData
import org.knowm.yank.Yank; //导入方法依赖的package包/类
public DbUser getUserData(IUser user){
if(Karren.conf.getAllowSQLRW()) {
if(!dbUserCache.containsKey(user.getStringID())) {
String sql = "INSERT IGNORE User (UserID, TimeLeft) VALUES (?, null)";
Object[] params = {user.getLongID()};
Yank.execute(sql, params);
sql = "SELECT * FROM User WHERE UserID=?";
Object[] params2 = {user.getLongID()};
DbUser dbUser = Yank.queryBean(sql, DbUser.class, params2);
dbUserCache.put(user.getStringID(), dbUser);
return dbUser;
} else {
return dbUserCache.get(user.getStringID());
}
}
return null;
}
示例4: getGuildUser
import org.knowm.yank.Yank; //导入方法依赖的package包/类
public DbGuildUser getGuildUser(int guildUserID){
if(Karren.conf.getAllowSQLRW()) {
DbGuildUser guildUser = dbGuildUserCache.values().stream().filter(x -> x.getGuildUserID()==guildUserID).findFirst().orElse(null);
if(guildUser==null) {
String sql = "SELECT * FROM GuildUser WHERE GuildUserID=?";
Object[] params = {guildUserID};
return Yank.queryBean(sql, DbGuildUser.class, params);
}
return guildUser;
}
return null;
}