Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Two questions for DBStore / JDBC / JUnit Tests
[CDO] Two questions for DBStore / JDBC / JUnit Tests [message #748188] Mon, 24 October 2011 14:46 Go to next message
techteam is currently offline techteamFriend
Messages: 55
Registered: September 2010
Member
Hi,
when trying to write an own DBStore adapter for Sybase ASE 15.x, I ran
into some problems or some issues are unclear to me.

Possible discrepancy in the JUnit tests:
In the JUnit test for e.g. binary, the columns are registered with:
registerColumn(DBType.BINARY, new byte[0]);


For this will be triggered a:
table.addField (FIELD_NAME + c + +, column.getElement1 ());
which in the implementation:
addField (name, type, IDBField.DEFAULT, IDBField.DEFAULT, false);


If I interpret this correctly, it means in each column allowed NULL-values.

When you go through the JUnitTest follows the later method

check values (String tableName)

which in these, is
column.getElement1().writeValue(outs, resultSet, c++, false);
called.

This FALSE means the column can not contain NULL-values.

Do not contradict these two definitions?



Handling of data types:
Currently, all writing and reading data is performed in the central
DBType class for each data type.

Unfortunately does not behave the Sybase JConnect to 100% seems like all
the other JDBC driver.
examples:
- Binary/Varbinary:
+ An empty binary array (new binary [0]) is implemented in the
JConnect driver to NULL

- String
+ An empty string (new String ("")) returns a space (" ") in the end
- LOB
+ JDBC drivers before version 7.0.7 (ASE 15.7) contains no support for
public Blob getBlob (int paramInt) and public Clob getClob (paramInt int)

Is there a way to intercept or adpat these points somehow?


Thanks in advance

Heiko
Re: [CDO] Two questions for DBStore / JDBC / JUnit Tests [message #749571 is a reply to message #748188] Tue, 25 October 2011 09:52 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 24.10.2011 16:46, schrieb Heiko:
> Hi,
> when trying to write an own DBStore adapter for Sybase ASE 15.x, I ran into some problems or some issues are unclear
> to me.
>
> Possible discrepancy in the JUnit tests:
> In the JUnit test for e.g. binary, the columns are registered with:
> registerColumn(DBType.BINARY, new byte[0]);
I can't find this string in my workspace. Where are you referring to?

>
>
> For this will be triggered a:
> table.addField (FIELD_NAME + c + +, column.getElement1 ());
Where?

> which in the implementation:
> addField (name, type, IDBField.DEFAULT, IDBField.DEFAULT, false);
Where?

>
>
> If I interpret this correctly, it means in each column allowed NULL-values.
>
> When you go through the JUnitTest
Which one?

> follows the later method
>
> check values (String tableName)
>
> which in these, is
> column.getElement1().writeValue(outs, resultSet, c++, false);
> called.
>
> This FALSE means the column can not contain NULL-values.
>
> Do not contradict these two definitions?
I can not judge it with the infos you're giving. I need to see the code in my workspace but I can't find it.

>
>
>
> Handling of data types:
> Currently, all writing and reading data is performed in the central DBType class for each data type.
>
> Unfortunately does not behave the Sybase JConnect to 100% seems like all the other JDBC driver.
> examples:
> - Binary/Varbinary:
> + An empty binary array (new binary [0]) is implemented in the JConnect driver to NULL
>
> - String
> + An empty string (new String ("")) returns a space (" ") in the end
> - LOB
> + JDBC drivers before version 7.0.7 (ASE 15.7) contains no support for
> public Blob getBlob (int paramInt) and public Clob getClob (paramInt int)
>
> Is there a way to intercept or adpat these points somehow?
I can not judge this properly because I don#t know anything about Sybase nor do I have the chance to even install it. If
you provide a patch that A) looks reasonable and B) doesn't have a bad impact on the other DB adapters Stefan and I will
most probably have no objections ;-)

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Two questions for DBStore / JDBC / JUnit Tests [message #749635 is a reply to message #749571] Tue, 25 October 2011 10:43 Go to previous messageGo to next message
techteam is currently offline techteamFriend
Messages: 55
Registered: September 2010
Member
Hi Eike,
some info about the JUnit Test below:

Greetings
Heiko

Am 25.10.2011 11:52, schrieb Eike Stepper:
> Am 24.10.2011 16:46, schrieb Heiko:
>> Hi,
>> when trying to write an own DBStore adapter for Sybase ASE 15.x, I ran
>> into some problems or some issues are unclear to me.
>>
>> Possible discrepancy in the JUnit tests:
>> In the JUnit test for e.g. binary, the columns are registered with:
>> registerColumn(DBType.BINARY, new byte[0]);
> I can't find this string in my workspace. Where are you referring to?

Plugin: org.eclipse.emf.cdo.tests.db
Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
Method: testBinary()
Line (approximate): 65

>
>>
>>
>> For this will be triggered a:
>> table.addField (FIELD_NAME + c + +, column.getElement1 ());
> Where?

Plugin: org.eclipse.emf.cdo.tests.db
Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
Method: prepareTable(String tableName)
Line (approximate): 353

>
>> which in the implementation:
>> addField (name, type, IDBField.DEFAULT, IDBField.DEFAULT, false);
> Where?

Plugin: org.eclipse.net4j.db
Class: org.eclipse.net4j.internal.db.ddl.DBTable.java
Method: addField(String name, DBType type)
Line (approximate): 55

>
>>
>>
>> If I interpret this correctly, it means in each column allowed
>> NULL-values.
>>
>> When you go through the JUnitTest
> Which one?

org.eclipse.emf.cdo.tests.db.Net4jDBTest.testBinary()


>
>> follows the later method
>>
>> check values (String tableName)
>>
>> which in these, is
>> column.getElement1().writeValue(outs, resultSet, c++, false);

Plugin: org.eclipse.emf.cdo.tests.db
Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
Method: checkValues(String tableName)
Line (approximate): 420



>> called.
>>
>> This FALSE means the column can not contain NULL-values.
>>
>> Do not contradict these two definitions?
> I can not judge it with the infos you're giving. I need to see the code
> in my workspace but I can't find it.

I hope you can find it now. ;)

>
>>
>>
>>
>> Handling of data types:
>> Currently, all writing and reading data is performed in the central
>> DBType class for each data type.
>>
>> Unfortunately does not behave the Sybase JConnect to 100% seems like
>> all the other JDBC driver.
>> examples:
>> - Binary/Varbinary:
>> + An empty binary array (new binary [0]) is implemented in the
>> JConnect driver to NULL
>>
>> - String
>> + An empty string (new String ("")) returns a space (" ") in the end
>> - LOB
>> + JDBC drivers before version 7.0.7 (ASE 15.7) contains no support for
>> public Blob getBlob (int paramInt) and public Clob getClob (paramInt int)
>>
>> Is there a way to intercept or adpat these points somehow?
> I can not judge this properly because I don#t know anything about Sybase
> nor do I have the chance to even install it. If you provide a patch that
> A) looks reasonable and B) doesn't have a bad impact on the other DB
> adapters Stefan and I will most probably have no objections ;-)

I know, we have talked about this some times ago, but I have no really
good idea at the moment.
At the moment I see 3 options:
1. Move the read and write methods from DBType.java to the adapters,
what would be a real big patch.
2. Try to modify an existing open source jdbc driver (or write a new driver)
3. Find no solution and do not use Sybase as backend.


>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
Re: [CDO] Two questions for DBStore / JDBC / JUnit Tests [message #749656 is a reply to message #749635] Tue, 25 October 2011 10:56 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Heiko,

Well, that was in fact very detailed ;-) I do have the feeling that there might by a small discrepancy in the test logic
but I'm having problems to see where they could end in concrete problems. Do you have concrete problems with it? What
are they?

Regarding the DBType/DBAdapter responsibility issue I also can just guess in the absence of a patch that proposes the
concrete changes you have in mind. Generally the size of a patch is not so important as long as it serves a necessary
and adequate purpose. But we need something more concrete to talk about.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper




Am 25.10.2011 12:43, schrieb Heiko:
> Hi Eike,
> some info about the JUnit Test below:
>
> Greetings
> Heiko
>
> Am 25.10.2011 11:52, schrieb Eike Stepper:
>> Am 24.10.2011 16:46, schrieb Heiko:
>>> Hi,
>>> when trying to write an own DBStore adapter for Sybase ASE 15.x, I ran
>>> into some problems or some issues are unclear to me.
>>>
>>> Possible discrepancy in the JUnit tests:
>>> In the JUnit test for e.g. binary, the columns are registered with:
>>> registerColumn(DBType.BINARY, new byte[0]);
>> I can't find this string in my workspace. Where are you referring to?
>
> Plugin: org.eclipse.emf.cdo.tests.db
> Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
> Method: testBinary()
> Line (approximate): 65
>
>>
>>>
>>>
>>> For this will be triggered a:
>>> table.addField (FIELD_NAME + c + +, column.getElement1 ());
>> Where?
>
> Plugin: org.eclipse.emf.cdo.tests.db
> Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
> Method: prepareTable(String tableName)
> Line (approximate): 353
>
>>
>>> which in the implementation:
>>> addField (name, type, IDBField.DEFAULT, IDBField.DEFAULT, false);
>> Where?
>
> Plugin: org.eclipse.net4j.db
> Class: org.eclipse.net4j.internal.db.ddl.DBTable.java
> Method: addField(String name, DBType type)
> Line (approximate): 55
>
>>
>>>
>>>
>>> If I interpret this correctly, it means in each column allowed
>>> NULL-values.
>>>
>>> When you go through the JUnitTest
>> Which one?
>
> org.eclipse.emf.cdo.tests.db.Net4jDBTest.testBinary()
>
>
>>
>>> follows the later method
>>>
>>> check values (String tableName)
>>>
>>> which in these, is
>>> column.getElement1().writeValue(outs, resultSet, c++, false);
>
> Plugin: org.eclipse.emf.cdo.tests.db
> Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
> Method: checkValues(String tableName)
> Line (approximate): 420
>
>
>
>>> called.
>>>
>>> This FALSE means the column can not contain NULL-values.
>>>
>>> Do not contradict these two definitions?
>> I can not judge it with the infos you're giving. I need to see the code
>> in my workspace but I can't find it.
>
> I hope you can find it now. ;)
>
>>
>>>
>>>
>>>
>>> Handling of data types:
>>> Currently, all writing and reading data is performed in the central
>>> DBType class for each data type.
>>>
>>> Unfortunately does not behave the Sybase JConnect to 100% seems like
>>> all the other JDBC driver.
>>> examples:
>>> - Binary/Varbinary:
>>> + An empty binary array (new binary [0]) is implemented in the
>>> JConnect driver to NULL
>>>
>>> - String
>>> + An empty string (new String ("")) returns a space (" ") in the end
>>> - LOB
>>> + JDBC drivers before version 7.0.7 (ASE 15.7) contains no support for
>>> public Blob getBlob (int paramInt) and public Clob getClob (paramInt int)
>>>
>>> Is there a way to intercept or adpat these points somehow?
>> I can not judge this properly because I don#t know anything about Sybase
>> nor do I have the chance to even install it. If you provide a patch that
>> A) looks reasonable and B) doesn't have a bad impact on the other DB
>> adapters Stefan and I will most probably have no objections ;-)
>
> I know, we have talked about this some times ago, but I have no really good idea at the moment.
> At the moment I see 3 options:
> 1. Move the read and write methods from DBType.java to the adapters, what would be a real big patch.
> 2. Try to modify an existing open source jdbc driver (or write a new driver)
> 3. Find no solution and do not use Sybase as backend.
>
>
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>


Re: [CDO] Two questions for DBStore / JDBC / JUnit Tests [message #749695 is a reply to message #749656] Tue, 25 October 2011 11:26 Go to previous messageGo to next message
techteam is currently offline techteamFriend
Messages: 55
Registered: September 2010
Member
Am 25.10.2011 12:56, schrieb Eike Stepper:
> Hi Heiko,
>
> Well, that was in fact very detailed ;-) I do have the feeling that
> there might by a small discrepancy in the test logic but I'm having
> problems to see where they could end in concrete problems. Do you have
> concrete problems with it? What are they?
I found this discrepancy because
the unassuming Sybase JDBC driver, converts empty arrays to a NULL-Value
(the bigger problem)
With the actually code the generated column inside the database allows
NULL-Values and the Sybase driver do write the NULL-Value, but on the
check side there are NULL-Values not allowed and I get a
NullPointerEcxeption inside the writeValueWithResult(...) method of the
DBType.Binary.


>
> Regarding the DBType/DBAdapter responsibility issue I also can just
> guess in the absence of a patch that proposes the concrete changes you
> have in mind. Generally the size of a patch is not so important as long
> as it serves a necessary and adequate purpose. But we need something
> more concrete to talk about.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
>
> Am 25.10.2011 12:43, schrieb Heiko:
>> Hi Eike,
>> some info about the JUnit Test below:
>>
>> Greetings
>> Heiko
>>
>> Am 25.10.2011 11:52, schrieb Eike Stepper:
>>> Am 24.10.2011 16:46, schrieb Heiko:
>>>> Hi,
>>>> when trying to write an own DBStore adapter for Sybase ASE 15.x, I ran
>>>> into some problems or some issues are unclear to me.
>>>>
>>>> Possible discrepancy in the JUnit tests:
>>>> In the JUnit test for e.g. binary, the columns are registered with:
>>>> registerColumn(DBType.BINARY, new byte[0]);
>>> I can't find this string in my workspace. Where are you referring to?
>>
>> Plugin: org.eclipse.emf.cdo.tests.db
>> Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
>> Method: testBinary()
>> Line (approximate): 65
>>
>>>
>>>>
>>>>
>>>> For this will be triggered a:
>>>> table.addField (FIELD_NAME + c + +, column.getElement1 ());
>>> Where?
>>
>> Plugin: org.eclipse.emf.cdo.tests.db
>> Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
>> Method: prepareTable(String tableName)
>> Line (approximate): 353
>>
>>>
>>>> which in the implementation:
>>>> addField (name, type, IDBField.DEFAULT, IDBField.DEFAULT, false);
>>> Where?
>>
>> Plugin: org.eclipse.net4j.db
>> Class: org.eclipse.net4j.internal.db.ddl.DBTable.java
>> Method: addField(String name, DBType type)
>> Line (approximate): 55
>>
>>>
>>>>
>>>>
>>>> If I interpret this correctly, it means in each column allowed
>>>> NULL-values.
>>>>
>>>> When you go through the JUnitTest
>>> Which one?
>>
>> org.eclipse.emf.cdo.tests.db.Net4jDBTest.testBinary()
>>
>>
>>>
>>>> follows the later method
>>>>
>>>> check values (String tableName)
>>>>
>>>> which in these, is
>>>> column.getElement1().writeValue(outs, resultSet, c++, false);
>>
>> Plugin: org.eclipse.emf.cdo.tests.db
>> Class: org.eclipse.emf.cdo.tests.db.Net4jDBTest.java
>> Method: checkValues(String tableName)
>> Line (approximate): 420
>>
>>
>>
>>>> called.
>>>>
>>>> This FALSE means the column can not contain NULL-values.
>>>>
>>>> Do not contradict these two definitions?
>>> I can not judge it with the infos you're giving. I need to see the code
>>> in my workspace but I can't find it.
>>
>> I hope you can find it now. ;)
>>
>>>
>>>>
>>>>
>>>>
>>>> Handling of data types:
>>>> Currently, all writing and reading data is performed in the central
>>>> DBType class for each data type.
>>>>
>>>> Unfortunately does not behave the Sybase JConnect to 100% seems like
>>>> all the other JDBC driver.
>>>> examples:
>>>> - Binary/Varbinary:
>>>> + An empty binary array (new binary [0]) is implemented in the
>>>> JConnect driver to NULL
>>>>
>>>> - String
>>>> + An empty string (new String ("")) returns a space (" ") in the end
>>>> - LOB
>>>> + JDBC drivers before version 7.0.7 (ASE 15.7) contains no support for
>>>> public Blob getBlob (int paramInt) and public Clob getClob (paramInt
>>>> int)
>>>>
>>>> Is there a way to intercept or adpat these points somehow?
>>> I can not judge this properly because I don#t know anything about Sybase
>>> nor do I have the chance to even install it. If you provide a patch that
>>> A) looks reasonable and B) doesn't have a bad impact on the other DB
>>> adapters Stefan and I will most probably have no objections ;-)
>>
>> I know, we have talked about this some times ago, but I have no really
>> good idea at the moment.
>> At the moment I see 3 options:
>> 1. Move the read and write methods from DBType.java to the adapters,
>> what would be a real big patch.
>> 2. Try to modify an existing open source jdbc driver (or write a new
>> driver)
>> 3. Find no solution and do not use Sybase as backend.
>>
>>
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>
Re: [CDO] Two questions for DBStore / JDBC / JUnit Tests [message #749942 is a reply to message #749695] Tue, 25 October 2011 14:30 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 25.10.2011 13:26, schrieb Heiko:
> Am 25.10.2011 12:56, schrieb Eike Stepper:
>> Hi Heiko,
>>
>> Well, that was in fact very detailed ;-) I do have the feeling that
>> there might by a small discrepancy in the test logic but I'm having
>> problems to see where they could end in concrete problems. Do you have
>> concrete problems with it? What are they?
> I found this discrepancy because
> the unassuming Sybase JDBC driver, converts empty arrays to a NULL-Value
> (the bigger problem)
> With the actually code the generated column inside the database allows NULL-Values and the Sybase driver do write the
> NULL-Value, but on the check side there are NULL-Values not allowed and I get a NullPointerEcxeption inside the
> writeValueWithResult(...) method of the DBType.Binary.
And that problem is solved for you by changing to column.getElement1().writeValue(outs, resultSet, c++, *true* ); ?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:Creating new model code
Next Topic:Modeling ResourceSets in ecore
Goto Forum:
  


Current Time: Fri Apr 26 22:29:42 GMT 2024

Powered by FUDForum. Page generated in 0.03269 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top