Prints contents of database table. An optional argument (rowSelect) can be
    given which contains a list of column names and values against which to
    search, allowing a subset of the table to be printed.

    Gets database column headings using PRAGMA call. Automatically adjusts
    each column width based on the longest element that needs to be printed

    Parameters
    ----------
      tableName : int
        Name of table to print.

      rowSelect : list of tuples
        A list of column names and values against to search against.

    Returns:
      int
        The number of table rows printed.

def _PrintDatabaseTable(self, tableName, rowSelect = None):
    """
    Prints contents of database table. An optional argument (rowSelect) can be
    given which contains a list of column names and values against which to
    search, allowing a subset of the table to be printed.

    Gets database column headings using PRAGMA call. Automatically adjusts
    each column width based on the longest element that needs to be printed

    Parameters
    ----------
      tableName : int
        Name of table to print.

      rowSelect : list of tuples
        A list of column names and values against to search against.

    Returns:
      int
        The number of table rows printed.
    """
    goodlogging.Log.Info("DB", "{0}".format(tableName))
    goodlogging.Log.IncreaseIndent()
    tableInfo = self._ActionDatabase("PRAGMA table_info({0})".format(tableName))


    dbQuery = "SELECT * FROM {0}".format(tableName)
    dbQueryParams = []

    if rowSelect is not None:
      dbQuery = dbQuery + " WHERE " + ' AND '.join(['{0}=?'.format(i) for i, j in rowSelect])
      dbQueryParams = [j for i, j in rowSelect]

    tableData = self._ActionDatabase(dbQuery, dbQueryParams)
    columnCount = len(tableInfo)

    columnWidths = [0]*columnCount

    columnHeadings = []
    for count, column in enumerate(tableInfo):
      columnHeadings.append(column[1])
      columnWidths[count] = len(column[1])

    for row in tableData:
      for count, column in enumerate(row):
        if len(str(column)) > columnWidths[count]:
          columnWidths[count] = len(column)

    printStr = "|"
    for count, column in enumerate(columnWidths):
      printStr = printStr + " {{0[{0}]:{1}}} |".format(count, columnWidths[count])

    goodlogging.Log.Info("DB", printStr.format(columnHeadings))
    goodlogging.Log.Info("DB", "-"*(sum(columnWidths)+3*len(columnWidths)+1))

    for row in tableData:
      noneReplacedRow = ['-' if i is None else i for i in row]
      goodlogging.Log.Info("DB", printStr.format(noneReplacedRow))

    goodlogging.Log.DecreaseIndent()
    goodlogging.Log.NewLine()

    return len(tableData)