Forum: Ruby on Rails bug adapter firebird 2.1.2 ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mariarosaria T. (Guest)
on 2009-05-18 19:05
mydb.fdb on windows firebird 2.0.3.12981
step_1
gbak.exe -v -t -user sysdba -password ****** 127.0.0.1/3050:D:\webdb
\PROD\mydb..fdb D:\webdb\back\mydb.fbk

on server linux firebird 2.1.2.18118
step_2
linux-server:# ftp mydb.fbk
step_3
linux-server:# gbak -c -v ... mydb.fbk mydb.fdb

*******
s.o.linux ubuntu server 9.0.4
firebird version 2.1.2.18118
rails 2.3.2
ruby 1.8.7 patchlevel 72
rake 0.8.5
fb_adapter 0.5.8
fb 0.5.9
passenger 2.2.2
nginx 0.6.36

query from isql
select sum(val_emessi) from g1_items where licence_id = 6 AND DATA >=
'2009/01/02' AND DATA <= '2009/01/02'

**** val_emessi => decimal(8,2) ***
result => 2837.00 ....fine

query from rails

condizioni = "data >= '2009/01/02' and
              data <= '2009/01/02' and
              licence_id = 6"
    @emessi = G1Item.sum('val_emessi', :conditions => condizioni)

****@emessi.class => BigDecimal****

result => 283700.00 .... error
idem for G1Item.find_by-sql("select sum(val_emessi as somma ........")
result => 283700.00 .... error
In windows
activerecord-firebird-adapter (1.0.0.9250)
fireruby (0.4.3)
rails 2.3.2
firebird version 2.0.3.12981
works fine.

.. idea?
ciao
Gianluca T. (Guest)
on 2009-05-18 19:55
(Received via mailing list)
Hi Mary,

I'm Italian but I write the response in eglish (sorry for my poor
english)...

Some time ago I had a problem like your under FireBird 1.5.x and
FireRuby 0.4.1 just after a db restore.

The issue was with casting function on the rails firebird adapter the
error was something like "cannot cast CAST(DECIMAL(0,0)"...

I remember that I was able to solve the problem on firebird_adapter.rb
executing something like sql_query.gsub!("DECIMAL(0,0)",
"DECIMAL(0,18)") before the returning row.

Hope it helps...
Mariarosaria T. (Guest)
on 2009-05-18 20:31
Gianluca T. wrote:
> Hi Mary,
>
> I'm Italian but I write the response in eglish (sorry for my poor
> english)...
>
> Some time ago I had a problem like your under FireBird 1.5.x and
> FireRuby 0.4.1 just after a db restore.
>
> The issue was with casting function on the rails firebird adapter the
> error was something like "cannot cast CAST(DECIMAL(0,0)"...
>
> I remember that I was able to solve the problem on firebird_adapter.rb
> executing something like sql_query.gsub!("DECIMAL(0,0)",
> "DECIMAL(0,18)") before the returning row.
>
> Hope it helps...

Il mio problema è che non viene generato nessun errore.
Semplicemente il valore è aumentato di un fattore 100.
Il problema sembra dei metodi di classe tranne find.
Ciao
Gianluca T. (Guest)
on 2009-05-19 13:42
(Received via mailing list)
Ok ho visto...

mi sembra che stai comprando l'errore con versioni diverse dei vari
camponenti:

windows (ok) => FireBird 2.0 + activerecord-firebird-adapter + FireRuby
linux (errore) => FireBird 2.1 + fb_adapter + fb

Magari sto dicendo una cosa ovvia o magari banale ma secondo me dovresti
provare a utilizzare su linux gli stessi componenti che stai utilizzando
su windows (activerecord-firebird-adapter + FireRuby)
Mariarosaria T. (Guest)
on 2009-05-19 19:49
Gianluca T. wrote:
> Ok ho visto...
>
> mi sembra che stai comprando l'errore con versioni diverse dei vari
> camponenti:
>
> windows (ok) => FireBird 2.0 + activerecord-firebird-adapter + FireRuby
> linux (errore) => FireBird 2.1 + fb_adapter + fb
>
> Magari sto dicendo una cosa ovvia o magari banale ma secondo me dovresti
> provare a utilizzare su linux gli stessi componenti che stai utilizzando
> su windows (activerecord-firebird-adapter + FireRuby)

In windows non ci sono ancora per FireBird 2.1
Esistono solo fb_adapter + fb che sono per linux.
Il motivo di spostare a linux è proprio il ritardo di aggiornamento
delle
librerie.
Fanno prima le cose per linux.
Ciao e grazie  per l'interessamento
Mariarosaria T. (Guest)
on 2009-05-25 10:41
Confermato:
Data: 23/05/2009 11:33
Mittente: Brent R.

I can confirm there is a bug interpreting the results of aggregate
operators such as SUM and AVG. I suggest performing these operations
in code, rather than in the database, until a fix can be made.

Brent
http://rubyforge.org/tracker/index.php?func=detail...
This topic is locked and can not be replied to.