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
FieldsModifier and TypeFieldDescriptionstatic final StringThe wildcard character representing all fields in SELECT statements.static final StringThe logical AND operator for combining conditions in WHERE clauses.static final StringThe AS for aliasesstatic final StringThe template for BETWEEN conditions with placeholders for field, lower bound, and upper bound.static final StringRepresents the close parenthesis ")" in SQL.static final StringThe comma used to separate elements in SQL statements.static final StringThe SQL keyword for DELETE statements.static final StringThe dot used to separate table and column names in SQL statements.static final StringThe equality operator used in WHERE clauses.static final StringThe SQL keyword for FROM clauses in SELECT statements.static final StringThe SQL keyword for GROUP BY clauses.static final StringThe SQL keyword for HAVING clauses.static final StringThe logical IN operator for combining conditions in WHERE clauses.static final StringThe SQL template for INSERT INTO statements with placeholders for table name, field names, and values.static final StringRepresents the open parenthesis "(" in SQL.static final StringThe logical OR operator for combining conditions in WHERE clauses.static final StringThe parameter placeholder used for prepared statements.static final StringThe SQL keyword for SELECT statements.static final StringThe semicolon used to terminate SQL statements.static final StringThe SQL keyword for SET clauses in UPDATE statements.static final StringThe space character used in SQL statements for better readability.protected final StringThe name of the table being queried or modified.static final StringThe underscore is used to sepastatic final StringThe SQL keyword for UNION clauses.static final StringThe SQL keyword for UPDATE statements.static final StringThe SQL keyword for WHERE clauses.The list of conditions used in WHERE clauses. -
Constructor Summary
ConstructorsConstructorDescriptionQueryBuilder(String tableName, List<String> whereConditions) Constructs a new QueryBuilder with the specified table name and list of WHERE conditions. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidhandleWhereCondition(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.
-