Packages

class DBManager extends DBManagerDDL with JsonFormatted

Linear Supertypes
JsonFormatted, DBManagerDDL, DBManagerDML, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DBManager
  2. JsonFormatted
  3. DBManagerDDL
  4. DBManagerDML
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DBManager(table: Table)(implicit dbConfig: TraitDBConfig = DefaultDBConfigFromFile)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addForeignKey(link: Link): Int
    Definition Classes
    DBManagerDDL
  5. def aggregateBigDecimal(aggregates: Aggregates, wheres: Wheres, havings: Havings = Array()): Array[Any]
  6. def aggregateDouble(select: Aggregates, wheres: Wheres, havings: Havings = Array()): Array[Any]
  7. def aggregateGroupBigDecimal(aggregates: Aggregates, wheres: Wheres, groups: GroupByIntervals = Array(), havings: Havings = Array()): List[Array[Any]]
  8. def aggregateGroupBigInt(aggregates: Aggregates, wheres: Wheres, groups: GroupByIntervals = Array(), havings: Havings = Array()): List[Array[Any]]
  9. def aggregateGroupDouble(aggregates: Aggregates, wheres: Wheres, groups: GroupByIntervals = Array(), havings: Havings = Array()): List[Array[Any]]
  10. def aggregateGroupHaving[T](aggregates: Aggregates, wheres: Wheres, groupByIntervals: GroupByIntervals, havings: Havings, func: (ResultSet, String) ⇒ T)(implicit func2: (String) ⇒ T = ???, optConn: OptConn = None): List[Array[Any]]
    Attributes
    protected[sh.db]
    Definition Classes
    DBManagerDML
  11. def aggregateGroupInt(aggregates: Aggregates, wheres: Wheres, groups: GroupByIntervals = Array(), havings: Havings = Array()): List[Array[Any]]
  12. def aggregateGroupInto(db: DBManager, aggregates: Aggregates, wheres: Wheres, groupByIntervals: GroupByIntervals, havings: Havings)(implicit optConn: OptConn = None): Int
    Definition Classes
    DBManagerDML
  13. def aggregateGroupLong(aggregates: Aggregates, wheres: Wheres, groups: GroupByIntervals = Array(), havings: Havings = Array()): List[Array[Any]]
  14. def aggregateGroupString(aggregates: Aggregates, wheres: Wheres, groups: GroupByIntervals = Array(), havings: Havings = Array()): List[Array[Any]]
  15. def aggregateInt(select: Aggregates, wheres: Wheres, havings: Havings = Array()): Array[Any]
  16. def aggregateLong(aggregates: Aggregates, wheres: Wheres, havings: Havings = Array()): Array[Any]
  17. def aggregateString(select: Aggregates, wheres: Wheres, havings: Havings = Array()): Array[Any]
  18. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  19. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  20. def connection: Connection
    Definition Classes
    DBManager → DBManagerDML
  21. def countAllRows: Long
  22. def countRows(where: Where): Long
  23. def countRows(wheres: Wheres)(implicit optConn: OptConn = None): Long

    counts all rows in the table matching the select criteria given by wheres

    counts all rows in the table matching the select criteria given by wheres

    wheres

    is an Array of Where (the criteria (Col, Op, Value)) for the cols to search in.

    Definition Classes
    DBManagerDML
  24. lazy val createString: String
  25. implicit val dbConfig: TraitDBConfig
  26. implicit val dbDML: DBManagerDML
  27. def delete(wheres: Wheres)(implicit optConn: OptConn = None): Int

    Deletes rows matching the searchCol criteria.

    Deletes rows matching the searchCol criteria.

    returns

    the number of rows deleted

    Definition Classes
    DBManagerDML
  28. def deleteAll: Int
  29. def dropTable: Int
  30. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  31. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  32. def exists(wheres: Where*): Boolean
  33. def exists(wheres: Wheres): Boolean
  34. def exportAllEncrypted(file: String, secretKey: String): Int
  35. def exportAllToCSV(file: String): Int
  36. def exportEncrypted(file: String, secretKey: String, wheres: Where*): Int
  37. def exportToCSV(file: String, aggregates: Aggregates, wheres: Wheres, groupByIntervals: GroupByIntervals, havings: Havings): Int
  38. def exportToCSV(file: String, cols: Cols, wheres: Wheres): Int
  39. def exportToCSV(file: String, wheres: Wheres): Int
  40. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  41. def getAggregateGroupRS[T](aggregates: Aggregates, wheres: Wheres, groupByIntervals: GroupByIntervals, havings: Havings, getSQLString: (Aggregates, Wheres, GroupByIntervals, Havings) ⇒ String, doSQLQuery: (PreparedStatement, Aggregates) ⇒ T)(implicit optConn: OptConn): T
    Attributes
    protected[sh.db]
    Definition Classes
    DBManagerDML
  42. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  43. def getConfig: TraitDBConfig
  44. def getTable: Table
  45. def getTableID: String
  46. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  47. def importEncrypted(file: String, secretKey: String): Int
  48. def importFromCSV(file: String): Int
  49. def incrementColTx(where: Where, increment: Increment): Int
  50. def incrementColsTx(wheres: Wheres, increments: Increments)(implicit optConn: OptConn = None): Int

    Updates the table by incrementing integer value cols (updateCols) by the values specified in incrementValues (which can be negative integers) The row(s) matching the wheres will be incremented.

    Updates the table by incrementing integer value cols (updateCols) by the values specified in incrementValues (which can be negative integers) The row(s) matching the wheres will be incremented.

    This is just a wrapper that reads, adds data and then updates. (the standard way) A more efficient way (read and update in one step) is given in the deprecated @incrementCols

    wheres

    is an Array of Where (the criteria (Col, Op, Value)) for the cols to search in.

    returns

    the number of rows updated The caller should ensure that the colType of each element of updateCols is INT.

    Definition Classes
    DBManagerDML
  51. def incrementColsTxWithLastValue(wheres: Wheres, increments: Increments)(implicit optConn: OptConn = None): (Int, Array[Any])
    Definition Classes
    DBManagerDML
  52. def insertArray(data: Array[Any])(implicit optConn: OptConn = None): Long
    Definition Classes
    DBManagerDML
  53. def insertList(data: List[Any]): Long
  54. def insertRS[T](rs: ResultSet): Int

    Inserts an entry (row) into the table

    Inserts an entry (row) into the table

    returns

    the number of rows affected by the query

  55. lazy val insertString: String
    Definition Classes
    DBManagerDML
  56. def isEmpty: Boolean
  57. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  58. def isNonEmpty: Boolean
  59. def isPostGreSQL: Boolean

    Inserts an entry (row) into the table

    Inserts an entry (row) into the table

    returns

    the number of rows affected by the query

    Attributes
    protected
    Definition Classes
    DBManagerDML
  60. val keys: Array[String]
    Definition Classes
    DBManager → JsonFormatted
  61. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  62. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  63. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  64. def removeForeignKey(link: Link): Int
    Definition Classes
    DBManagerDDL
  65. def removeIndexIfExists(cols: Col*): Int
    Definition Classes
    DBManagerDDL
  66. def selectCols[T](wheres: Wheres, cols: Cols, func: (Array[Any]) ⇒ T)(implicit orderings: Orderings = Array(), limit: Int = 0, offset: Long = 0, optConn: OptConn = None): List[T]

    Searches table and returns a list of objects of generic type T matching the colToSearch criteria.

    Searches table and returns a list of objects of generic type T matching the colToSearch criteria.

    Some code from http://www.roseindia.net/jdbc/Jdbc-functions.shtml

    wheres

    is an Array[Where] (the criteria for the cols to search in).

    func

    is a function that maps any array (i.e., Array[Any]) to type T. The input to the function will be the array containing the data for the cols contained in selectCols. The output can be any type the user wants. The subtype of the elements of the input array is determined by the type of cols contained in where: INT ---> Int ; VARCHAR ---> String ; VARBINARY ---> Array[Byte] ; TIMESTAMP ---> String. For instance: If searchCols is Array(RealValueCol, ImaginaryValueCol), where RealValueCol and ImaginaryValueCol are of type INT each, then the input to the function is an Array[Any] containing two Int elements. The function can, for instance, map this array as follows def func(ar:Array[Any]) = new ComplexNumber(ar(0).asInstanceOf[Int], ar(0).asIntanceOf[Int])

    returns

    a list of type T

    Definition Classes
    DBManagerDML
  67. def selectInto(db: DBManager, cWheres: Wheres, cCols: Cols)(implicit cOrderings: Orderings = Array(), limit: Int = 0, offset: Long = 0, optConn: OptConn = None): Int
    Definition Classes
    DBManagerDML
  68. def selectRS[T](wheres: Wheres, cols: Cols, func: (ResultSet) ⇒ T)(implicit orderings: Orderings = Array(), limit: Int = 0, offset: Long = 0, optConn: OptConn = None): T
    Definition Classes
    DBManagerDML
  69. def setData(data: Array[(Any, DataType)], startCtr: Int, st: PreparedStatement, startDebugString: String): (Int, String)
    Attributes
    protected[sh]
    Definition Classes
    DBManagerDML
  70. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  71. val table: Table
  72. val tableID: String
  73. def toString(): String
    Definition Classes
    JsonFormatted → AnyRef → Any
  74. def updateCol(where: Where, update: Update[Any]): Int
  75. def updateCols(wheres: Wheres, updates: Updates[Any])(implicit optConn: Option[Connection] = None): Int

    Updates certain cols (columns) of the rows matching searchCol == searchData.

    Updates certain cols (columns) of the rows matching searchCol == searchData.

    wheres

    is an Array of Where (the criteria (Col, Op, Value)) for the cols to search in.

    updates

    is an array of Update giving the cols and data to update

    returns

    the number of rows updated

    Definition Classes
    DBManagerDML
  76. def updatePassword(newPass: String): String
  77. def usingOpt[A <: AnyRef { def close(): Unit }, B](optA: Option[A], getA: ⇒ A)(f: (A) ⇒ B): B
    Definition Classes
    DBManagerDML
  78. val vals: Array[Any]
    Definition Classes
    DBManager → JsonFormatted
  79. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  81. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Deprecated Value Members

  1. def aggregateBigInt(aggregates: Aggregates, wheres: Wheres, havings: Havings = Array()): Array[Any]
    Annotations
    @deprecated
    Deprecated

    (Since version 22 Oct 2016) use aggregateBigDecimal as this may result in loss of precision

  2. def aggregateBigIntOld(aggregates: Aggregates, wheres: Wheres, havings: Havings = Array()): Array[Any]
    Annotations
    @deprecated
    Deprecated

    (Since version 22 Oct 2016) use aggregateBigDecimal as this may result in loss of precision

  3. def aggregateGroupHavingOld[T](aggregates: Aggregates, wheres: Wheres, groupByIntervals: GroupByIntervals, havings: Havings, func: (ResultSet, String) ⇒ T)(implicit func2: (String) ⇒ T = ???, optConn: OptConn = None): List[Array[Any]]

    protected def is used because this will need to be overridden in SecureDBManager

    protected def is used because this will need to be overridden in SecureDBManager

    http://stackoverflow.com/a/197300/243233

    Attributes
    protected[sh.db]
    Definition Classes
    DBManagerDML
    Annotations
    @deprecated
    Deprecated

    (Since version kept for testing) will be removed

  4. def copyTo(dest: DBManager): Long

    this is inefficient.

    this is inefficient. It inserts one row at a time

    Annotations
    @deprecated
    Deprecated
  5. def incrementCol(where: Where, increment: Increment): Int
    Annotations
    @deprecated
    Deprecated
  6. def incrementCols(wheres: Wheres, increments: Increments)(implicit optConn: OptConn = None): Int

    This attempts to provide ACID via the DB's update with x = x + 1 feature (see http://stackoverflow.com/a/15987873/243233http://stackoverflow.com/a/15987873/243233) However, it depend's on the DBMS's check statement to ensure that unsigned numbers never go below 0.

    This attempts to provide ACID via the DB's update with x = x + 1 feature (see http://stackoverflow.com/a/15987873/243233http://stackoverflow.com/a/15987873/243233) However, it depend's on the DBMS's check statement to ensure that unsigned numbers never go below 0.

    (Why incrementCols is used instead of a combination of read and then update?) This is due to concurrency issues and "lost updates". See: http://dba.fyicenter.com/Interview-Questions/RDBMS-FUNDAMENTALS/RDBMS_FUNDAMENTALS_Lost_Update_Problem.html http://cisnet.baruch.cuny.edu/holowczak/classes/3400/dbms_functions/

    The solution used here (increment the col before read) is based on the suggestion at the following links http://dev.mysql.com/doc/refman/5.0/en/innodb-locking-reads.html http://dev.mysql.com/doc/refman/5.1/en/innodb-locking-reads.html The same links also suggest an alternate fix - to use "SELECT FOR UPDATE". However, in our case, this seems to be the most convenient fix.

    Note that MySQL does not support check. Hence this is insecure/unreliable in MySQL. For this reason, do not use this at all. Use incrementColTx instead which performs an ACID update (read, increment, update in a transaction) If not using H2 or Postgresql, this is fine to use.

    Definition Classes
    DBManagerDML
    Annotations
    @deprecated
    Deprecated
  7. def indexBy(cols: Col*): Int
    Definition Classes
    DBManagerDDL
    Annotations
    @deprecated
    Deprecated

    (Since version 21 Nov 2017) Index reduces performance

Inherited from JsonFormatted

Inherited from DBManagerDDL

Inherited from DBManagerDML

Inherited from AnyRef

Inherited from Any

Ungrouped