Class CoreConnection

  • Direct Known Subclasses:
    JDBC3Connection

    public abstract class CoreConnection
    extends java.lang.Object
    • Field Detail

      • RESOURCE_NAME_PREFIX

        private static final java.lang.String RESOURCE_NAME_PREFIX
        See Also:
        Constant Field Values
      • url

        private final java.lang.String url
      • fileName

        private java.lang.String fileName
      • db

        protected DB db
      • autoCommit

        protected boolean autoCommit
      • transactionIsolation

        protected int transactionIsolation
      • busyTimeout

        private int busyTimeout
      • openModeFlags

        protected final int openModeFlags
      • pragmaSet

        private static final java.util.Set<java.lang.String> pragmaSet
      • dateMultiplier

        public final long dateMultiplier
      • dateStringFormat

        public final java.lang.String dateStringFormat
    • Constructor Detail

      • CoreConnection

        protected CoreConnection​(java.lang.String url,
                                 java.lang.String fileName,
                                 java.util.Properties prop)
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
    • Method Detail

      • extractPragmasFromFilename

        private java.lang.String extractPragmasFromFilename​(java.lang.String filename,
                                                            java.util.Properties prop)
                                                     throws java.sql.SQLException
        Extracts PRAGMA values from the filename and sets them into the Properties object which will be used to build the SQLConfig. The sanitized filename is returned.
        Parameters:
        filename -
        prop -
        Returns:
        a PRAGMA-sanitized filename
        Throws:
        java.sql.SQLException
      • open

        private void open​(int openModeFlags,
                          int busyTimeout)
                   throws java.sql.SQLException
        Opens a connection to the database using an SQLite library.
        Parameters:
        openModeFlags - Flags for file open operations.
        Throws:
        java.sql.SQLException
        See Also:
        http://www.sqlite.org/c3ref/c_open_autoproxy.html
      • extractResource

        private java.io.File extractResource​(java.net.URL resourceAddr)
                                      throws java.io.IOException
        Returns a file name from the given resource address.
        Parameters:
        resourceAddr - The resource address.
        Returns:
        The extracted file name.
        Throws:
        java.io.IOException
      • setBusyTimeout

        public void setBusyTimeout​(int milliseconds)
                            throws java.sql.SQLException
        Sets the timeout value for the connection. A timeout value less than or equal to zero turns off all busy handlers.
        Parameters:
        milliseconds - The timeout value in milliseconds.
        Throws:
        java.sql.SQLException
        See Also:
        http://www.sqlite.org/c3ref/busy_timeout.html
      • url

        public java.lang.String url()
        Returns:
        Where the database is located.
      • db

        public DB db()
        Returns:
        The class interface to SQLite.
      • checkOpen

        protected void checkOpen()
                          throws java.sql.SQLException
        Whether an SQLite library interface to the database has been established.
        Throws:
        java.sql.SQLException
      • checkCursor

        protected void checkCursor​(int rst,
                                   int rsc,
                                   int rsh)
                            throws java.sql.SQLException
        Checks whether the type, concurrency, and holdability settings for a ResultSet are supported by the SQLite interface. Supported settings are:
        • type: ResultSet.TYPE_FORWARD_ONLY
        • concurrency: ResultSet.CONCUR_READ_ONLY)
        • holdability: ResultSet.CLOSE_CURSORS_AT_COMMIT
        Parameters:
        rst - the type setting.
        rsc - the concurrency setting.
        rsh - the holdability setting.
        Throws:
        java.sql.SQLException
      • getDriverVersion

        public java.lang.String getDriverVersion()
        Returns:
        One of "native" or "unloaded".
      • finalize

        public void finalize()
                      throws java.sql.SQLException
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.sql.SQLException
        See Also:
        Object.finalize()
      • close

        public void close()
                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
        See Also:
        Connection.close()