Package org.sqlite

Examples of org.sqlite.SQLiteDataSource


            }
        }.run(connect(config));
    }

    SQLiteDataSource connect(Config config) {
        SQLiteDataSource dataSource = Xerial.newDataSource(config.file);
        new DbOp<Void>() {
            @Override
            protected Void doRun(Connection cx) throws IOException, SQLException {
                String sql = "CREATE TABLE IF NOT EXISTS config (section VARCHAR, key VARCHAR, value VARCHAR,"
                        + " PRIMARY KEY (section,key))";
View Full Code Here


        return Guice.createInjector(Modules.override(new GeogigModule()).with(
                new XerialSQLiteModule())).getInstance(Context.class);
    }

    public static SQLiteDataSource newDataSource(File db) {
        SQLiteDataSource dataSource = new SQLiteDataSource();
        dataSource.setUrl("jdbc:sqlite:" + db.getAbsolutePath());
        dataSource.setSynchronous(DEFAULT_SYNC_MODE.getValue());
        return dataSource;
    }
View Full Code Here

    }
  };

  private DataSource getDataSource() {
    try {
      final SQLiteDataSource ds = new SQLiteDataSource();
      String pluginDir = PMS.getConfiguration().getPluginDirectory();
      File config = new File(pluginDir + "/" + "banshee.cfg");
      String filePath = null;

      if (config.exists()) {
        Properties props = new Properties();
        InputStream in = null;
        try {
          in = new FileInputStream(config);
          props.load(in);
          String type = props.getProperty("type");
          if (type.equals("Banshee")) {
            filePath = props.getProperty("db");
          }
        } finally {
          in.close();
        }

      } else {
        String home = System.getProperty("user.home");
        filePath = String.format("%s/.config/banshee-1/banshee.db",
            home);
      }
      filePath = String.format("jdbc:sqlite:%s", filePath);
      if (null != filePath) {
        ds.setUrl(filePath);
        return ds;
      }
    } catch (Exception e) {
      log.error("Could not create datasource", e);
      return null;
View Full Code Here

TOP

Related Classes of org.sqlite.SQLiteDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.