class MySqlBackend extends SqlBackend
Backend for accessing MySQL databases. This will use a connection properties file that should look something like the following:
driverClassName=com.mysql.jdbc.Driver jdbcUri=jdbc:mysql://server_address:server_port/schema_name user=username password=password jdbcCompliantTruncation=false
- Alphabetic
- By Inheritance
- MySqlBackend
- SqlBackend
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new MySqlBackend(connectionProperties: Properties, _sqlDialect: SqlDialect = null, _driverClassName: String = null)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
CACHESIZE: Int
- Definition Classes
- SqlBackend
-
val
SUPPORTS_MULT_RS: Boolean
- Definition Classes
- MySqlBackend → SqlBackend
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
batchInsert(tableName: String, table: DataTable[_], schemaName: Option[String] = None): Int
Perform a batch insert into a table.
Perform a batch insert into a table. This is the preferred insertion method for large insert operations
- tableName
The name of the table to do the insert
- table
A edu.chop.cbmi.dataExpress.dataModels.DataTable that holds the data for the insert
- schemaName
The schema where the table is located
- Definition Classes
- SqlBackend
-
def
batchInsertRows(tableName: String, rows: Iterator[DataRow[_]], columnNames: List[String], schemaName: Option[String] = None): Int
Perform a batch insert into a table.
Perform a batch insert into a table. This is the preferred insertion method for large insert operations
- tableName
The name of the table to do the insert
- rows
An interable over edu.chop.cbmi.dataExpress.dataModels.DataRow that holds the data for the insert
- columnNames
List[String] of the column names
- schemaName
The schema where the table is located Assumes all rows have the same length and column names
- Definition Classes
- SqlBackend
-
def
checkResultSetThenExecute(code: ⇒ Option[ResultSet]): Option[ResultSet]
Finesses the situation where some databases allow for only one open result set at a time.
Finesses the situation where some databases allow for only one open result set at a time. This is called whenever a new result set might be created to ensure that any open result set is closed.
- code
a code block that is likely to return a ResultSet
- Attributes
- protected
- Definition Classes
- SqlBackend
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(): Any
Closes the java.sql.connection associated with instances of the backend
Closes the java.sql.connection associated with instances of the backend
- Definition Classes
- SqlBackend
-
def
close(connection: Connection): Unit
Closes a java.sql.Connection
-
def
commit(): Boolean
Commit any open transactions to the database
Commit any open transactions to the database
- Definition Classes
- SqlBackend
-
def
connect(props: Properties): Connection
Opens a connection to the database via properties defined in a java.util.Properties object
Opens a connection to the database via properties defined in a java.util.Properties object
- props
the java.util.Properties object with the connect information
- Definition Classes
- SqlBackend
-
def
connect(): Connection
Opens the connection to the database
Opens the connection to the database
- Definition Classes
- SqlBackend
-
var
connection: Connection
- Definition Classes
- SqlBackend
-
val
connectionProperties: Properties
- Definition Classes
- MySqlBackend → SqlBackend
-
def
createTable(tableName: String, columnNames: List[String], dataTypes: List[DataType], schemaName: Option[String] = None): Boolean
Create a new table
Create a new table
- tableName
the name of the table
- columnNames
the list of column names to use
- dataTypes
a list of DataExpress edu.chop.cbmi.dataExpress.dataModels.DataType objects that correspond to the columns
- Definition Classes
- SqlBackend
-
val
driverClassName: String
- Definition Classes
- SqlBackend
-
def
dropTable(tableName: String, cascade: Boolean = false, schemaName: Option[String] = None): Boolean
Drops a database table, optionally cascading constraints
Drops a database table, optionally cascading constraints
- tableName
the name of the table to drop
- cascade
when
true
- Definition Classes
- SqlBackend
-
def
endTransaction(): Boolean
End the existing transaction
End the existing transaction
- Definition Classes
- SqlBackend
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
execute(sqlStatement: String, bindVars: Seq[Option[_]] = Seq.empty[Option[_]]): Boolean
Runs
UPDATE,INSERT, orDELETEstatement.Runs
UPDATE,INSERT, orDELETEstatement.- sqlStatement
the statement to run
- bindVars
set of bind variables to use
- returns
true if no errors were encountered
- Definition Classes
- SqlBackend
-
def
executeBatch[T](statement: PreparedStatement, values: Iterator[T], batchSize: Int, callback: (T) ⇒ Seq[Option[_]]): Int
Executes a set of java.sql.PreparedStatements in a batch mode.
Executes a set of java.sql.PreparedStatements in a batch mode. The primary operation where this makes sense is
operations, but one could imagine a stored procedure used in this way as wellINSERT- statement
The java.sql.PreparedStatement to be used for the insert
- values
The bind values of any bind variables that might be needed for placeholders in the prepared statement
- batchSize
The size of the batch to use before executing the batch in the database
- callback
A function that will be applied to each set of data values before they are added to the prepared statement
- returns
the number of statements that correctly executed
- Definition Classes
- SqlBackend
-
def
executeQuery(sqlStatement: String, bindvars: Seq[Option[_]] = Seq.empty[Option[_]], fetchSize: Int = 20): ResultSet
In order to avoid loading all results of a query into memory, mySQL requires the fetch size of a a database query to be -2^31 or Integer.MIN_VALUE, all other values are ignored.
In order to avoid loading all results of a query into memory, mySQL requires the fetch size of a a database query to be -2^31 or Integer.MIN_VALUE, all other values are ignored.
- sqlStatement
the
SELECTstatement to run- bindvars
set of bind variables for substitution in the statement (see java.sql.PreparedStatement)
- fetchSize
any value supplied will be ignored
- returns
java.sql.ResultSet representing the query
- Definition Classes
- MySqlBackend → SqlBackend
-
def
executeReturningKeys(sqlStatement: String, bindVars: Seq[Option[_]]): DataRow[_]
Executes a SQL statement where new keys are auto-generated from an auto-incrementing primary key.
Executes a SQL statement where new keys are auto-generated from an auto-incrementing primary key. Autogenerated keys are returned as a result of the statement. Not all databases implement this, and their individual implementations vary widely
- sqlStatement
the statement to be run
- bindVars
set of bind variables to use
- Definition Classes
- SqlBackend
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
get_jdbcUri: String
returns the URI for the JDBC connection
returns the URI for the JDBC connection
- Definition Classes
- SqlBackend
-
def
insertReturningKeys(tableName: String, row: DataRow[_], schemaName: Option[String] = None): DataRow[_]
Insert a single edu.chop.cbmi.dataModels.DataRow into a table, returning auto-generated primary keys
Insert a single edu.chop.cbmi.dataModels.DataRow into a table, returning auto-generated primary keys
- tableName
The name of the table to do the insert
- row
The edu.chop.cbmi.dataExpress.dataModels.DataRow to insert
- schemaName
The schema where the table is located
- Definition Classes
- SqlBackend
-
def
insertRow(tableName: String, row: DataRow[_], schemaName: Option[String] = None): Boolean
Insert a single edu.chop.cbmi.dataExpress.dataModels.DataRow into a table
Insert a single edu.chop.cbmi.dataExpress.dataModels.DataRow into a table
- tableName
The name of the table to do the insert
- row
The edu.chop.cbmi.dataExpress.dataModels.DataRow to insert
- schemaName
The schema where the table is located
- Definition Classes
- SqlBackend
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
prepStatement(sqlStatement: PreparedStatement, bindVars: Seq[Option[_]]): Unit
Generate a JDBC java.sql.PreparedStatement using bindVariables
Generate a JDBC java.sql.PreparedStatement using bindVariables
- sqlStatement
A java.sql.PreparedStatement that has place holders for bind variables
- bindVars
A list of values to be bound to the statement
- Attributes
- protected
- Definition Classes
- SqlBackend
-
def
rollback(): Boolean
Rollback an existing transaction
Rollback an existing transaction
- Definition Classes
- SqlBackend
-
val
sqlDialect: SqlDialect
- Definition Classes
- SqlBackend
-
def
startTransaction(): Boolean
Start a new transaction (potentially closing the old one)
Start a new transaction (potentially closing the old one)
- Definition Classes
- SqlBackend
-
var
statementCache: SqlQueryCache
- Definition Classes
- SqlBackend
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
truncateTable(tableName: String, schemaName: Option[String] = None): Boolean
Truncates a SQL table -
def
updateRow(tableName: String, updated_row: DataRow[_], filter: List[(String, Any)], schemaName: Option[String] = None): Boolean
Update existing table rows.
Update existing table rows. In order to allow specificity, the
filterparameter is a set of (columnName,value) tuples. These tuples get converted into theWHEREclause. For example:List(("id",12345),("type","Luggage Combination"))
passed in as a filter is converted to the SQL
WHERE id = 12345 AND type = 'Luggage Combination' Currently, there is no support for operations other than equality on filters (e.g.WHERE id > 100).- tableName
The name of the table to do the insert
- updated_row
The contents to be used for the update
- filter
A list of (
columnName,value) tuples to be used when constructing theWHEREclause- schemaName
The schema where the table is located
- Definition Classes
- SqlBackend
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )