Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP and SQL at the same time
Message
From
03/01/2019 17:19:19
 
 
To
21/12/2018 17:58:06
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
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:
01664796
Message ID:
01665089
Views:
102
Hi Cetin,

Slow responding here...not much time to look at responses once Dec 22nd hit...a couple follow up questions:

Just curious: I take it below are just functions you have in a procedure file that are available at all times?

>
>SQLQueryInto( "select * from myTable where someField = ?", "crsResult", theParameterToSearchFor)

>lnRowsMatchingSomeCriteria = SQLExecuteScalar("select count(*) from myTable where myField = ?", myParameter)

>SQLInsert("MyTable", "field1, field2, field3m field4", 1, "Some char data", "Another one", DateTime())

>SQLNonQuery("Update myTable set myField=? where id=?", m.ValueToset, m.Id) 
>
What do you mean below "at runtime it is replaced by a CA"? Is that additional code that fires when the form is instantiated to add an object to the DE?

>Also, if you have a table in DE (pointing to a VFP table as expected normally), at runtime it is replaced by a CA that points to either VFP or SQL and all this is based on an app wide setting (oApp.DataMode and oApp.DataConnectionString namely).

I am curious how the below SQL string "flips" between the VFP and SQL code - is that done by some other code that removes the code it does not want based upon the app wide setting (oApp.DataMode)?


>Also I have a GetSQLText() method, that sanitizes the SQL before sent to backend based on what that is (SQL dialects and functions are not the same in all backends). ie:
>
>
>local lcSQL
>text to m.lcSQL textmerge noshow
>select *, 
>   cast(
>      <SQL>case shippedOn is null then 'Pending' else 'Shipped' end</SQL>
>      <VFP>iif(isnul(shippedOn), 'Pending', 'Shipped')</VFP> 
>   as varchar(10) ) as Status
>from Customer cu
>inner join Orders ord on cu.CustomerId = ord.CustomerId
>where orderDate >
><SQL>dateadd(month, -1, getdate())</SQL>
><VFP>gomonth(DateTime(), -1)</VFP>
>end text
>
>SQLQueryInto(m.lcSQL, 'crsResult')
>
On the below, the app is a mix of some SQL commands - for Selects, I always use them (well, mostly all - there are a few legacy lookups done another way but those are easily changed). I use some SQL Inserts - but then a lot is controlled by the framework as I use local views. Mike Yearwood would say that I can change all those views to something else...I will post to him soon.

>It suggests that you should convert most of your data related codes to SQL (SQL-Select, Insert, Update, Delete) and yes it is, but also have xbase support like:


Thanks for everything...you must be a fast typer!

Albert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform