Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a limit for selexec()?
Message
 
 
To
17/05/2008 15:30:12
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01317869
Message ID:
01317875
Views:
17
This message has been marked as the solution to the initial question of the thread.
Hi Koen,

A string literal in VFP is limited to 255 characters. It's better to build only SQL command with text-merge. The macro substitution will go away as well.
Also you should check return value after SQLEXEC() to make sure that it completed successfully.
lcSql = ""
text TO lcSql noshow
select myPrimaryId, mySecondayId,cDtTitle,
	cEnTitle, cDtMaterial, cEgMaterial,ceDtFormat, ceEgFormat,
	coalesce(DtPrtcopy,'') as DtPrtcopy,
	coalesce(EgPrtcopy,'') as EgPrtcopy,
	coalesce(DtSPrice,'') as DtSPrice
  from HORSART_WORKS
endtext
sqltxt = CHRTRAN(lcSql, CHR(13), CHR(10), '')
lcResult = sqlexec(lnRet, lcSql,"curHorsart_Works")
IF lcResult < 0
  * Error
ENDIF
>
>Working with remote MySql database and local VFP.DBC
>
>Following code works alright:
>
>sqltxt=''
>text TO sqltxt noshow
>	sqlexec(lnRet,"select myPrimaryId, mySecondayId,cDtTitle,
>			cEnTitle, cDtMaterial, cEgMaterial,ceDtFormat, ceEgFormat,
>			coalesce(DtPrtcopy,'') as DtPrtcopy,
>			coalesce(EgPrtcopy,'') as EgPrtcopy,
>			coalesce(DtSPrice,'') as DtSPrice
>			from HORSART_WORKS","curHorsart_Works")
>endtext
>sqltxt = strtran(sqltxt,chr(10), '')
>sqltxt = strtran(sqltxt,chr(13), '')
>&sqltxt
>
>cursor gets loaded.
>However adding just one more field to this scenario viz:
>
>sqltxt=''
>text TO sqltxt noshow
>	sqlexec(lnRet,"select myPrimaryId, mySecondayId,cDtTitle,
>			cEnTitle, cDtMaterial, cEgMaterial,ceDtFormat, ceEgFormat,
>			coalesce(DtPrtcopy,'') as DtPrtcopy,
>			coalesce(EgPrtcopy,'') as EgPrtcopy,
>			coalesce(DtSPrice,'') as DtSPrice,
>			coalesce(EgSPrice,'') as EgSPrice
>			from HORSART_WORKS","curHorsart_Works")
>endtext
>sqltxt = strtran(sqltxt,chr(10), '')
>sqltxt = strtran(sqltxt,chr(13), '')
>&sqltxt
>
>will result in Error : "Command contains unrecognized phrase/keyword"
>
>If I launch Sqlyog the 2ndquery is executed as it should be.
>
>It seems to be there is a limit to the maxnmbr of characters, when I delete any column in the 2nd Select statement it results a correct cursor.
>
>I am at lost what is going on, and would like to know how to solve this one.
>Regards,
>
>Koen
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform