예제 #1
1
  /**
   * Moves and archives old, non-executed transactions into an archive file.
   *
   * <p>Makes sure the file to archive to doesn't exist, and shows amount of archived transactions
   */
  private static void arkiveraGamlaTransaktioner() {
    File archive;

    System.out.print("Mata in ett nytt filnamn att arkivera till: ");
    archive = new File(tbScanner.nextLine());

    while (archive.exists()) {
      System.out.print("Filen existerar redan; var god mata in ett nytt filnamn: ");
      archive = new File(tbScanner.nextLine());
    }
    tbScanner.reset();
    System.out.println("Sparar till: " + archive);

    // Hämtar datum en vecka tillbaka
    Calendar c = Calendar.getInstance();
    c.add(Calendar.WEEK_OF_YEAR, -1);

    // Försöker arkivera till den nya filen
    try {
      int antalArkiveradeTransaktioner;
      antalArkiveradeTransaktioner = m.archiveTransactions(c.getTime(), archive);
      System.out.println("Arkiverade " + antalArkiveradeTransaktioner + " transaktioner");
    } catch (IOException e) {
      System.out.println("Kunde inte skriva till arkivfilen!");
    }
  } // s**t på arkiveraGamlaTransaktioner
예제 #2
0
  /**
   * Resets this parse context with the given SQL character sequence.
   *
   * <p>Internal structures are reset as though a new parser were created with the given sql and the
   * originally specified database and session
   *
   * @param sql a new SQL character sequence to replace the current one
   */
  void reset(String sql) {

    scanner.reset(sql);

    //
    parsePosition = 0;
    isCheckOrTriggerCondition = false;
    isSchemaDefinition = false;
    isRecording = false;
    recordedStatement = null;
  }