示例#1
0
 public static String copiesInStock(String book_id) {
   try {
     final int history =
         Integer.parseInt(
             Query.getString(
                 "SELECT COUNT(sbm_copieshistory.ID) "
                     + "FROM sbm_copieshistory , sbm_copies "
                     + "WHERE copy_id LIKE sbm_copies.ID "
                     + "AND book_id LIKE "
                     + book_id,
                 "COUNT(sbm_copieshistory.ID)"));
     final int all = Integer.parseInt(SingleCopyCountTotal(book_id));
     final int caughthistory =
         Integer.parseInt(
             Query.getString(
                 "SELECT COUNT(sbm_copieshistory.ID) "
                     + "FROM sbm_copieshistory , sbm_copies "
                     + "WHERE collected LIKE '1%' "
                     + "AND copy_id LIKE sbm_copies.ID "
                     + "AND book_id LIKE "
                     + book_id,
                 "COUNT(sbm_copieshistory.ID)"));
     return Integer.toString(caughthistory + (all - history));
   } catch (Exception e) {
     System.out.println(e + " => copiesInStock");
     logger.log(Level.WARNING, "Exception ''{0}'' from ''{1}''", new Object[] {e, book_id});
   }
   return null;
 }
示例#2
0
 public static ArrayList<String> Singlecopy(String copyId) {
   try {
     ArrayList<String> result =
         Query.anyQuery(
             "SELECT label, sbm_students.ID, distributed, collected, buy, notice, paid, forename, surname, sbm_books.ID "
                 + "FROM sbm_copieshistory, sbm_copies, sbm_books, sbm_students "
                 + "WHERE sbm_books.ID = sbm_copies.book_id "
                 + "AND sbm_copieshistory.copy_id = sbm_copies.ID  "
                 + "AND sbm_copieshistory.student_id = sbm_students.ID "
                 + "AND sbm_copieshistory.copy_id LIKE "
                 + copyId);
     if (result.isEmpty() == true) {
       result.add(
           0,
           Query.getString(
               "SELECT label "
                   + "FROM sbm_copies, sbm_books "
                   + "WHERE sbm_books.ID = sbm_copies.book_id "
                   + "AND sbm_copies.ID LIKE "
                   + copyId,
               "label"));
       result.add(1, "");
       result.add(2, "");
       result.add(3, "");
       result.add(4, "im lager");
       result.add(5, "");
       result.add(6, "im lager");
       result.add(7, "nicht ausgeliehen");
       result.add(8, "");
       result.add(
           9,
           Query.getString(
               "SELECT sbm_books.ID "
                   + "FROM sbm_copies, sbm_books "
                   + "WHERE sbm_books.ID = sbm_copies.book_id "
                   + "AND sbm_copies.ID LIKE "
                   + copyId,
               "sbm_books.ID"));
       return result;
     } else {
       /*result = Query.anyQuery("SELECT label, sbm_copieshistory.ID, distributed, collected, buy, notice, paid, forename, surname
       FROM sbm_copieshistory, sbm_copies, sbm_books, sbm_students
       WHERE sbm_books.ID = sbm_copies.book_id
       AND sbm_copieshistory.copy_id = sbm_copies.ID
       AND sbm_copieshistory.student_id = sbm_students.ID
       AND sbm_copieshistory.copy_id LIKE "+copyId); */
       return result;
     }
   } catch (Exception e) {
     System.out.println(e + " => Singlecopy");
     logger.log(Level.WARNING, "Exception ''{0}'' from ''{1}''", new Object[] {e, copyId});
   }
   return null;
 }
示例#3
0
 public static String SingleCopyCountTotal(String BookID) { // Takes super long
   try {
     return Query.getString(
         "SELECT COUNT(ID) " + "FROM sbm_copies " + "WHERE book_id LIKE " + BookID, "COUNT(ID)");
   } catch (Exception e) {
     System.out.println(e + " => SingleCopyCountTotal");
     logger.log(Level.WARNING, "Exception ''{0}'' from ''{1}''", new Object[] {e, BookID});
   }
   return null;
 }
示例#4
0
 public static String boughtCopyCount(String book_id) {
   try {
     return Query.getString(
         "SELECT COUNT(sbm_copies.ID) "
             + "FROM sbm_copieshistory , sbm_copies, sbm_books "
             + "WHERE buy = 1 "
             + "AND sbm_copies.book_id LIKE sbm_books.ID"
             + "AND sbm_copieshistory.copy_id LIKE sbm_copies.ID "
             + "AND book_id LIKE "
             + book_id,
         "COUNT(sbm_copies.ID)");
   } catch (Exception e) {
     System.out.println(e + " => CauchtCopyCount");
     logger.log(Level.WARNING, "Exception ''{0}'' from ''{1}''", new Object[] {e, book_id});
   }
   return null;
 }
示例#5
0
文件: ex4.java 项目: tiziano88/CodeU3
 public String[] words() {
   String st[] = current.getString().trim().split("\\W"); // get all words
   // from current
   // query
   return st;
 }