-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3bb54f
commit 001fe00
Showing
14 changed files
with
238 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/org/apache/ibatis/executor/result/ResultMapException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.apache.ibatis.executor.result; | ||
|
||
/** | ||
* @author furious 2024/4/11 | ||
*/ | ||
public class ResultMapException extends RuntimeException{ | ||
|
||
public ResultMapException() { | ||
super(); | ||
} | ||
|
||
public ResultMapException(String message) { | ||
super(message); | ||
} | ||
|
||
public ResultMapException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public ResultMapException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
protected ResultMapException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/org/apache/ibatis/executor/resultset/ResultSetHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.apache.ibatis.executor.resultset; | ||
|
||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
import java.util.List; | ||
|
||
/** | ||
* @author furious 2024/4/11 | ||
*/ | ||
public interface ResultSetHandler { | ||
|
||
<T> List<T> handleResultSets(Statement stmt) throws SQLException; | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/org/apache/ibatis/executor/resultset/ResultSetWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.apache.ibatis.executor.resultset; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.ResultSetMetaData; | ||
import java.sql.SQLException; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.apache.ibatis.session.Configuration; | ||
import org.apache.ibatis.type.TypeHandler; | ||
import org.apache.ibatis.type.TypeHandlerRegistry; | ||
|
||
/** | ||
* @author furious 2024/4/11 | ||
*/ | ||
public class ResultSetWrapper { | ||
|
||
private final ResultSet resultSet; | ||
private final TypeHandlerRegistry typeHandlerRegistry; | ||
private final List<String> columnLabels = new ArrayList<>(); | ||
private final List<String> classNames = new ArrayList<>(); | ||
private final List<Integer> jdbcTypes = new ArrayList<>(); | ||
|
||
public ResultSetWrapper(ResultSet rs, Configuration configuration) throws SQLException { | ||
this.resultSet = rs; | ||
this.typeHandlerRegistry = configuration.getTypeHandlerRegistry(); | ||
ResultSetMetaData metaData = rs.getMetaData(); | ||
int columnCount = metaData.getColumnCount(); | ||
for (int i = 1; i <= columnCount; i++) { | ||
columnLabels.add(metaData.getColumnLabel(i)); | ||
classNames.add(metaData.getColumnClassName(i)); | ||
jdbcTypes.add(metaData.getColumnType(i)); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.apache.ibatis.mapping; | ||
|
||
import org.apache.ibatis.session.Configuration; | ||
|
||
/** | ||
* @author furious 2024/4/11 | ||
*/ | ||
public class ResultMap { | ||
|
||
private Configuration configuration; | ||
/** | ||
* select标签中的resultType | ||
*/ | ||
private Class<?> type; | ||
|
||
public ResultMap() { | ||
} | ||
|
||
public ResultMap(Configuration configuration, Class<?> type) { | ||
this.configuration = configuration; | ||
this.type = type; | ||
} | ||
|
||
public Configuration getConfiguration() { | ||
return configuration; | ||
} | ||
|
||
public void setConfiguration(Configuration configuration) { | ||
this.configuration = configuration; | ||
} | ||
|
||
public Class<?> getType() { | ||
return type; | ||
} | ||
|
||
public void setType(Class<?> type) { | ||
this.type = type; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters