@@ -1213,14 +1213,15 @@ public PreparedStatement getStatement(@NotNull SQLConfig<T, M, L> config, String
12131213 sql = config .gainSQL (config .isPrepared ());
12141214 }
12151215
1216+ Connection conn = getConnection (config );
12161217 PreparedStatement statement ; //创建Statement对象
12171218 if (config .getMethod () == RequestMethod .POST && config .getId () == null ) { //自增id
12181219 if (config .isOracle ()) {
12191220 // 解决 oracle 使用自增主键 插入获取不到id问题
12201221 String [] generatedColumns = {config .getIdKey ()};
1221- statement = getConnection ( config ) .prepareStatement (sql , generatedColumns );
1222+ statement = conn .prepareStatement (sql , generatedColumns );
12221223 } else {
1223- statement = getConnection ( config ) .prepareStatement (sql , Statement .RETURN_GENERATED_KEYS );
1224+ statement = conn .prepareStatement (sql , Statement .RETURN_GENERATED_KEYS );
12241225 }
12251226 }
12261227 else if (RequestMethod .isGetMethod (config .getMethod (), true )) {
@@ -1234,13 +1235,13 @@ else if (RequestMethod.isGetMethod(config.getMethod(), true)) {
12341235 if (config .isMySQL () || config .isTiDB () || config .isMariaDB () || config .isOracle () || config .isSQLServer () || config .isDb2 ()
12351236 || config .isPostgreSQL () || config .isCockroachDB () || config .isOpenGauss () || config .isTimescaleDB () || config .isQuestDB ()
12361237 ) {
1237- statement = getConnection ( config ) .prepareStatement (sql , ResultSet .TYPE_SCROLL_SENSITIVE , ResultSet .CONCUR_UPDATABLE );
1238+ statement = conn .prepareStatement (sql , ResultSet .TYPE_SCROLL_SENSITIVE , ResultSet .CONCUR_UPDATABLE );
12381239 } else {
1239- statement = getConnection ( config ) .prepareStatement (sql );
1240+ statement = conn .prepareStatement (sql );
12401241 }
12411242 }
12421243 else {
1243- statement = getConnection ( config ) .prepareStatement (sql );
1244+ statement = conn .prepareStatement (sql );
12441245 }
12451246
12461247 List <Object > valueList = config .isPrepared () ? config .getPreparedValueList () : null ;
0 commit comments