You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Fl...@deuka.de on 2004/03/19 15:37:35 UTC

Adding Join feature

Hello out there,

I'm quite new to Torque, but when I used this tool I missed some features. 

E.g. I'd like to have a Join-support for improving performance while 
querying data.
As I'm not that kind of 'Hey, this tool doesn't support feature XYZ -> 
waste this tool' and Torque is open source, 
I've extended some classes to add support for explicit inner joins, left 
joins and right joins.
I'd like to share these sources so my question is: Is there anybody 
interested in this?
Further I'm interested in working on Torque as this tool is quite 
interesting even if JDO becomes more and more important.
Would be great if somebody of the Torque-Devs would respond.

Thanks in advance

Florian Fray

deuka Deutsche Tiernahrung GmbH & Co. KG
Tel.: 0049 - 211 - 3034 - 238
Fax: 0049 - 211 - 3034 - 376
eMail: FlorianFray@deuka.de

Re: Antwort: Village

Posted by Xavier Maysonnave <xa...@omondo.com>.

Xavier Maysonnave wrote:

> Hi,
> 
> Thank you for your response.
> 
> I am not referencing my code but the village code :
> 
> http://share.whichever.com/viewcvs.cgi/village/com/workingdogs/village/Value.java?rev=1.20&content-type=text/vnd.viewcvs-markup 
> 
> 
> Take a look in the constructor, you should see this code snippet :
> 
>             case Types.DECIMAL:
>                 String number = rs.getString (columnNumber);
>                 if ( number == null )
>                 {
>                     valueObject = null;
>                 }
>                 else
>                 {
>                     valueObject = new BigDecimal (number);
>                 }
>                 break;

The patch could be the following :

	            case Types.DECIMAL:
	            	valueObject = rs.getBigDecimal(columnNumber);
	                break;

Thanks for your suggestions.

> 
> This is where the code crash.
> 
> Maybe your proposition :
> 
> BigDecimal bd = record.getValue(1).asBigDecimal();
> 
> is the right one.
> 
> Thanks
> 
> FlorianFray@deuka.de wrote:
> 
>> There is no error in Village but in your code.
>> The  DB does return correct values. You tried to convert a decimal 
>> value to a String and then back to a BigDecimal.
>>
>> Solution 1: Try to get a BigDecimal from the Village record.
>> Code example:
>> Record record; ...
>> BigDecimal bd = record.getValue(1).asBigDecimal();
>>
>> Solution 2:
>> Try to use a java.text.NumberFormatter to retrieve the BigDecimal value.
>> Here's a code example:
>> String numberStr = "0,50";
>> NumberFormatter nf = NumberFormatter.getInstance(Locale.FRANCE);
>> Number number = nf.parse(strVal);
>> BigDecimal bd;
>> if (number instanceof BigDecimal) {
>>   bd = (BigDecimal) number;
>> } else {
>>   bd = new BigDecimal(number.doubleValue());
>> }
>>
>>
>> deuka Deutsche Tiernahrung GmbH & Co. KG
>> Tel.: 0211 / 3034 - Fax: 0211 / 3034 - 376
>> eMail: FlorianFray@deuka.de
>> WebSite: www.deuka.de
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Another Village

Posted by Fl...@deuka.de.
Sorry Xavier!

You're absolutely right! I thought you point at your code :-o

Nevermind

Florian Fray

Re: Antwort: Village

Posted by Xavier Maysonnave <xa...@omondo.com>.
Hi,

Thank you for your response.

I am not referencing my code but the village code :

http://share.whichever.com/viewcvs.cgi/village/com/workingdogs/village/Value.java?rev=1.20&content-type=text/vnd.viewcvs-markup

Take a look in the constructor, you should see this code snippet :

             case Types.DECIMAL:
                 String number = rs.getString (columnNumber);
                 if ( number == null )
                 {
                     valueObject = null;
                 }
                 else
                 {
                     valueObject = new BigDecimal (number);
                 }
                 break;

This is where the code crash.

Maybe your proposition :

BigDecimal bd = record.getValue(1).asBigDecimal();

is the right one.

Thanks

FlorianFray@deuka.de wrote:

> There is no error in Village but in your code.
> The  DB does return correct values. You tried to convert a decimal value 
> to a String and then back to a BigDecimal.
> 
> Solution 1: 
> Try to get a BigDecimal from the Village record.
> Code example:
> Record record; 
> ...
> BigDecimal bd = record.getValue(1).asBigDecimal();
> 
> Solution 2:
> Try to use a java.text.NumberFormatter to retrieve the BigDecimal value.
> Here's a code example:
> String numberStr = "0,50";
> NumberFormatter nf = NumberFormatter.getInstance(Locale.FRANCE);
> Number number = nf.parse(strVal);
> BigDecimal bd;
> if (number instanceof BigDecimal) {
>   bd = (BigDecimal) number;
> } else {
>   bd = new BigDecimal(number.doubleValue());
> }
> 
> 
> deuka Deutsche Tiernahrung GmbH & Co. KG
> Tel.: 0211 / 3034 - 
> Fax: 0211 / 3034 - 376
> eMail: FlorianFray@deuka.de
> WebSite: www.deuka.de

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Antwort: Village

Posted by Fl...@deuka.de.
There is no error in Village but in your code.
The  DB does return correct values. You tried to convert a decimal value 
to a String and then back to a BigDecimal.

Solution 1: 
Try to get a BigDecimal from the Village record.
Code example:
Record record; 
...
BigDecimal bd = record.getValue(1).asBigDecimal();

Solution 2:
Try to use a java.text.NumberFormatter to retrieve the BigDecimal value.
Here's a code example:
String numberStr = "0,50";
NumberFormatter nf = NumberFormatter.getInstance(Locale.FRANCE);
Number number = nf.parse(strVal);
BigDecimal bd;
if (number instanceof BigDecimal) {
  bd = (BigDecimal) number;
} else {
  bd = new BigDecimal(number.doubleValue());
}


deuka Deutsche Tiernahrung GmbH & Co. KG
Tel.: 0211 / 3034 - 
Fax: 0211 / 3034 - 376
eMail: FlorianFray@deuka.de
WebSite: www.deuka.de

Village

Posted by Xavier Maysonnave <xa...@omondo.com>.
Hi All,

is there someone who maintain the village distribution ?

While working on data export I've got some problems and fixed two issues.

For example :

1 -

In Value.java while exporting a database with a decimal column I got a value like '0,50'.
As you can notice the database send me a localized decimal value (I am working on a french 
  windows) with a ',' rather a value like '0.50'.

As a consequence the instruction :

	valueObject = new BigDecimal (number);

crashed.

I just modified the code with the following :

	number = number.replace(',', '.'); //EclipseDatabase added
	valueObject = new BigDecimal (number);

2 -

Concerning blob retrieval, here is the following :

       	case Types.BLOB:
         	Blob blob = rs.getBlob(columnNumber);
                 valueObject = blob.getBytes(1, (int) blob.length());
                 break;

If the retrieved blob is null, it causes an exception. This could be fixed with the 
following :

	case Types.BLOB:
	       Blob blob = rs.getBlob(columnNumber);
	       if (blob != null) {
			valueObject = blob.getBytes(1, (int) blob.length());
	       } else {
	        	valueObject = null;
	       }
	       break;

Regards.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Re: [PATCH] Torque Gen patches

Posted by Scott Eade <se...@backstagetech.com.au>.
Serge Huber wrote:

> Just a question, I submitted a patch to this list a few weeks ago and 
> never got any feedback. Would you have time to look at it ? It's 
> really nothing big, just a few corrections in the generation 
> templates. I actually have an updated patch I am attaching here.

Sorry for the delay - these have now been applied.

Thanks,

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


[PATCH] Torque Gen patches

Posted by Serge Huber <sh...@jahia.com>.
Hi Scott,

Just a question, I submitted a patch to this list a few weeks ago and never 
got any feedback. Would you have time to look at it ? It's really nothing 
big, just a few corrections in the generation templates. I actually have an 
updated patch I am attaching here.

Regards,
   Serge Huber.

At 00:04 23.03.2004, you wrote:
Contributions are most welcome - I am certainly interested in seeing 
support for the join types you mention.

>You should can submit unidiff to cvs HEAD patches to the turbine-dev 
>list.  It is much easier for us to review and accept patches when they 
>include test cases so please try and provide these also.
>
>Regards,
>
>Scott
>
>--
>Scott Eade
>Backstage Technologies Pty. Ltd.
>http://www.backstagetech.com.au
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-dev-help@db.apache.org
>

- -- --- -----=[ shuber2 at jahia dot com ]=---- --- -- -
www.jahia.org : A collaborative source CMS and Portal Server 

Re: Adding Join feature

Posted by Scott Eade <se...@backstagetech.com.au>.
FlorianFray@deuka.de wrote:

>I'm quite new to Torque, but when I used this tool I missed some features. 
>
>E.g. I'd like to have a Join-support for improving performance while 
>querying data.
>As I'm not that kind of 'Hey, this tool doesn't support feature XYZ -> 
>waste this tool' and Torque is open source, 
>I've extended some classes to add support for explicit inner joins, left 
>joins and right joins.
>I'd like to share these sources so my question is: Is there anybody 
>interested in this?
>Further I'm interested in working on Torque as this tool is quite 
>interesting even if JDO becomes more and more important.
>Would be great if somebody of the Torque-Devs would respond.
>
Florian,

Contributions are most welcome - I am certainly interested in seeing 
support for the join types you mention.

You should can submit unidiff to cvs HEAD patches to the turbine-dev 
list.  It is much easier for us to review and accept patches when they 
include test cases so please try and provide these also.

Regards,

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org