Package org.mariadb.jdbc
Class NonRegisteringDriver
- java.lang.Object
-
- org.mariadb.jdbc.NonRegisteringDriver
-
- All Implemented Interfaces:
java.sql.Driver
- Direct Known Subclasses:
Driver
public class NonRegisteringDriver extends java.lang.Object implements java.sql.DriverMariaDB Driver that doesn't register itself to DriverManager
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatternidentifierPattern
-
Constructor Summary
Constructors Constructor Description NonRegisteringDriver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptsURL(java.lang.String url)returns true if the driver can accept the url.Connectionconnect(java.lang.String url, java.util.Properties props)Connect to the given connection string.static Connectionconnect(Configuration configuration)Connect according to configurationstatic java.lang.StringenquoteIdentifier(java.lang.String identifier, boolean alwaysQuote)static java.lang.StringenquoteLiteral(java.lang.String val)Enquote String value.static java.lang.StringenquoteLiteral(java.lang.String val, boolean noBackslashEscapes)Enquote String value, escaping according to the server sql_mode.intgetMajorVersion()gets the major version of the driver.intgetMinorVersion()gets the minor version of the driver.java.util.logging.LoggergetParentLogger()java.sql.DriverPropertyInfo[]getPropertyInfo(java.lang.String url, java.util.Properties info)Get the property info.static booleanisSimpleIdentifier(java.lang.String identifier)Retrieves whether identifier is a simple SQL identifier.booleanjdbcCompliant()checks if the driver is jdbc compliant.private static booleanmustEscapeLiteral(char c, boolean noBackslashEscapes)
-
-
-
Method Detail
-
connect
public static Connection connect(Configuration configuration) throws java.sql.SQLException
Connect according to configuration- Parameters:
configuration- configuration- Returns:
- a Connection
- Throws:
java.sql.SQLException- if connect fails
-
connect
public final Connection connect(java.lang.String url, java.util.Properties props) throws java.sql.SQLException
Connect to the given connection string.- Specified by:
connectin interfacejava.sql.Driver- Parameters:
url- the url to connect to- Returns:
- a connection
- Throws:
java.sql.SQLException- if it is not possible to connect
-
acceptsURL
public final boolean acceptsURL(java.lang.String url)
returns true if the driver can accept the url.- Specified by:
acceptsURLin interfacejava.sql.Driver- Parameters:
url- the url to test- Returns:
- true if the url is valid for this driver
-
getPropertyInfo
public final java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String url, java.util.Properties info) throws java.sql.SQLExceptionGet the property info.- Specified by:
getPropertyInfoin interfacejava.sql.Driver- Parameters:
url- the url to get properties forinfo- the info props- Returns:
- all possible connector options
- Throws:
java.sql.SQLException- if there is a problem getting the property info
-
getMajorVersion
public final int getMajorVersion()
gets the major version of the driver.- Specified by:
getMajorVersionin interfacejava.sql.Driver- Returns:
- the major versions
-
getMinorVersion
public final int getMinorVersion()
gets the minor version of the driver.- Specified by:
getMinorVersionin interfacejava.sql.Driver- Returns:
- the minor version
-
jdbcCompliant
public final boolean jdbcCompliant()
checks if the driver is jdbc compliant.- Specified by:
jdbcCompliantin interfacejava.sql.Driver- Returns:
- true since the driver is not compliant
-
getParentLogger
public final java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException- Specified by:
getParentLoggerin interfacejava.sql.Driver- Throws:
java.sql.SQLFeatureNotSupportedException
-
enquoteIdentifier
public static java.lang.String enquoteIdentifier(java.lang.String identifier, boolean alwaysQuote) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
enquoteLiteral
public static java.lang.String enquoteLiteral(java.lang.String val)
Enquote String value.- Parameters:
val- string value to enquote- Returns:
- enquoted string value
-
enquoteLiteral
public static java.lang.String enquoteLiteral(java.lang.String val, boolean noBackslashEscapes)Enquote String value, escaping according to the server sql_mode.The single quote is always doubled (
''), which is safe under every sql_mode. When backslash escaping is enabled (default sql_mode) the backslash and the usual control characters are backslash-escaped too; underNO_BACKSLASH_ESCAPESthe backslash is a literal character, so only the quote is doubled and every other character is left untouched.- Parameters:
val- string value to enquotenoBackslashEscapes- whether the server runs with NO_BACKSLASH_ESCAPES sql_mode- Returns:
- enquoted string value
-
mustEscapeLiteral
private static boolean mustEscapeLiteral(char c, boolean noBackslashEscapes)
-
isSimpleIdentifier
public static boolean isSimpleIdentifier(java.lang.String identifier)
Retrieves whether identifier is a simple SQL identifier. The first character is an alphabetic character from a through z, or from A through Z The string only contains alphanumeric characters or the characters "_" and "$"- Parameters:
identifier- identifier- Returns:
- true if identifier doesn't have to be quoted
- See Also:
- mariadb identifier name
-
-