Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: DBI SQL statement in while loop

by chromatic (Archbishop)
on Dec 03, 2002 at 21:44 UTC ( [id://217359]=note: print w/replies, xml ) Need Help??


in reply to DBI SQL statement in while loop

You're requesting the same form variables on each iteration. Besides that, interpolation occurs where you declare and assign the SQL statement -- not when you "re-assign" to $quantity and $gross_sales. Print $sql2 in the loop to see.

Placeholders are definitely the way to go -- though I've never used FreeTDS, I know that DBI emulates placeholders for databases that don't support them natively.

As for iterating over form variables, you're looping over the contents of the files named in @ARGV, or STDIN, which isn't what you want. I bet your loop contents aren't being executed once.

You need to figure out how to iterate over your form variables. If they have programmatic names, that's one way. If they have the same name, you'll have to read their contents into arrays. It's hard to say without seeing the HTML form.

Replies are listed 'Best First'.
Re: Re: DBI SQL statement in while loop
by mpeppler (Vicar) on Dec 03, 2002 at 23:48 UTC
    though I've never used FreeTDS, I know that DBI emulates placeholders for databases that don't support them natively
    Unfortunately DBI doesn't - however some drivers emulate placeholders (for example DBD::MySQL).

    In the case of DBD::Sybase it is written with the Sybase libraries in mind, and in that situation will handle placeholders just fine. The problem is that FreeTDS isn't (yet) a complete implementation of the TDS protocol, and the reverse engineering problem is compounded by the fact that Sybase and MS have implemented placeholder handling differently.

    However, there is hope - I understand that the next release of FreeTDS may support placeholders correctly.

    Michael

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://217359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-25 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found