Package com.jk.data.vendors.mysql
Class MysqlDataAccess
java.lang.Object
com.jk.data.dataaccess.core.JKDataAccessImpl
com.jk.data.vendors.mysql.MysqlDataAccess
- All Implemented Interfaces:
 JKDataAccessService
This class provides data access functionality specific to MySQL databases.
 
 It extends the JKDataAccessImpl class.
- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 
- 
Field Summary
Fields inherited from class com.jk.data.dataaccess.core.JKDataAccessImpl
acceptedTimeInMillis, bufferSize, logger, maxAcceptedTimeInMillis - 
Constructor Summary
ConstructorsConstructorDescriptionMysqlDataAccess(JKDataSource dataSource) This method constructs a newMysqlDataAccesswith the provided data source. - 
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]blobToByteArray(Blob blob) This method converts aBlobobject to a byte array.describeTable(String name) This method retrieves data about a database table and returns it as a map of column names to their corresponding data types.intgetRowsCount(String query, Object... params) This method retrieves the number of rows returned by a specified SQL query with optional parameters.This method retrieves the current system date and time from the database.protected booleanThis method checks if the providedSQLExceptionindicates a duplicate key violation.protected booleanisDuplicateKey(SQLException e, boolean throwException) This method checks if the providedSQLExceptionindicates a duplicate key violation.Methods inherited from class com.jk.data.dataaccess.core.JKDataAccessImpl
addQueryLog, beginTransaction, call, call, close, close, close, close, close, close, closeTransaction, dropTable, execute, executeQueryAsArray, executeQueryAsCachedRowSet, executeQueryAsIdValue, executeQueryAsList, executeQueryAsString, executeQueryAsString, executeSingleOutputQuery, executeUpdate, executeUpdate, executeUpdate, find, findAndCacheRecord, findRecord, findRecord, getCaller, getConnection, getConnection, getDataSource, getGeneratedKey, getList, getList, getList, getListAndCache, getNextId, getNextId, getNextId, getNextId, isInTransaction, isTableExists, loadSql, prepareQueryStatement, prepareQueryStatement, prepareStatement, prepareStatement, prepareStatement, printRecordResultSet, printRecordResultSet, resetCache, runScript, setParams, setSession, writeLogMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.jk.data.dataaccess.core.JKDataAccessService
callAsSingleOutput, executeQueryAsDouble, executeQueryAsInteger, executeQueryAsListOfObjects, executeQueryAsListOfObjects, executeQueryAsLong, executeQueryAsMap, executeQueryAsRow, getTenantId 
- 
Constructor Details
- 
MysqlDataAccess
This method constructs a newMysqlDataAccesswith the provided data source.- Parameters:
 dataSource- Specifies the data source.
 
 - 
 - 
Method Details
- 
blobToByteArray
This method converts aBlobobject to a byte array.- Parameters:
 blob- Specifies theBlobobject to convert.- Returns:
 - the byte array representation of the `Blob` data.
 - Throws:
 IOException- if an I/O exception has occurred.SQLException- if a SQL error occurs while accessing theBlob.
 - 
getRowsCount
This method retrieves the number of rows returned by a specified SQL query with optional parameters.- Specified by:
 getRowsCountin interfaceJKDataAccessService- Overrides:
 getRowsCountin classJKDataAccessImpl- Parameters:
 query- Specifies the SQL query for which row count is to be determined.params- Specifies the optional parameters to be used in the SQL query.- Returns:
 - the number of rows returned by the specified SQL query.
 
 - 
getSystemDate
This method retrieves the current system date and time from the database.- Specified by:
 getSystemDatein interfaceJKDataAccessService- Overrides:
 getSystemDatein classJKDataAccessImpl- Returns:
 - a 
Dateobject representing the current system date and time 
 - 
isDuplicateKey
This method checks if the providedSQLExceptionindicates a duplicate key violation.- Parameters:
 e- Specifies the exception to check.- Returns:
 - true, if the exception indicates a duplicate key violation, false otherwise.
 - Throws:
 SQLException- if the exception is not a duplicate key violation.
 - 
isDuplicateKey
This method checks if the providedSQLExceptionindicates a duplicate key violation.- Parameters:
 e- Specifies the exception to check.throwException- Indicates whether to throw the exception if it's not a duplicate key violation (true) or not (false).- Returns:
 - true, if the exception indicates a duplicate key violation, false otherwise.
 - Throws:
 SQLException- if the exception is not a duplicate key violation andthrowExceptionistrue.
 - 
describeTable
This method retrieves data about a database table and returns it as a map of column names to their corresponding data types.- Specified by:
 describeTablein interfaceJKDataAccessService- Overrides:
 describeTablein classJKDataAccessImpl- Parameters:
 name- Specifies the name of the table to describe.- Returns:
 - the map containing column names as keys and their corresponding data types as values.
 
 
 -