Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple database queries in one script, with DBI...?

Status
Not open for further replies.

rmayer4

Programmer
Oct 2, 2001
9
CA
hey hey...

I'm using DBI to query a MS Access database, to fill in the blanks in a template for a web site... The problem is that Access keeps throwing these "record too large" errors at me.

I figured that if I could make two queries of half the information each, it would work, but I have no clue how I would even begin going about a task like that...

Any ideas?

If you need more info, lemme know!! Thanks!
 
Something like this would limit the amount of data returned:
Code:
select name, address1, address2, city, state, zip from addresses
select dob, phone, workphone, fax from addresses
But, are you sure that it's the amount of data being returned that's causing the problem, or the length of the record in general?

There could be a problem with one of your fields being too long for the default read length too. To fix this problem, add this statement after you open the database:
Code:
$dbh->{'LongReadLen'} = 1024;
$dbh is your database handle, and you can set the value to whatever is the longest field you have. I think the default value, at least for the MySQL DBI, is only 128, or 256, or some stupid thing like that.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I'm pretty sure it's the amount of data... Access doesn't seem to want to send information from a "memo" field type, which can be apparently any length, so I have to use "text", which Access limits to 255 characters per field. So, I split all the information up into sections of less than 255 characters.

I tested the individual fields, and they all work. I tried retrieving multiple fields at once, and this works, too, until it reaches a certain point, where it says "Record Too Large" and doesn't return anything.

I tried $dbh->{'LongReadLen'}=1024 but it didn't work...
I also read that Access won't work if you ask for more than 2k on any single query.

I figured making 2 select statements would do the trick... but I'm not sure how to go about doing this... is there another, maybe better way to get this done??
 
THe first part of my reply showed how to do it. Simply make multiple requests with different field names on each select statement. You can save off the data from each select into variables to use when you're all done. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top