[SQL] Float / Numeric ?

2002-07-21 Thread Rudi Starcevic

Hi Folks,

I have an ecommerce application I'm writing and I'm not sure / undecided 
on a
particular way to store shipping rates in PostgreSQL

In this application a user may set the shipping rate per item.

So I have 3 fields - local,state and international.
A forth field, shipping_type (varchar),  holds a value 'dollars' or 
'percent'.

My twisted logic says a user may say this item has 10 perent shipping to 
add or 10 dollars to add.
This means the shipping rate my be either dollars or percent and can be 
set on a per item basis.

For the 3 fields I'm not sure which is best to use - Float or Numeric ?

My application language is ColdFusion and PHP.

I'd like to ask which data type would be the better choice.
At this stage I'm using Float to represent a value that may be either 
dollars or percent.

Perhaps this technique, using a varchar as a type of switch 
(shipping_type) , is incorrect / silly / stupid / not robust enough or 
just plain wrong.

Do you think this is OK and if so which would you use - Floast or Numeric ?
Thanks for your time.
Cheers
Rudi.










---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



[SQL] "no wait" option for locks

2002-07-21 Thread Daniel Stüwe

Hi...

anyone knows a workaround for Oracles "no wait" option in "SELECT ...
FOR UPDATE"? 

I wrote a programm which runs twice. Both poll the pgsql database all 5
seconds and make an "SELECT ... FOR UPDATE" for the first row found.
After some work and commit the next row is processed. The second task
waits until the first hast commited, but it should detect the lock and
continue work with next row.

How can i detect this lock? Oracle returns with "no wait" option an sql
error code.

Any hints?

best regards
Daniel Stuewe  


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: [SQL] 'no wait' option for locks

2002-07-21 Thread mallah

Hi,

Why not the program create a lock file on start and delete it when finished.

regds
mallah.


> Hi...
>
> anyone knows a workaround for Oracles "no wait" option in "SELECT ...
> FOR UPDATE"?
>
> I wrote a programm which runs twice. Both poll the pgsql database all 5
> seconds and make an "SELECT ... FOR UPDATE" for the first row found.
> After some work and commit the next row is processed. The second task
> waits until the first hast commited, but it should detect the lock and
> continue work with next row.
>
> How can i detect this lock? Oracle returns with "no wait" option an sql
> error code.
>
> Any hints?
>
> best regards
> Daniel Stuewe
>
>
> ---(end of
> broadcast)--- TIP 6: Have you searched our list
> archives?
>
> http://archives.postgresql.org


-
Get your free web based email at trade-india.com.
   "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])