×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

DBI question

DBI question

DBI question

(OP)
I'm using DBI to access an Informix database on SUN OS 5.7 I'm doing a search to find records according to some criterion. My question is if no match is found in the database does DBI return an error? I'm using DBI::errstr to catch errors. How can I print out these errors? Thanks in advance for any help offered.

RE: DBI question

"no match" is not an error.  It is simply an empty table.  You should be reading your results into an array, right?  Check if it is empty (ie. if (!@array)) to determine if there were matches or not.

To print out DBI errors, just || die "$DBI::errstr";


Sincerely,
 
Tom Anderson
CEO, Order amid Chaos, Inc.
http://www.oac-design.com

RE: DBI question

(OP)
Thanks Tom! This is my first project using DBI which I find very good for database operations.

RE: DBI question

DBI, as with pretty much all the Perl modules, comes with great documentation!  To get at it, just do "perldoc DBI" - if you take the time to read it, it will answer these questions, and help you to better understand and use DBI.  When you bring up "perldoc DBI", you can search for a specific word by doing "/{word to search for}" like "/errstr".  The perldocs describe in detail every DBI command - what each command returns for success, and for failure.

I would also highly recommend "Programming the Perl DBI" by Descartes & Bunce - towards the back they have specific sections for each of the different databases - Informix *IS* in there - not that you need it for these questions.

HTH.


Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close