?? typetable.java
字號:
package huitong.util.db;
import java.util.*;
import java.sql.*;
import huitong.javabean.*;
import huitong.util.db.*;
public class TypeTable
{
public void addType(int albumTypeId,String albumName)
{
if (albumName == null)
{
return;
}
String insertSQL = "insert into album_type(albumTypeId,albumName)" +
"values(" +albumTypeId+",'"+albumName+"'"+")";
System.out.println("in TypeTable addType() " + insertSQL);
new Connecter().insert(insertSQL);
}
public Iterator<AlbumType> getAlbumTypes()
{
String querySQL = "select * from album_type";
System.out.println(" in TypeTable getAlbumType() " + querySQL);
ResultSet result = new Connecter().getResultSet(querySQL);
if (result == null )
{
return null;
}
try
{
HashSet set = new HashSet();
while (result.next())
{
set.add(AlbumType.getAlbumType(result));
}
return set.iterator();
}
catch (SQLException e)
{
e.printStackTrace();
}
return null;
}
public static void main(String[] agrs)
{
Iterator<AlbumType> iter = new TypeTable().getAlbumTypes();
if (iter != null)
{
while (iter.hasNext())
{
System.out.println(iter.next().getAlbumTypeId());
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -