[sqlite] Does SQLite support user-defined data-types ?
Hi, I'm starting with SQLite and I would like to know if it is possible to create user-defined data-types through the following SQL command: create type MyType ... ? In fact, I need it to map a database with an object-oriented model, so that I could manage the objects in a ResultSet like it follows: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); System.out.println("Lieu du dept : " + dept.getLieu()); } Is there a way to do it with SQLite ? Regards, Jerome - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Does SQLite support user-defined data-types ?
Sqlite is flexible in typing. You can create user defined types just by declaring them in your SQL which creates tables. Thereafter the API will return the declared type and the actual type so that you can process it appropriately. Jerome CORRENOZ wrote: Hi, I'm starting with SQLite and I would like to know if it is possible to create user-defined data-types through the following SQL command: create type MyType ... ? In fact, I need it to map a database with an object-oriented model, so that I could manage the objects in a ResultSet like it follows: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); System.out.println("Lieu du dept : " + dept.getLieu()); } Is there a way to do it with SQLite ? Regards, Jerome - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Does SQLite support user-defined data-types ?
Now, I can use user-dfined types by declaring them with SQL create tables. Fine ! But when I try to use the following code to get an object, I get a ClassCastException: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); } Is it normal or is it due to the fact that SQLite doesn't support SQL3 commands, mainly the getTypeMap() command that maps a Java class with a SQL type ? Notice that my Java class implements SQLData but it seems having no effect. Thanks for your answer, Jerome John Stanton wrote: Sqlite is flexible in typing. You can create user defined types just by declaring them in your SQL which creates tables. Thereafter the API will return the declared type and the actual type so that you can process it appropriately. Jerome CORRENOZ wrote: Hi, I'm starting with SQLite and I would like to know if it is possible to create user-defined data-types through the following SQL command: create type MyType ... ? In fact, I need it to map a database with an object-oriented model, so that I could manage the objects in a ResultSet like it follows: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); System.out.println("Lieu du dept : " + dept.getLieu()); } Is there a way to do it with SQLite ? Regards, Jerome - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Does SQLite support user-defined data-types ?
You need to revise your Java interface or maybe find another. What are you using? Jerome CORRENOZ wrote: Now, I can use user-dfined types by declaring them with SQL create tables. Fine ! But when I try to use the following code to get an object, I get a ClassCastException: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); } Is it normal or is it due to the fact that SQLite doesn't support SQL3 commands, mainly the getTypeMap() command that maps a Java class with a SQL type ? Notice that my Java class implements SQLData but it seems having no effect. Thanks for your answer, Jerome John Stanton wrote: Sqlite is flexible in typing. You can create user defined types just by declaring them in your SQL which creates tables. Thereafter the API will return the declared type and the actual type so that you can process it appropriately. Jerome CORRENOZ wrote: Hi, I'm starting with SQLite and I would like to know if it is possible to create user-defined data-types through the following SQL command: create type MyType ... ? In fact, I need it to map a database with an object-oriented model, so that I could manage the objects in a ResultSet like it follows: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); System.out.println("Lieu du dept : " + dept.getLieu()); } Is there a way to do it with SQLite ? Regards, Jerome - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Does SQLite support user-defined data-types ?
I'm implementing the SQLData interface. Is it the right one ? John Stanton wrote: You need to revise your Java interface or maybe find another. What are you using? Jerome CORRENOZ wrote: Now, I can use user-dfined types by declaring them with SQL create tables. Fine ! But when I try to use the following code to get an object, I get a ClassCastException: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); } Is it normal or is it due to the fact that SQLite doesn't support SQL3 commands, mainly the getTypeMap() command that maps a Java class with a SQL type ? Notice that my Java class implements SQLData but it seems having no effect. Thanks for your answer, Jerome John Stanton wrote: Sqlite is flexible in typing. You can create user defined types just by declaring them in your SQL which creates tables. Thereafter the API will return the declared type and the actual type so that you can process it appropriately. Jerome CORRENOZ wrote: Hi, I'm starting with SQLite and I would like to know if it is possible to create user-defined data-types through the following SQL command: create type MyType ... ? In fact, I need it to map a database with an object-oriented model, so that I could manage the objects in a ResultSet like it follows: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); System.out.println("Lieu du dept : " + dept.getLieu()); } Is there a way to do it with SQLite ? Regards, Jerome - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Does SQLite support user-defined data-types ?
If you are implementing JDBC to Sqlite then you just need to write a class. You could use an existing JDBC class as a template. Jerome CORRENOZ wrote: I'm implementing the SQLData interface. Is it the right one ? John Stanton wrote: You need to revise your Java interface or maybe find another. What are you using? Jerome CORRENOZ wrote: Now, I can use user-dfined types by declaring them with SQL create tables. Fine ! But when I try to use the following code to get an object, I get a ClassCastException: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); } Is it normal or is it due to the fact that SQLite doesn't support SQL3 commands, mainly the getTypeMap() command that maps a Java class with a SQL type ? Notice that my Java class implements SQLData but it seems having no effect. Thanks for your answer, Jerome John Stanton wrote: Sqlite is flexible in typing. You can create user defined types just by declaring them in your SQL which creates tables. Thereafter the API will return the declared type and the actual type so that you can process it appropriately. Jerome CORRENOZ wrote: Hi, I'm starting with SQLite and I would like to know if it is possible to create user-defined data-types through the following SQL command: create type MyType ... ? In fact, I need it to map a database with an object-oriented model, so that I could manage the objects in a ResultSet like it follows: Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery( "SELECT * FROM EMP"); while (rset.next()) { Dept dept = (Dept)rset.getObject("DEPT"); System.out.println("Lieu du dept : " + dept.getLieu()); } Is there a way to do it with SQLite ? Regards, Jerome - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -