Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Questions re planning for SQL server
Message
From
22/05/2018 12:58:59
 
 
To
22/05/2018 11:02:11
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012 R2
Network:
Windows Server 2012 R2
Database:
Visual FoxPro
Application:
Desktop
Virtual environment:
VMWare
Miscellaneous
Thread ID:
01660042
Message ID:
01660255
Views:
55
Best is to use the same data types and always parameters:
PRIVATE pdCutoffdate
pdCutoffdate = DATE(2008,5,22)
SQLEXEC(lnConnectionHndl, "SELECT * FROM MyTable WHERE Funding_date > ?pdCutoffdate","OutputCursor")
You don't need to set the parameter private in the above example, but in most cases the actual SQLEXEC statement is run in a separate method, in that case you need them private. It would like like this:
PRIVATE pdCutoffdate
pdCutoffdate = DATE(2008,5,22)

TEXT TO lcQuery TEXTMERGE NOSHOW
	SELECT * FROM MyTable 
		WHERE MyTable.Funding_date > ?pdCutoffdate
ENDTEXT

IF THIS.ExecuteQuery(lcQuery, "cuResult")
	SELECT cuResult
	BROWSE
ELSE
	LOCAL laSQLError[1]
	AERROR(laSQLError)
	Messagebox(laSQLError[3])
ENDIF
Error handling and logging should of course go into ExecuteQuery().

>So date type data comes down from SQL server as a string literal? so if pulling down data, the where clause would be something like (for the last 10 years):
>
>...and funding_date > '2008-05-22'
>
>and if funding_date is one of the resulting columns, does it get converted to date format by the ODBC driver or is it also a string literal?
>
>Secondly, I have been working on converting some of this client's sensitive data, like birthdates, to encrypted data. The encrypted data then becomes a string when stored into the VFP tables. This got me thinking about encryption - I read somewhere that SQL server does column level encryption - other than configuring, are values decrypted by the database engine before delivering the result to the client.
>
>
>
>>Since SQL doesn't have date literals, it uses strings... and the approach I use is
>>
>>... and funding_date > '1910-01-01'
>>
>>Note that you used fox SQL syntax and I'm replying in TSQL syntax. The reason is that I pick the records I want in the where clause of the cursor I'm bringing down, rather than bring more down and filter fox-side. The fewer bytes you push over the wire, the better. Sometimes, for large reporting queries, with lots of repeated values from lookups, I bring the lookups separately and then join the cursors in fox - far faster.
Christian Isberner
Software Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform