Class QueryBuilder
java.lang.Object
io.github.blyznytsiaorg.bibernate.dao.jdbc.dsl.QueryBuilder
- Direct Known Subclasses:
DeleteQueryBuilder
,InsertQueryBuilder
,SelectQueryBuilder
,UpdateQueryBuilder
An abstract class representing a generic SQL query builder with common constants and methods
for constructing SQL statements such as SELECT, UPDATE, DELETE, etc.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The wildcard character representing all fields in SELECT statements.static final String
The logical AND operator for combining conditions in WHERE clauses.static final String
The AS for aliasesstatic final String
The template for BETWEEN conditions with placeholders for field, lower bound, and upper bound.static final String
Represents the close parenthesis ")" in SQL.static final String
The comma used to separate elements in SQL statements.static final String
The SQL keyword for DELETE statements.static final String
The dot used to separate table and column names in SQL statements.static final String
The equality operator used in WHERE clauses.static final String
The SQL keyword for FROM clauses in SELECT statements.static final String
The SQL keyword for GROUP BY clauses.static final String
The SQL keyword for HAVING clauses.static final String
The logical IN operator for combining conditions in WHERE clauses.static final String
The SQL template for INSERT INTO statements with placeholders for table name, field names, and values.static final String
Represents the open parenthesis "(" in SQL.static final String
The logical OR operator for combining conditions in WHERE clauses.static final String
The parameter placeholder used for prepared statements.static final String
The SQL keyword for SELECT statements.static final String
The semicolon used to terminate SQL statements.static final String
The SQL keyword for SET clauses in UPDATE statements.static final String
The space character used in SQL statements for better readability.protected final String
The name of the table being queried or modified.static final String
The underscore is used to sepastatic final String
The SQL keyword for UNION clauses.static final String
The SQL keyword for UPDATE statements.static final String
The SQL keyword for WHERE clauses.The list of conditions used in WHERE clauses. -
Constructor Summary
ConstructorDescriptionQueryBuilder
(String tableName, List<String> whereConditions) Constructs a new QueryBuilder with the specified table name and list of WHERE conditions. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
handleWhereCondition
(StringBuilder queryBuilder) Appends the WHERE clause to the provided query builder if there are any conditions specified.
-
Field Details
-
INSERT_INTO
The SQL template for INSERT INTO statements with placeholders for table name, field names, and values.- See Also:
-
SELECT
The SQL keyword for SELECT statements.- See Also:
-
UPDATE
The SQL keyword for UPDATE statements.- See Also:
-
DELETE
The SQL keyword for DELETE statements.- See Also:
-
SET
The SQL keyword for SET clauses in UPDATE statements.- See Also:
-
ALL_FIELDS
The wildcard character representing all fields in SELECT statements.- See Also:
-
FROM
The SQL keyword for FROM clauses in SELECT statements.- See Also:
-
WHERE
The SQL keyword for WHERE clauses.- See Also:
-
GROUP_BY
The SQL keyword for GROUP BY clauses.- See Also:
-
HAVING
The SQL keyword for HAVING clauses.- See Also:
-
UNION
The SQL keyword for UNION clauses.- See Also:
-
COMA
The comma used to separate elements in SQL statements.- See Also:
-
DOT
The dot used to separate table and column names in SQL statements.- See Also:
-
UNDERSCORE
The underscore is used to sepa- See Also:
-
SEMICOLON
The semicolon used to terminate SQL statements.- See Also:
-
SPACE
The space character used in SQL statements for better readability.- See Also:
-
AND
The logical AND operator for combining conditions in WHERE clauses.- See Also:
-
AS
The AS for aliases- See Also:
-
OR
The logical OR operator for combining conditions in WHERE clauses.- See Also:
-
IN
The logical IN operator for combining conditions in WHERE clauses.- See Also:
-
OPEN_BRACKET
Represents the open parenthesis "(" in SQL.- See Also:
-
CLOSE_BRACKET
Represents the close parenthesis ")" in SQL.- See Also:
-
EQ
The equality operator used in WHERE clauses.- See Also:
-
PARAMETER
The parameter placeholder used for prepared statements.- See Also:
-
BETWEEN_S_AND_S
The template for BETWEEN conditions with placeholders for field, lower bound, and upper bound.- See Also:
-
tableName
The name of the table being queried or modified. -
whereConditions
The list of conditions used in WHERE clauses.
-
-
Constructor Details
-
QueryBuilder
Constructs a new QueryBuilder with the specified table name and list of WHERE conditions.- Parameters:
tableName
- The name of the table being queried or modified.whereConditions
- The list of conditions used in WHERE clauses.
-
-
Method Details
-
handleWhereCondition
Appends the WHERE clause to the provided query builder if there are any conditions specified.- Parameters:
queryBuilder
- The StringBuilder to which the WHERE clause is appended.
-