Brian,

Substitute the following after the Browse:


cStr=Replicate("Hello12345",300)
lcExec=[Insert Into mysqlbug Values (20, "Hello", "There", ?cStr)]
If loSPT.Execute(lcExec) > 0
  *
  lcExec=[select * from mysqlbug]
  If loSPT.Execute(lcExec) > 0
    *                   
    Browse
    *
  Endif
  *
endif           

you get a memo field returned as the last field in the table which is
correct. MySQL will pad out the field to whatever length is appropriate.

If you substitute the cStr for the other fields then exactly the same will
happen. The driver/VFP will return back whatever it feels is appropriate -
text or memo.

Dave Crozier


Dave Crozier
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Brian Erickson
Sent: 10 August 2007 14:39
To: profox@leafe.com
Subject: RE: Help confirm a MySQL ODBC bug

Same thing happed to me.  The longtext cam back as c(255).  I am running a
mysql 5.0.32 on Debian.  My odbc driver version number is:  <drum roll>
3.51.14.00.  I hope that helps. 

Brian Erickson
mailto:[EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Steve Ellenoff
Sent: Thursday, August 09, 2007 7:28 PM
To: [EMAIL PROTECTED]
Subject: Help confirm a MySQL ODBC bug

Can some of you who have access to MySQL run the following code 
(below) and post back your results, along with your version of the 
ODBC driver (including sub revision #) & MySQL Engine.

This program should demonstrate a bug I've been seeing. I'm looking 
to collect more data on this problem so I've put together this test 
program to make a more scientific examination of the problem, since 
other people here have reported not having the issue.

Please remember to change the parameters at the top of prg to match 
your MySQL installation.

Thanks for your help in advance.
Steve

****************************************************************************
****************************************************************************
****************************

** MySQL ODBC Bug with VFP?
**
** Run this program once you've changed the setup parameters below 
appropriately. The proper results should show that
** all 3 text fields t,mt,lt of type text, mediumtext, and longtext 
respectively are reported by VFP as MEMO fields.
** The bug I'm seeing with newer versions of the 3.51 ODBC Driver is 
that LONGTEXT are coming back as C(255) fields.
** The program will cleanup the test table it creates (provided your 
login has security rights for create & drop table).

CLEAR
CLOSE ALL
LOCAL loSPT, lcExec, lcDriver, lcServer, lcUserId, lcPassword, 
lcCStr, lcDatabase, lcTable, lcDTString

******************************************
** Change these to meet your situation **

lcDriver = "MySQL ODBC 3.51 Driver"
lcServer = "127.0.0.1"
lcUserId = "root"
lcPassword = "rootpw"
lcDatabase = "test"
lcTable = "mysqlbug"

******************************************

lcCStr = 
"DRIVER="+lcDriver+";SERVER="+lcServer+";DATABASE=test;UID="+lcUserID+";PWD=
"+lcPassword
?lcCStr
lcDTString = lcDatabase + "." + lcTable
?lcDTString
?

*Create class to handle SPT
loSPT = CREATEOBJECT("SPTClass",lcCStr)
IF VARTYPE(loSPT) = "O"
        *Create Table
        TEXT TO lcExec NOSHOW TEXTMERGE
                CREATE TABLE `<<lcDatabase>>`.`<<lcTable>>` (
                `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
                `t` TEXT NOT NULL ,
                `mt` MEDIUMTEXT NOT NULL,
                `lt` LONGTEXT NOT NULL ,
                PRIMARY KEY(`id`)
                )
                ENGINE = InnoDB;
        ENDTEXT
        ?lcExec
        IF loSPT.Execute(lcExec) > 0    
                *Return columns
                IF SQLCOLUMNS(loSPT.nHandle,lcDTString) > 0
                        BROWSE
                ENDIF
                *Drop the table
                lcExec = "DROP TABLE " + lcDTString
                =loSPT.Execute(lcExec)
        ENDIF
ENDIF


DEFINE CLASS SPTClass AS Custom
        nHandle = -1
        cConnStr = ""
        nExecTimeSecs = 0

        FUNCTION Init
        LPARAMETERS tcConnStr,tlNoAutoConnect
                THIS.cConnStr = tcConnStr
                IF !tlNoAutoConnect
                        RETURN THIS.Connect()
                ENDIF
        ENDFUNC
        
        FUNCTION Destroy
                THIS.Disconnect()
        ENDFUNC
        
        FUNCTION Connect
                IF !EMPTY(THIS.cConnStr)
                        THIS.nHandle = SQLSTRINGCONNECT(THIS.cConnStr)
                        IF THIS.nHandle < 0
                                THIS.LogError(THIS.nHandle)
                        ENDIF
                ENDIF
        ENDFUNC
        
        FUNCTION Disconnect
                LOCAL lnResult
                IF THIS.nHandle > 0
                        lnResult=SQLDISCONNECT(THIS.nHandle)
                        IF lnResult < 0
                                THIS.LogError(lnResult)
                        ENDIF
                ENDIF
        ENDFUNC
        
        FUNCTION GetLastExecTime
                RETURN THIS.nExecTimeSecs
        ENDFUNC
        
        FUNCTION Execute
        LPARAMETERS tcCmd, tcAlias
                LOCAL lnSecs, lnResult
                lnSecs = 0
                IF THIS.nHandle > 0 AND !EMPTY(tcCmd)
                        lnSecs = SECONDS()      
                        IF VARTYPE(tcAlias)="C"
                                lnResult =
SQLEXEC(THIS.nHandle,tcCmd,tcAlias)
                        ELSE
                                lnResult = SQLEXEC(THIS.nHandle,tcCmd)
                        ENDIF           
                        lnSecs = SECONDS() - lnSecs
                        THIS.nExecTimeSecs = lnSecs
                        IF lnResult < 0
                                THIS.LogError(lnResult)
                        ENDIF
                ENDIF
                RETURN lnResult         
        ENDFUNC
        
        FUNCTION LogError
        LPARAMETERS tnResult
                LOCAL ARRAY laError[1]
                AERROR(laError)
                MESSAGEBOX(laError[2],16,"Error " + TRANSFORM(laError[5]))
        ENDFUNC
ENDDEFINE*********************************



[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to