Example #1
0
 public static HsqlBackend initializeHSQLBackend(long siteId, CatalogContext context) {
   synchronized (backendLock) {
     if (m_backend == null) {
       try {
         m_backend = new HsqlBackend(siteId);
         final String binDDL = context.database.getSchema();
         final String ddl = Encoder.decodeBase64AndDecompress(binDDL);
         final String[] commands = ddl.split("\n");
         for (String command : commands) {
           String decoded_cmd = Encoder.hexDecodeToString(command);
           decoded_cmd = decoded_cmd.trim();
           if (decoded_cmd.length() == 0) {
             continue;
           }
           m_backend.runDDL(decoded_cmd);
         }
       } catch (final Exception ex) {
         hostLog.fatal("Unable to construct HSQL backend");
         VoltDB.crashLocalVoltDB(ex.getMessage(), true, ex);
       }
     }
     return m_backend;
   }
 }