Class SQLQueryGenerator
-
Constructor Summary
ConstructorDescriptionSQLQueryGenerator
(TableNameConfiguration tableNameConfiguration, DatabaseDriver databaseDriver) Instantiates a new SQL query generator -
Method Summary
Modifier and TypeMethodDescriptiongenerateAddFlagStatement
(Connection connection) Gets a prepared statement for inserting a flag into the flag tablegenerateAddPortalFlagRelationStatement
(Connection connection, StorageType portalType) Gets a prepared statement for inserting a relation between a portal and a flaggenerateAddPortalPositionStatement
(Connection connection, StorageType portalType) Gets a prepared statement for inserting a portal position into the portal position tablegenerateAddPortalPositionTypeStatement
(Connection connection) Gets a prepared statement for inserting a portal position type into the portal position type tablegenerateAddPortalStatement
(Connection connection, RealPortal portal, StorageType portalType) Gets a prepared statement for adding a portalgenerateCreateFlagRelationTableStatement
(Connection connection, StorageType portalType) Gets a prepared statement for adding a flag to a portalgenerateCreateFlagTableStatement
(Connection connection) Gets a prepared statement for creating the flag tablegenerateCreateLastKnownNameTableStatement
(Connection connection) Gets a prepared statement for creating the last known name tablegenerateCreatePortalPositionIndex
(Connection connection, StorageType portalType) Gets a prepared statement for adding an index on portalName, networkName for the portal position tablegenerateCreatePortalPositionTableStatement
(Connection connection, StorageType portalType) Gets a prepared statement for creating the portal position tableGets a prepared statement for creating the portal position type tablegenerateCreatePortalTableStatement
(Connection connection, StorageType portalType) Gets a prepared statement for creating a new portals tablegenerateCreatePortalViewStatement
(Connection connection, StorageType portalType) Gets a prepared statement for generating the portal viewgenerateCreateServerInfoTableStatement
(Connection connection) Gets a prepared statement for creating the server info tablegenerateDeleteWorldStatement
(Connection connection, String world, StorageType storageType) generateGetAllFlagsStatement
(Connection connection) Gets a prepared statement for getting all stored flagsgenerateGetAllPortalPositionTypesStatement
(Connection connection) Gets a prepared statement for getting all stored portal position typesgenerateGetAllPortalsOfNetwork
(Connection connection, String netName, StorageType portalType) generateGetAllPortalsStatement
(Connection connection, StorageType portalType) Gets a prepared statement for selecting all portals in a tablegenerateGetPortalPositionsStatement
(Connection connection, StorageType portalType) Gets a prepared statement for getting all portal positions for one portalgenerateGetPortalPositionStatement
(Connection connection, Portal portal, PortalPosition portalPosition, StorageType portalType) generateGetPortalStatement
(Connection connection, Portal portal, StorageType portalType) Generate statement to fetch the data on specified portalgenerateRemoveFlagsStatement
(Connection connection, StorageType portalType, Portal portal) Gets a prepared statement for removing the relation between a portal and its flagsgenerateRemoveFlagStatement
(Connection connection, StorageType portalType, Portal portal, Character flagChar) Gets a prepared statement for removing the relation between a portal and its flaggenerateRemoveGateStatement
(Connection connection, String gateFormat, StorageType storageType) generateRemovePortalPositionsStatement
(Connection connection, StorageType portalType, Portal portal) Gets a prepared statement for removing a positiongenerateRemovePortalPositionStatement
(Connection connection, StorageType portalType, Portal portal, PortalPosition portalPosition) generateRemovePortalStatement
(Connection connection, Portal portal, StorageType portalType) Gets a prepared statement for removing a portalgenerateSetPortalMetaStatement
(Connection connection, Portal portal, String meta, StorageType portalType) generateSetPortalPositionMeta
(Connection connection, RealPortal portal, PortalPosition portalPosition, String meta, StorageType portalType) generateShowPortalPositionIndexesStatement
(Connection connection, StorageType portalType) Gets a prepared statement for getting the portal position indexgenerateUpdateLastKnownNameStatement
(Connection connection) Gets a prepared statement for inserting/updating the last known name of a playergenerateUpdateNetworkNameStatement
(Connection connection, String newName, String networkName, StorageType portalType) generateUpdatePortalNameStatement
(Connection connection, String newName, String portalName, String networkName, StorageType portalType) generateUpdateServerInfoStatus
(Connection connection, String serverUUID, String serverName) Gets a prepared statement for updating a server's name
-
Constructor Details
-
SQLQueryGenerator
public SQLQueryGenerator(TableNameConfiguration tableNameConfiguration, DatabaseDriver databaseDriver) Instantiates a new SQL query generator- Parameters:
tableNameConfiguration
-The config to use for table names
databaseDriver
-The currently used database driver (for syntax variations)
-
-
Method Details
-
generateGetAllPortalsStatement
public PreparedStatement generateGetAllPortalsStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for selecting all portals in a table- Parameters:
connection
-The database connection to use
portalType
-The type of the portal (used to determine which table to select from)
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateGetAllFlagsStatement
Gets a prepared statement for getting all stored flags- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateUpdateLastKnownNameStatement
public PreparedStatement generateUpdateLastKnownNameStatement(Connection connection) throws SQLException Gets a prepared statement for inserting/updating the last known name of a player- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreatePortalTableStatement
public PreparedStatement generateCreatePortalTableStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for creating a new portals table- Parameters:
connection
-The database connection to use
portalType
-The type of the portal (used to determine which table to create)
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreatePortalPositionTypeTableStatement
public PreparedStatement generateCreatePortalPositionTypeTableStatement(Connection connection) throws SQLException Gets a prepared statement for creating the portal position type table- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateAddPortalPositionTypeStatement
public PreparedStatement generateAddPortalPositionTypeStatement(Connection connection) throws SQLException Gets a prepared statement for inserting a portal position type into the portal position type table- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateGetAllPortalPositionTypesStatement
public PreparedStatement generateGetAllPortalPositionTypesStatement(Connection connection) throws SQLException Gets a prepared statement for getting all stored portal position types- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreatePortalPositionTableStatement
public PreparedStatement generateCreatePortalPositionTableStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for creating the portal position table- Parameters:
connection
-The database connection to use
portalType
-The type of the portal (used to determine which table to select from)
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreatePortalPositionIndex
public PreparedStatement generateCreatePortalPositionIndex(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for adding an index on portalName, networkName for the portal position table- Parameters:
connection
-The database connection to use
portalType
-The type of portal to add to the index.
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateAddPortalPositionStatement
public PreparedStatement generateAddPortalPositionStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for inserting a portal position into the portal position table- Parameters:
connection
-The database connection to use
portalType
-The type of the portal (used to determine which table to select from)
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateRemovePortalPositionsStatement
public PreparedStatement generateRemovePortalPositionsStatement(Connection connection, StorageType portalType, Portal portal) throws SQLException Gets a prepared statement for removing a position- Parameters:
connection
-The database connection to use
portalType
-The type of the portal (used to determine which table to select from)
portal
- The relevent portal.- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateRemovePortalPositionStatement
public PreparedStatement generateRemovePortalPositionStatement(Connection connection, StorageType portalType, Portal portal, PortalPosition portalPosition) throws SQLException - Throws:
SQLException
-
generateGetPortalPositionsStatement
public PreparedStatement generateGetPortalPositionsStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for getting all portal positions for one portal- Parameters:
connection
-The database connection to use
portalType
-The type of the portal (used to determine which table to select from)
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreateFlagTableStatement
public PreparedStatement generateCreateFlagTableStatement(Connection connection) throws SQLException Gets a prepared statement for creating the flag table- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreateServerInfoTableStatement
public PreparedStatement generateCreateServerInfoTableStatement(Connection connection) throws SQLException Gets a prepared statement for creating the server info table- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreateLastKnownNameTableStatement
public PreparedStatement generateCreateLastKnownNameTableStatement(Connection connection) throws SQLException Gets a prepared statement for creating the last known name table- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreateFlagRelationTableStatement
public PreparedStatement generateCreateFlagRelationTableStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for adding a flag to a portal- Parameters:
connection
-The database connection to use
portalType
-The type of portal to create the table for
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateCreatePortalViewStatement
public PreparedStatement generateCreatePortalViewStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for generating the portal view- Parameters:
connection
-The database connection to use
portalType
-The type of portal to create the view for
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateAddFlagStatement
Gets a prepared statement for inserting a flag into the flag table- Parameters:
connection
-The database connection to use
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateAddPortalFlagRelationStatement
public PreparedStatement generateAddPortalFlagRelationStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for inserting a relation between a portal and a flag- Parameters:
connection
-The database connection to use
portalType
-The portal type to add the flag for
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateRemoveFlagsStatement
public PreparedStatement generateRemoveFlagsStatement(Connection connection, StorageType portalType, Portal portal) throws SQLException Gets a prepared statement for removing the relation between a portal and its flags- Parameters:
connection
-The database connection to use
portalType
-The portal type to remove the flags from
portal
- The relevent portal- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateRemoveFlagStatement
public PreparedStatement generateRemoveFlagStatement(Connection connection, StorageType portalType, Portal portal, Character flagChar) throws SQLException Gets a prepared statement for removing the relation between a portal and its flag- Parameters:
connection
-The database connection to use
portalType
-The portal type to remove the flags from
portal
- The relevent portalflagChar
-A character representing a portal flag
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateAddPortalStatement
public PreparedStatement generateAddPortalStatement(Connection connection, RealPortal portal, StorageType portalType) throws SQLException Gets a prepared statement for adding a portal- Parameters:
connection
-The database connection to use
portal
-The portal to add
portalType
-The type of the portal (used to determine which table to update)
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateRemovePortalStatement
public PreparedStatement generateRemovePortalStatement(Connection connection, Portal portal, StorageType portalType) throws SQLException Gets a prepared statement for removing a portal- Parameters:
connection
-The database connection to use
portal
-The portal to remove
portalType
-The type of the portal (used to determine which table to update)
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateUpdateServerInfoStatus
public PreparedStatement generateUpdateServerInfoStatus(Connection connection, String serverUUID, String serverName) throws SQLException Gets a prepared statement for updating a server's name- Parameters:
connection
-The database connection to use
serverUUID
-The UUID of the server to update
serverName
-The new name of the server
- Returns:
The prepared statement for updating the server info
- Throws:
SQLException
-If unable to prepare the statement
-
generateShowPortalPositionIndexesStatement
public PreparedStatement generateShowPortalPositionIndexesStatement(Connection connection, StorageType portalType) throws SQLException Gets a prepared statement for getting the portal position index- Parameters:
connection
-The database connection to use
portalType
-The type of the portal (used to determine which index to get)
- Returns:
A prepared statement
- Throws:
SQLException
-If unable to prepare the statement
-
generateGetPortalStatement
public PreparedStatement generateGetPortalStatement(Connection connection, Portal portal, StorageType portalType) throws SQLException Generate statement to fetch the data on specified portal- Parameters:
connection
-A sql connection
portal
-the portal to fetch data from
portalType
-The type of the portal
- Returns:
A prepared statement to fetch data on specified portal
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-
generateSetPortalMetaStatement
public PreparedStatement generateSetPortalMetaStatement(Connection connection, Portal portal, String meta, StorageType portalType) throws SQLException - Parameters:
connection
-A sql connection to the database
portal
-The portal to modify in the database
meta
-The meta to set
portalType
-how the portal is being stored
- Returns:
A prepared statement that can modify the metadata of a portal
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-
generateSetPortalPositionMeta
public PreparedStatement generateSetPortalPositionMeta(Connection connection, RealPortal portal, PortalPosition portalPosition, String meta, StorageType portalType) throws SQLException - Parameters:
connection
-A sql connection to the database
portal
-The portal owning the portal position
portalPosition
-The portal position to change the metadata on
meta
-The meta to apply to the portal position
portalType
-How the porta lis being stored
- Returns:
A prepared statement able to set the metadata on a portal position
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-
generateGetPortalPositionStatement
public PreparedStatement generateGetPortalPositionStatement(Connection connection, Portal portal, PortalPosition portalPosition, StorageType portalType) throws SQLException - Parameters:
connection
-A sql connection to the database
portal
-The portal owning the portal position
portalPosition
-The portal position to get data on
portalType
-How the portal is stored
- Returns:
A prepared statement able to modify fetch data on the portal position
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-
generateUpdateNetworkNameStatement
public PreparedStatement generateUpdateNetworkNameStatement(Connection connection, String newName, String networkName, StorageType portalType) throws SQLException - Parameters:
connection
-A sql database connection
newName
-The new name of the network
networkName
-The previous name of the network
portalType
-How the portals in the network are being stored
- Returns:
A prepared statement able to modify the network name of all portals with the specified network
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-
generateUpdatePortalNameStatement
public PreparedStatement generateUpdatePortalNameStatement(Connection connection, String newName, String portalName, String networkName, StorageType portalType) throws SQLException - Parameters:
connection
-A sql database connection
newName
-The new name of the portal to modify
portalName
-The previous portal name
networkName
-The network name of the portal
portalType
-How the portal is being stored
- Returns:
A prepared statement able to change the name of a portal
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-
generateGetAllPortalsOfNetwork
public PreparedStatement generateGetAllPortalsOfNetwork(Connection connection, String netName, StorageType portalType) throws SQLException - Parameters:
connection
-A sql connection to the database
netName
-The name of the network to get all portals from
portalType
-how the portals in the network is being stored
- Returns:
A prepared statement able to fetch all portals in specified network
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-
generateDeleteWorldStatement
public PreparedStatement generateDeleteWorldStatement(Connection connection, String world, StorageType storageType) throws SQLException - Parameters:
connection
-A sql connection to the database
world
-The world uuid to remove all portals from
storageType
-How the portals in the world is being stored
- Returns:
A prepared statement able to delete all data on portals in specified world
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-
generateRemoveGateStatement
public PreparedStatement generateRemoveGateStatement(Connection connection, String gateFormat, StorageType storageType) throws SQLException - Parameters:
connection
-A sql connection to the database
gateFormat
-The file name of the gate format to remove all portals of
storageType
-How the portals are being stored
- Returns:
A prepared statement able to remove all portals of specified gate format
- Throws:
SQLException
-If the syntax is incorrect or any other sql faults
-