s.executeQuery("select Name from items i JOIN inventory v on i.id=v.itemid where v.charid=(select id from character_ where name='" + charName + "');");
ResultSet rs = s.getResultSet();
int count = 0;
System.out.println(charName + "'s Inventory:");
while (rs.next())
{
String nameVal = rs.getString("Name");
System.out.println(nameVal);
++count;
}
rs.close();
s.close();
System.out.println(charName + " has " + count + " items in inventory.");
}
catch (SQLException e1)
{
// Failed
JOptionPane.showMessageDialog(frame, "Failed to issue database query! Please check your connection and try again.");
//DEBUG
//e1.printStackTrace();
}
}
else
//Connect First!
JOptionPane.showMessageDialog(frame, "You must connect to a server first!");
}
else if (actionCommand.equals("List Bots"))
{
if (telnetStatus == "Connected")
{
try
{
//List all bots in the database with their owner's name, level, and class
Statement s = mysqlConn.createStatement();
s.executeQuery("select c.Name,b.Name,b.Class,b.BotLevel from bots b join character_ c on b.BotOwnerCharacterID=c.id order by c.Name;");