Partager via


Is there a 1 Megabyte limit on memo fields using the OleDB provider?

I received a question:

My customer is under the impression that there is a size limit (of about 1 meg) on what can be retrieved from a FoxPro Memo field using the OleDb provider? Can someone confirm or refute this???

So I wrote some code that creates a table with a memo field, adds a record, with a 16 Meg string (See Visual FoxPro System Capacities)

There are many layers of software being used here that might limit the string length:

  • The VFP String variable limit
  • The VFP memo size limit
  • ADO recordset string limit
  • COM string limit

Looking at the Visual FoxPro System Capacities, I see something I wrote years ago!

64 bits = 8 bytes

Largest number = 10 ^ 308 = 2 ^ 1023

-> 10 bits per exponent + 1 for exponent sign plus 1 for number sign => 12 bits

Leaving 52 bits for the mantissa + 1 for implied normalized bit -> 53 bits

LOG10(2^53) = 15.95 decimal digits accuracy

lcCurDir = JustPath(Sys(16))

cd (lcCurDir)

CLOSE DATABASES ALL

ERASE testtab1.*

CREATE TABLE testtab1 (name c(10),data m)

INSERT INTO testtab1 VALUES ("test",REPLICATE("A",1.6e7))

?LEN(data),LOG10(LEN(data))

CLOSE DATABASES ALL

 

LOCAL loRs as adodb.recordset

loConn = CREATEOBJECT('ADODB.Connection')

lcPath = (lcCurDir)

loConn.ConnectionString = "Provider=VFPOLEDB.1;Data Source="+lcPath +";Mode=ReadWrite;Password='';Collating Sequence=MACHINE"

loConn.Open

? loConn.Properties('Provider version').value

loRs=loConn.Execute("select * from testtab1")

?lors.Fields(0).Value

?LEN(lors.Fields(1).Value)

loConn.Close

Comments

  • Anonymous
    February 12, 2006
    The comment has been removed