Hello All,

Need to know if a RecordSet AppendChunk is interactive or does it accumulate
the field's data until an Update is called?  I'm finding that the Update
fails if the total RecordSet size is greater than Max_Allowed_Packet.  If
the later is true .. I guess I'll need work around suggestions, please.

Below is my test:

CREATE TABLE test
(
   ID INTEGER AUTO_INCREMENT,
   PRIMARY KEY (ID),
   szText LONGTEXT,
   szBlob LONGBLOB
)


VB Code
===========================================

Const nMaxChunk = 64000
Dim nMaxAllowed as Long

On Error Resume Next

Dim szString as String
szString = String (".", nMaxAllowed + 1)


Dim szSQL as String
Dim cn as Object
Dim rs as Object

Set cn = CreateObject ("ADODB.Connection")
...

szSQL = "SHOW VARIABLES" --  where variable_name = 'max_allowed_packet'
Set rs = cn.Execute (szSQL)
nMaxAllowed = rs (1)
rs.close


szSQL = "SELECT * FROM test WHERE ID = 0"
Set rs = CreateObject ("ADODB.Recordset")
...
rs.open (szSQL)

rs.AddNew

Dim t as Long
Dim szChunk as String

t = 1
do
   szChunk = mid (szString, t, nMaxChunk)
   rs ("szMemo").AppendChunk (szChunk)
   t = t + nMaxChunk
loop while (t < nMaxAllowed)

t = 1
do
   szChunk = mid (szString, t, nMaxChunk)
   rs ("szBlob").AppendChunk (szChunk)
   t = t + nMaxChunk
loop while (t < nMaxAllowed)

rs.Update
if (err <> 0) then stop

rs.Close

===========================================

Any suggestions?
ENetArch

===========================================================

' Keywords:
'     myODBC, mySQL, Visual Basic, VB, ADODB.RECORDSET
'     ADODB.CONNECTION, ADO, AppendChunck, GetChunck,
'     rs.Update, Max_Allowed_Packet

' Errors:
'     [MySQL][ODBC 3.51 Driver][mysqld-3.23.51-nt]
'     MySQL server has gone away
'     Got a packet bigger than 'max_allowed_packet'
'     Lost connection to MySQL server during query

' Environment:
'     WkStn - Windows 2000 WkStn, 256 meg, AMD K6-2 500 mhz, build 2195, SP1
'     MDAC 2.7
'     myODBC 3.51 - WinX
'
'     Server - Windows NT 4.0 Server, 64 meg, Pentium II 400 mhz
'     mySQL - 3.23.51 - NT
'         max_allowed_packet = 4MB


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to