HSQLDB 2.3.3:如何创建类型数组

时间:2015-12-03 17:29:35

标签: hsqldb

如何创建BIGINT类型的数组?

以下似乎不起作用:

    Scanner input = new Scanner(System.in);
    System.out.print("Enter the name of the input file: ");
    String fileName = input.next();

    ClassRoll c = new ClassRoll();
    c.display();

    prompt();
    System.out.print("Enter a command: ");
    String ans = input.next();


    while (!(ans.equalsIgnoreCase("q") || ans.equalsIgnoreCase("quit"))){
        if(!(ans.equalsIgnoreCase("i") || ans.equalsIgnoreCase("insert") ||
             ans.equalsIgnoreCase("a") || ans.equalsIgnoreCase("average") ||
             ans.equalsIgnoreCase("n") || ans.equalsIgnoreCase("names") ||
             ans.equalsIgnoreCase("r") || ans.equalsIgnoreCase("remove") ||
             ans.equalsIgnoreCase("f") || ans.equalsIgnoreCase("find") ||
             ans.equalsIgnoreCase("d") || ans.equalsIgnoreCase("display"))) 
        {
            System.out.println("Bad Command");
        } else {
            switch (ans.charAt(0)){
                case 'i':   c.insert();
                    break;
                case 'a':   c.sortAverage();
                    c.display();
                    break;
                case 'n':   c.sortLastNames();
                    c.display();
                    break;
                case 'r':   c.delete();
                    c.display();
                    break;
                case 'f':   Student s=c.find();
                    if (s == null) {
                        System.out.println("Student not found");
                    } else { 
                        System.out.println(s.toString());
                    }
                    break;
                 case 'd':   c.display();
                    break;
            }
        }
        prompt();
        System.out.print("Enter a command: ");
        ans=input.next();
    }

    c.save();
    System.out.println("Thank you!");
}

public static void prompt(){
    System.out.println("Enter one of the following commands");
    System.out.println("i or insert to insert a student in the class roll");
    System.out.println("a or average to sort the students based on their average");
    System.out.println("n or names to sort the students based on their last names");
    System.out.println("r or remove to remove a student from the class roll");
    System.out.println("f or find to find a student in the class roll");
    System.out.println("d or display to display the class roll");
    System.out.println("q or quit to exit the program");
}

1 个答案:

答案 0 :(得分:0)

CREATE TYPE ARRAY_NUMBERS AS BIGINT ARRAY;