Skip to content

Commit

Permalink
feat: support BigDecimal and BigInteger
Browse files Browse the repository at this point in the history
  • Loading branch information
teletha committed Dec 25, 2023
1 parent 1865eda commit 09be090
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/typewriter/h2/H2.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
package typewriter.h2;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
Expand Down Expand Up @@ -44,6 +46,8 @@ public class H2 extends Dialect {
TYPES.put(Double.class, "double");
TYPES.put(Short.class, "tinyint");
TYPES.put(Byte.class, "smallint");
TYPES.put(BigInteger.class, "bigint");
TYPES.put(BigDecimal.class, "decimal");
TYPES.put(Boolean.class, "boolean");
TYPES.put(String.class, "varchar");
TYPES.put(List.class, "varchar");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/typewriter/maria/MariaDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
package typewriter.maria;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
Expand Down Expand Up @@ -49,6 +51,8 @@ public class MariaDB extends Dialect {
TYPES.put(Double.class, "double");
TYPES.put(Short.class, "tinyint");
TYPES.put(Byte.class, "smallint");
TYPES.put(BigInteger.class, "bigint");
TYPES.put(BigDecimal.class, "decimal");
TYPES.put(Boolean.class, "boolean");
TYPES.put(String.class, "text");
TYPES.put(List.class, "json");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/typewriter/sqlite/SQLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
package typewriter.sqlite;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
Expand Down Expand Up @@ -66,6 +68,8 @@ protected void xFunc() throws SQLException {
TYPES.put(Double.class, "real");
TYPES.put(Short.class, "integer");
TYPES.put(Byte.class, "integer");
TYPES.put(BigInteger.class, "integer");
TYPES.put(BigDecimal.class, "real");
TYPES.put(Boolean.class, "bit");
TYPES.put(String.class, "text");
TYPES.put(List.class, "json");
Expand Down

0 comments on commit 09be090

Please sign in to comment.