Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Weird problem with Perl and MySQL

by ido50 (Scribe)
on Nov 21, 2004 at 21:16 UTC ( [id://409423]=perlquestion: print w/replies, xml ) Need Help??

ido50 has asked for the wisdom of the Perl Monks concerning the following question:

Hi again!

Well, I don't know whether this problem is related to Perl/DBD::mysql, mySQL itself, or just my program.
Anyhow, here it is: I have a certain table in the database with a field called 'id' holding an "INTEGER NOT NULL".

For some reason, when INSERTing a new entry to the table, the program/the database/perl will usually(!) ignore the value supplied for the 'id' field and insert some other (6 digit) number (It's always the same number). This will not happen every now and again, I have yet to find a certain pattern, and I don't think I will find one.

No need to mention that I've double- and even triple-checked that the correct value is supplied to the statement handle.

Thing is, and I don't know if it's abnormal or not, if I try to INSERT entries which have identical field values, except for the 'id' field, they will all be INSERTed with that same number as the id, and becuase all other fields are identical, the entry will be multiplied.

My host runs FreeBSD, Perl version is 5.005_03 built for i386-freebsd, DBI version is 1.28, DBD::mysql version is 2.0416.

Any suggestions?
Thanks.

-------------------------
Live fat, die young

Replies are listed 'Best First'.
Re: Weird problem with Perl and MySQL
by perrin (Chancellor) on Nov 21, 2004 at 23:15 UTC
    Show us the table definition and your insert code, please.
Re: Weird problem with Perl and MySQL
by Anonymous Monk on Nov 21, 2004 at 21:27 UTC

    Some test code would be appreciated.

    Can you reproduce the "weird" behaviour in a few lines of code?

    Moreover, does the same thing happen if you type your SQL in MySQL command line monitor?

Re: Weird problem with Perl and MySQL
by ChrisR (Hermit) on Nov 22, 2004 at 03:53 UTC
    In addition to some code as mentioned above, the output of  describe tablename; from mysql would be helpful also.
Re: Weird problem with Perl and MySQL
by dragonchild (Archbishop) on Nov 22, 2004 at 13:34 UTC
    What version of MySQL are you using? That's also kinda important.

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-25 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found