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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting into a memo field 1

Status
Not open for further replies.

DRapper

Programmer
Nov 25, 2003
18
0
0
US
Hello All,

I trying to insert a large amount of data into a memo field in an Access 2000 database. I am using a textarea tag in conjuction with an htmlarea editor.

Is there special perl code I need to use in order to insert a large amount of data into a memo field?

I'm using $db->Sql("INSERT INTO pages (category,title,body)
VALUES ('$value{2}','$value{3}','$value{4}')");

If $value{4} is too large it will not insert into the database.

Also if I put information into the database from another source and its too large my perl script will not display it in the htmlarea.

Thanks

DRapper
 
Hi DRapper, are you using The DBI to get at your database?

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
I'm using DB to get to my database

DRapper
 
Don't know it, someone else pls.

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Mike,

I made a mistake I'm using 'use Win32::ODBC;'
to connect to the database.

DRapper
 
if you are connecting your ODBC like this

$db = DBI->connect('dbi:ODBC:yourDSN');

then put this line after it:

$db->{'LongReadLen'} = 1024;


have a nice try.

 
I'm connecting to the database like this

$db = new Win32::ODBC("employee"); Where employee is the dsn name.

DRapper
 
Looking at the documentation for Win32::ODBC:
[tt]The working limit for the size of a field is 10,240 bytes, but you can increase that limit (if needed) to a max of 2,147,483,647 bytes. (You can always recompile to increase the max limit.)[/tt]

You can set the field size limit (which appears to apply to both read and write) with
Code:
SetMaxBufSize

The documentation for that says:
[tt]SetMaxBufSize ( SIZE )

This sets the MaxBufSize for a particular connection. This will most likely never be needed but...

The amount of memory that is allocated to retrieve the field data of a record is dynamic and changes when it need to be larger. I found that a memo field in an MS Access database ended up requesting 4 Gig of space. This was a bit much so there is an imposed limit (2,147,483,647 bytes) that can be allocated for data retrieval.

Since it is possible that someone has a database with field data greater than 10,240, you can use this function to increase the limit up to a ceiling of 2,147,483,647 (recompile if you need more).

Returns the max number of bytes.[/tt]

I think using this will solve your problem.
 
Thanks for the suggestion, but where do I put SetMaxBufSize ( SIZE ) function. I tried to put it under $db = new Win32::ODBC("employee"); statement put perl does not reconize the function.


DRapper
 
It'd be [tt]$db->SetMaxBufSize(1000000);[/tt] (or whatever you wanted to set it to.)
 
Works great!!!

Thanks for your help.

DRapper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top