Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Using placeholders in MySQL returning an error

by Grygonos (Chaplain)
on Jan 16, 2004 at 18:57 UTC ( [id://321872]=note: print w/replies, xml ) Need Help??


in reply to Re: Using placeholders in MySQL returning an error
in thread Using placeholders in MySQL returning an error

On a note of maintinability/style.. it's better to use complete inserts i.e.
 INSERT INTO tablex (field1, field2, field3) VALUES ('x','y','z')
over incomplete inserts i.e.
 INSERT INTO tablex('x','y','z')
Performing the following:
 ALTER TABLE tablex ADD field4 varchar(20)
breaks your incomplete insert, since you are not specifying directly which fields the values being inserted are mapped to, it expects your insert to include a value for field4.

If you have an app that uses this table but will never make use of the new field: field4, then you have no need to alter that app. Leaving incomplete inserts lying around in a script is a recipe for disaster.

p.s. I learned this the hard way.

Grygonos

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-26 07:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found