All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.chojo.sadu.sqlite.jdbc.SqLiteJdbc Maven / Gradle / Ivy

/*
 *     SPDX-License-Identifier: LGPL-3.0-or-later
 *
 *     Copyright (C) RainbowDashLabs and Contributor
 */

package de.chojo.sadu.sqlite.jdbc;

import de.chojo.sadu.core.jdbc.JdbcConfig;

import java.io.File;
import java.nio.file.Path;

/**
 * A builder to create a SqLite jdbc url.
 */
public class SqLiteJdbc extends JdbcConfig {
    private String path = ":memory:";

    /**
     * Creates a new builder for a sqlite jdbc url.
     */
    public SqLiteJdbc() {
    }

    /**
     * Sets the database to in-memory mode.
     * 

* This is the default setting. * * @return builder instance */ public SqLiteJdbc memory() { return path(":memory:"); } /** * Set the path of the db file * * @param file file * @return builder instance */ public SqLiteJdbc path(File file) { return path(file.toPath()); } /** * Set the path of the db file * * @param path path * @return builder instance */ public SqLiteJdbc path(Path path) { return path(path.toAbsolutePath().toString()); } /** * Set the path of the db file * * @param path path * @return builder instance */ public SqLiteJdbc path(String path) { this.path = path; return self(); } @Override protected String defaultDriverClass() { return "org.sqlite.JDBC"; } @Override public String driver() { return "mysql"; } /** * @see MySql parameter */ @Override public SqLiteJdbc addParameter(String key, V value) { return super.addParameter(key, value); } @Override protected String baseUrl() { return "jdbc:sqlite:" + path; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy