jodd-db/src/main/java/jodd/db/DbQueryBase.java
@SuppressWarnings("MagicConstant")
	protected void initializeJdbc() {
		// connection
		if (connection == null) {
			initSession(session);

			connection = session.getConnection();
		}

		this.query = new DbQueryParser(sqlString);

		// callable statement

		if (query.callable) {
			try {
				if (debug) {
					if (holdability != QueryHoldability.DEFAULT) {
						callableStatement = new LoggableCallableStatement(
							connection.prepareCall(query.sql, type.value(), concurrencyType.value(), holdability.value()),
							query.sql
						);
					} else {
						callableStatement = new LoggableCallableStatement(
							connection.prepareCall(query.sql, type.value(), concurrencyType.value()),
							query.sql
						);
					}
				}
				else {
					if (holdability != QueryHoldability.DEFAULT) {
						callableStatement = connection.prepareCall(
							query.sql, type.value(), concurrencyType.value(), holdability.value());
					} else {
						callableStatement = connection.prepareCall(
							query.sql, type.value(), concurrencyType.value());
					}
				}
			}
			catch (SQLException sex) {
				throw new DbSqlException(this, "Error creating callable statement", sex);
			}

			preparedStatement = callableStatement;
			statement = callableStatement;

			return;
		}

		// prepared statement

		if (query.prepared || forcePreparedStatement) {
			try {
				if (debug) {
					if (generatedColumns != null) {
						if (generatedColumns.length == 0) {
							preparedStatement = new LoggablePreparedStatement(
								connection.prepareStatement(query.sql, Statement.RETURN_GENERATED_KEYS),
								query.sql);
						} else {
							preparedStatement = new LoggablePreparedStatement(
								connection.prepareStatement(query.sql, generatedColumns),
								query.sql);
						}
					} else {
						if (holdability != QueryHoldability.DEFAULT) {
							preparedStatement = new LoggablePreparedStatement(
								connection.prepareStatement(query.sql, type.value(), concurrencyType.value(), holdability.value()),
								query.sql);
						} else {
							preparedStatement = new LoggablePreparedStatement(
								connection.prepareStatement(query.sql, type.value(), concurrencyType.value()),
								query.sql);
						}
					}
				} else {
					if (generatedColumns != null) {
						if (generatedColumns.length == 0) {
							preparedStatement = connection.prepareStatement(query.sql, Statement.RETURN_GENERATED_KEYS);
						} else {
							preparedStatement = connection.prepareStatement(query.sql, generatedColumns);
						}
					} else {
						if (holdability != QueryHoldability.DEFAULT) {
							preparedStatement = connection.prepareStatement(
								query.sql, type.value(), concurrencyType.value(), holdability.value());
						} else {
							preparedStatement = connection.prepareStatement(
								query.sql, type.value(), concurrencyType.value());
						}
					}
				}
			}
			catch (SQLException sex) {
				throw new DbSqlException(this, "Error creating prepared statement", sex);
			}

			statement = preparedStatement;

			return;
		}

		// statement

		try {
			if (holdability != QueryHoldability.DEFAULT) {
				statement = connection.createStatement(type.value(), concurrencyType.value(), holdability.value());
			} else {
				statement = connection.createStatement(type.value(), concurrencyType.value());
			}
		} catch (SQLException sex) {
			throw new DbSqlException(this, "Error creating statement", sex);
		}
	}
@SuppressWarnings("MagicConstant")
	protected void initializeJdbc() {
		// connection
		if (connection == null) {
			initSession(session);

			connection = session.getConnection();
		}

		this.query = new DbQueryParser(sqlString);

		// callable statement

		if (query.callable) {
			try {
				if (debug) {
					if (holdability != QueryHoldability.DEFAULT) {
						callableStatement = new LoggableCallableStatement(
							connection.prepareCall(query.sql, type.value(), concurrencyType.value(), holdability.value()),
							query.sql
						);
					} else {
						callableStatement = new LoggableCallableStatement(
							connection.prepareCall(query.sql, type.value(), concurrencyType.value()),
							query.sql
						);
					}
				}
				else {
					if (holdability != QueryHoldability.DEFAULT) {
						callableStatement = connection.prepareCall(
							query.sql, type.value(), concurrencyType.value(), holdability.value());
					} else {
						callableStatement = connection.prepareCall(
							query.sql, type.value(), concurrencyType.value());
					}
				}
			}
			catch (SQLException sex) {
				throw new DbSqlException(this, "Error creating callable statement", sex);
			}

			preparedStatement = callableStatement;
			statement = callableStatement;

			return;
		}

		// prepared statement

		if (query.prepared || forcePreparedStatement) {
			try {
				if (debug) {
					if (generatedColumns != null) {
						if (generatedColumns.length == 0) {
							preparedStatement = new LoggablePreparedStatement(
								connection.prepareStatement(query.sql, Statement.RETURN_GENERATED_KEYS),
								query.sql);
						} else {
							preparedStatement = new LoggablePreparedStatement(
								connection.prepareStatement(query.sql, generatedColumns),
								query.sql);
						}
					} else {
						if (holdability != QueryHoldability.DEFAULT) {
							preparedStatement = new LoggablePreparedStatement(
								connection.prepareStatement(query.sql, type.value(), concurrencyType.value(), holdability.value()),
								query.sql);
						} else {
							preparedStatement = new LoggablePreparedStatement(
								connection.prepareStatement(query.sql, type.value(), concurrencyType.value()),
								query.sql);
						}
					}
				} else {
					if (generatedColumns != null) {
						if (generatedColumns.length == 0) {
							preparedStatement = connection.prepareStatement(query.sql, Statement.RETURN_GENERATED_KEYS);
						} else {
							preparedStatement = connection.prepareStatement(query.sql, generatedColumns);
						}
					} else {
						if (holdability != QueryHoldability.DEFAULT) {
							preparedStatement = connection.prepareStatement(
								query.sql, type.value(), concurrencyType.value(), holdability.value());
						} else {
							preparedStatement = connection.prepareStatement(
								query.sql, type.value(), concurrencyType.value());
						}
					}
				}
			}
			catch (SQLException sex) {
				throw new DbSqlException(this, "Error creating prepared statement", sex);
			}

			statement = preparedStatement;

			return;
		}

		// statement

		try {
			if (holdability != QueryHoldability.DEFAULT) {
				statement = connection.createStatement(type.value(), concurrencyType.value(), holdability.value());
			} else {
				statement = connection.createStatement(type.value(), concurrencyType.value());
			}
		} catch (SQLException sex) {
			throw new DbSqlException(this, "Error creating statement", sex);
		}
	}
@ SuppressWarnings ( "MagicConstant" ) protected void initializeJdbc ( ) { // connection if ( connection == null ) { initSession ( session ) ; connection = session . getConnection ( ) ; } this . query = new DbQueryParser ( sqlString ) ; // callable statement if ( query . callable ) { try { if ( debug ) { if ( holdability != QueryHoldability . DEFAULT ) { callableStatement = new LoggableCallableStatement ( connection . prepareCall ( query . sql , type . value ( ) , concurrencyType . value ( ) , holdability . value ( ) ) , query . sql ) ; } else { callableStatement = new LoggableCallableStatement ( connection . prepareCall ( query . sql , type . value ( ) , concurrencyType . value ( ) ) , query . sql ) ; } } else { if ( holdability != QueryHoldability . DEFAULT ) { callableStatement = connection . prepareCall ( query . sql , type . value ( ) , concurrencyType . value ( ) , holdability . value ( ) ) ; } else { callableStatement = connection . prepareCall ( query . sql , type . value ( ) , concurrencyType . value ( ) ) ; } } } catch ( SQLException sex ) { throw new DbSqlException ( this , "Error creating callable statement" , sex ) ; } preparedStatement = callableStatement ; statement = callableStatement ; return ; } // prepared statement if ( query . prepared || forcePreparedStatement ) { try { if ( debug ) { if ( generatedColumns != null ) { if ( generatedColumns . length == 0 ) { preparedStatement = new LoggablePreparedStatement ( connection . prepareStatement ( query . sql , Statement . RETURN_GENERATED_KEYS ) , query . sql ) ; } else { preparedStatement = new LoggablePreparedStatement ( connection . prepareStatement ( query . sql , generatedColumns ) , query . sql ) ; } } else { if ( holdability != QueryHoldability . DEFAULT ) { preparedStatement = new LoggablePreparedStatement ( connection . prepareStatement ( query . sql , type . value ( ) , concurrencyType . value ( ) , holdability . value ( ) ) , query . sql ) ; } else { preparedStatement = new LoggablePreparedStatement ( connection . prepareStatement ( query . sql , type . value ( ) , concurrencyType . value ( ) ) , query . sql ) ; } } } else { if ( generatedColumns != null ) { if ( generatedColumns . length == 0 ) { preparedStatement = connection . prepareStatement ( query . sql , Statement . RETURN_GENERATED_KEYS ) ; } else { preparedStatement = connection . prepareStatement ( query . sql , generatedColumns ) ; } } else { if ( holdability != QueryHoldability . DEFAULT ) { preparedStatement = connection . prepareStatement ( query . sql , type . value ( ) , concurrencyType . value ( ) , holdability . value ( ) ) ; } else { preparedStatement = connection . prepareStatement ( query . sql , type . value ( ) , concurrencyType . value ( ) ) ; } } } } catch ( SQLException sex ) { throw new DbSqlException ( this , "Error creating prepared statement" , sex ) ; } statement = preparedStatement ; return ; } // statement try { if ( holdability != QueryHoldability . DEFAULT ) { statement = connection . createStatement ( type . value ( ) , concurrencyType . value ( ) , holdability . value ( ) ) ; } else { statement = connection . createStatement ( type . value ( ) , concurrencyType . value ( ) ) ; } } catch ( SQLException sex ) { throw new DbSqlException ( this , "Error creating statement" , sex ) ; } }
Performs JDBC initialization of the query. Obtains connection, parses the SQL query string
and creates statements. Initialization is performed only once, when switching to initialized state.
Performs JDBC initialization of the query . Obtains connection parses the SQL query string and creates statements . Initialization is performed only once when switching to initialized state .