Package io.github.coho04.mysql.entities
Class Row
java.lang.Object
io.github.coho04.mysql.entities.Row
- All Implemented Interfaces:
QueryHelper
Represents a row in a MySQL database table.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.coho04.mysql.interfaces.QueryHelper
QueryHelper.ResultSetHandler<T>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
drop()
Deletes the row from the database table associated with this object.Retrieves the list of columns in the table.getData()
Retrieves data from the MySQL database.Retrieves the database associated with this Row.int
getId()
Retrieves the id associated with this Row.getTable()
Retrieves the table associated with this Row.void
Sets the value of a specific item in the column.void
setExportMap
(HashMap<String, SearchResult> newMap) Sets the export map for the Row.Retrieves the list of columns in the table.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.coho04.mysql.interfaces.QueryHelper
executeQuery, executeQuery, executeUpdate, executeUpdate
-
Constructor Details
-
Row
Represents a row in a database table.The Row class contains methods to retrieve and modify data in the corresponding row of the table.
- Parameters:
table
- The Table object representing the table the row belongs to.column
- The Column object representing the column in the row.mysql
- The MYSQL object representing the connection to the database.item
- The value of the column in the row.
-
-
Method Details
-
getData
Retrieves data from the MySQL database.- Returns:
- A HashMap containing the retrieved data. The keys of the HashMap are the column names, and the values are SearchResult objects representing the data in the corresponding columns.
-
setExportMap
Sets the export map for the Row.- Parameters:
newMap
- The HashMap containing the new export map.
-
set
Sets the value of a specific item in the column.- Parameters:
column
- The Column object representing the column to set the value for.item
- The new value to set for the column.
-
showColumns
Retrieves the list of columns in the table.- Returns:
- The list of Column objects representing the columns in the table.
-
getColumns
Retrieves the list of columns in the table.- Returns:
- The list of Column objects representing the columns in the table.
-
getDatabase
Retrieves the database associated with this Row.- Returns:
- the database associated with this Row
-
getTable
Retrieves the table associated with this Row.- Returns:
- the table associated with this Row
-
getId
public int getId()Retrieves the id associated with this Row.- Returns:
- the id associated with this Row
-
drop
public void drop()Deletes the row from the database table associated with this object. The deletion is performed based on the value of the column in the row. The SQL query executed is as follows: DELETE FROM `tableName` WHERE `columnName` = 'columnValue';- See Also:
-