Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP x Mysql
Message
From
10/04/2005 22:01:16
 
 
To
10/04/2005 20:43:50
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MySQL
Miscellaneous
Thread ID:
01001320
Message ID:
01003269
Views:
113
Hello,

"Do you think I can update the information direct sending it through the mysql_query?"

It'll definitly will work, the question is if the needed time to implement it with libmysql is worth the benefit of better performance

If i had to make the decision i would spend a few hours evaluating if it really provides any performance benefits by writing a little test program.

e.g. (pseudocode)
&& testing performace of LibMySql
mysql_init(..)
lnCon = mysql_real_connect(..)

LOCAL lcSomeVar1, lcSomeVar2

lcSomeVar1 = 'teststring'
lcSomeVar2 = 35

lnStart = SECONDS()
FOR xj = 1 TO 5000
 && mysql_query just takes string so we have to build UPDATE command
 && by concating the various parts with correct char delimiters,
 && conversion from numeric to character etc.. 
 lcLibSql = "UPDATE someTable SET someCharField = '" + lcSomeVar1 + ;
 "', SET someNumeric = " + ALLTRIM(STR(lcSomeVar2)) + " WHERE someCondition"
 mysql_query(..,lcLibSql)
ENDFOR
? SECONDS() - lnStart

&& building Update commands like this can be much work if there many fields
&& in the table(s), you also have to escape special characters like 
&& backslash, tab and so ; lcSomeVar1 = STRTRAN(lcSomeVar1,CHR(9),'\t')

&& testing ODBC
lnCon = SQLCONNECT(..) && or SQLSTRINGCONNECT()

lnStart = SECONDS()
&& with ODBC we can use parameter markers (very comfortable)
&& and no manual data conversion is necessary 
lcOdbcSql = "UPDATE someTable SET someCharField = ?lcSomeVar1, SET someNumeric = ?lcSomeVar2 WHERE somecondition"

?SQLPREPARE(lnCon,lcOdbcSql)
FOR xj = 1 TO 5000
 SQLEXEC(lnCon)
ENDFOR
?SECONDS()-lnStart
you should use data and table structures that are likely to be used in the application instead of my basic example of course ...

Regards
Christian
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform