Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more types #37

Open
waynew opened this issue Jan 16, 2025 · 1 comment
Open

Support more types #37

waynew opened this issue Jan 16, 2025 · 1 comment

Comments

@waynew
Copy link

waynew commented Jan 16, 2025

I was trying to used purepyodbc to connect to IBM db2 on AIX, in particular the HCL Commerce database. It almost immediately tripped over the types.

https://docs.oracle.com/en/java/javase/21/docs/api/constant-values.html#java.sql (search for java.sql.Types) has way more than found in

class SqlDataType(Enum):

Here's the list of types that from the java class

Modifier and Type Constant Field Value
public static final int ARRAY 2003
public static final int BIGINT -5
public static final int BINARY -2
public static final int BIT -7
public static final int BLOB 2004
public static final int BOOLEAN 16
public static final int CHAR 1
public static final int CLOB 2005
public static final int DATALINK 70
public static final int DATE 91
public static final int DECIMAL 3
public static final int DISTINCT 2001
public static final int DOUBLE 8
public static final int FLOAT 6
public static final int INTEGER 4
public static final int JAVA_OBJECT 2000
public static final int LONGNVARCHAR -16
public static final int LONGVARBINARY -4
public static final int LONGVARCHAR -1
public static final int NCHAR -15
public static final int NCLOB 2011
public static final int NULL 0
public static final int NUMERIC 2
public static final int NVARCHAR -9
public static final int OTHER 1111
public static final int REAL 7
public static final int REF 2006
public static final int REF_CURSOR 2012
public static final int ROWID -8
public static final int SMALLINT 5
public static final int SQLXML 2009
public static final int STRUCT 2002
public static final int TIME 92
public static final int TIME_WITH_TIMEZONE 2013
public static final int TIMESTAMP 93
public static final int TIMESTAMP_WITH_TIMEZONE 2014
public static final int TINYINT -6
public static final int VARBINARY -3
public static final int VARCHAR 12

In my case I needed to add BIGINT, DOUBLE, and DECIMAL. For DECIMAL I used decimal.Decimal as the conversion.

@chrisimcevoy
Copy link
Owner

Absolutely! 😄

I hope to get looking at this project more this year. In the meantime, contributions are welcome. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants