Siscweb - thanks, a small issue and a patch.

Igor Hjelmstrom Vinhas Ribeiro <[email protected]> Fri, 5 Feb 2010 23:01:23 -0200
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Hi!

=A0 When using PostgreSQL support in Siscweb, there are SQL queries[1]
that fail because (java-new <integer> value) does not work with
strings in the format "1.0" - giving an exception[2] instead.

=A0 I attached a patch[3] that fixes this.

=A0 I probably should add that I am having a lot of fun building
websites using Sisc+Siscweb. Thanks!!!

Best regards,
=A0Igor.

[1]. Example: (sql/execute-update "\ninsert into
dtdata_ar\n(\"Identifier\", \"Item_1\", \"Date\", \"Data Type\",
\"NCE-SIM (HS)\", \"IMPORTER\", \"Customs\", \"Mode of Transport\",
\"Origin Country\", \"Country of Departure\", \"FOB Unit U$S\", \"FOB
U$S\", \"Freight U$S\", \"Insur. U$S\", \"CIF U$S\", \"Quantity_1\",
\"Unit of Measurement\", \"Net W. (kg)\", \"Tax\", \"% Tax\", \"Aladi
Agreement\", \"Item_2\", \"Brand - Value Suffixes\", \"Quantity_2\",
\"Unit F.Cur.\", \"FOB F.Cur.\", \"ForeignCurrency\", \"Detailed
Description\", \"NCE-SIM Description\")\nvalues\n(?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);\n"
"08001IC04058392W" 1.5 #<record #<record #0=3D#<record #0# [:record-type
(name field-tags)]> [date (zone-offset year month day hour minute
second nanosecond)]> [-10800 108 4 1 0 0 0 0]> "DEFINITIVO"
"8701.20.00.290C " "VOLVO TRUCKS Y BUSES=A0 ARGENTINA S.A.=A0=A0=A0 " "ADUA=
NA
DE BS.AS.=A0=A0=A0 " "PROPIOS MEDIOS=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 " "BRAZI=
L=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "
"BRAZIL=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 " 74843.5 74843.5 960.0 227.=
4 76030.4 2.5 "UNIDAD
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 " 9280.5 0.5 0.5 "314/R.AUTOMOTRIZ=A0=
=A0=A0 " 0.5 "MARCA: VOLVO
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 " 3.5 74843.5 74843.5 "DOLAR USA=A0=A0=A0=A0=A0 "
"2008 A\u00d1O DE FABRICACI\u00d3N. , 12800 CILINDRADA EN cm3. , 382
POTENCIA EN kW.. , FH 520 4X2T , TRACTOR DE CARRETERA , 9BVAS50A5 ,

" "ROAD TRACTORS FOR SEMI-TRAILERS


=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 ")

[2]. Error: #<java java.lang.NumberFormatException
java.lang.NumberFormatException: For input string: "960.0">
java.lang.NumberFormatException: For input string: "960.0"
=A0=A0=A0 at java.lang.NumberFormatException.forInputString(NumberFormatExc=
eption.java:48)
=A0=A0=A0 at java.lang.Integer.parseInt(Integer.java:458)
=A0=A0=A0 at java.lang.Integer.<init>(Integer.java:660)
=A0=A0=A0 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native =
Method)
=A0=A0=A0 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeCo=
nstructorAccessorImpl.java:39)
=A0=A0=A0 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Dele=
gatingConstructorAccessorImpl.java:27)
=A0=A0=A0 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
=A0=A0=A0 at sisc.modules.s2j.Operation.invokeConstructor(Unknown Source)
=A0=A0=A0 at sisc.modules.s2j.Operation.doApply(Unknown Source)
=A0=A0=A0 at sisc.nativefun.NativeProcedure.apply(Unknown Source)
=A0=A0=A0 at sisc.exprs.AppEval.eval(Unknown Source)
=A0=A0=A0 at sisc.interpreter.Interpreter.next(Unknown Source)
=A0=A0=A0 at sisc.exprs.AppExp.eval(Unknown Source)
=A0=A0=A0 at sisc.interpreter.Interpreter.interpret(Unknown Source)
=A0=A0=A0 at sisc.interpreter.Interpreter.interpret(Unknown Source)
=A0=A0=A0 at sisc.interpreter.Interpreter.eval(Unknown Source)
=A0=A0=A0 at sisc.data.SchemeThread.run(Unknown Source)
=A0=A0=A0 at java.lang.Thread.run(Thread.java:619)

[3]. commit c7c9c6c9fb0f93a03c5ee1918b283cb443c923bd
Author: Igor Hjelmstrom Vinhas Ribeiro <[email protected]>
Date:=A0=A0 Fri Feb 5 22:48:08 2010 -0200

=A0=A0=A0 Fixed exceptions when passing numbers such as 1.0 as a parameter
(inexact numbers that have an exact representation).

diff --git a/siscweb-src-0.5/opt/sql/scm/sql/postgresql.scm
b/siscweb-src-0.5/opt/sql/scm/sql/postgresql.scm
index 1d2e8ab..f4f61ec 100644
--- a/siscweb-src-0.5/opt/sql/scm/sql/postgresql.scm
+++ b/siscweb-src-0.5/opt/sql/scm/sql/postgresql.scm
@@ -180,7 +180,7 @@
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ((pair? value) (any->jbyte-array value))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ((and (number? value)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (integer? value))
-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (java-new <integer> (->jstring (number->=
string value))))
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (java-new <integer> (->jstring (number->=
string
(inexact->exact value)))))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ((and (number? value)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (real? value))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (java-new <big-decimal> (->jstring (nu=
mber->string value))))

---------------------------------------------------------------------------=
---
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the busine=
ss
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com