Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Code to MySQL
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01158996
Message ID:
01159123
Views:
23
>Hello there, Borislav. Good to hear from you again.
>
>>>Okay. I have a couple of questions. First, what the heck is "x.fsc-x.fsc as Savings"
>>>and the other lines like it? Is this just an easy way to set these values to zero?
>>>If so, why would the original programmer want to do this? This is a query is used
>>>in report generation, and the code does and OLEControl call to Crystal Reports 10.
>>>Does this have anything to do with this, folks?
>>
>>
>>I think so. It get zero but keep field type, because if you put: 0 AS Savings you
>>will get an integer field, not float or money.
>
>Ah. Ok. That makes sense, but this remark leads me to another question: Does VFP
>allow type casting, as in "lfFloatValue = (float) lnSomeIntegerValue?"

VFP is very generous when you need casting. You could do whatever you want with all number realted types w/o explicit convertion needed:
myVar = integer+numeric+money+float
or
REPLACE float_Field WITH integer_variable
When you need to convert them to other types (string) you need to use STR() function or TRANSFORM()
TRANSFORM() convert ALL types to string (at least since VFP 8)

>

>Well, as far as I've been able to find out, and from the RDBMS' that I've used (Access,
>Oracle, postgresql, and MySQL), only VFP uses cursors and cursor adaptors to the extent
>that it does. Cursors are used in the other database engines, but they are used rarely.
>Also, VFP has it's own way of doing cursors that, as far as I've been able to find out,
>isn't compatible with anyone elses cursors, and VFP's way of doing things is not SQL
>compliant (as far as I can tell and have read). (The POSIX group would have fun with
>Microsoft if they could :^). GOD: I HATE MICROSOFT!!!! (Guess that blows my chances
>at an MVP. LOL!! :^) :^) :^)
>

VFP uses its own cursors (THANKS GOD). CFP crated cursors are just temporay tables crated in your TEMP folder. Rarely they are just memory arrays. Because it has its own DataBase all that VFP do is convert (no metter how) your queries to something that you should know (if you programing with VFP of course) and that is a xBase table. With it you could do ALL you can think of :-) and after you finish playing with it update your BackEnd w/o problems. Not all can be done with pure SQL queries, you know, sometimes you need to use xBase commands :-)))))

>Well, I'd love to keep the MySQL code close to the original VFP query, but something
>tells me that won't be too possible. I was hoping that I could read all the records
>into a cursor, then I could just pass a pointer to the cursor as a parameter to a
>PHP function that would dynamically create a report using ezPDF, which is an open
>source PDF class for PHP.

You are right, you can't pass a pointer to VFP cursor. But as I said VFP cursor is not a memoty variable, it is a DISK table.

This is of ourse if you use INTO CURSOR clause of VFP SELECT, but If you use INTO ARRAY you will get array with all records.


>Hmmm. Wonder why? You would think that a cursor was nothing more than a memory-allocated
>array of records that matched the query criteria, right?(Shrug.) Maybe they are worried
>about Windows or SQL Server having to page on large queries or something, and they don't
>want to make SQL Server and Windows look bad :^) :^) :^).


I think the term "CURSOR" in SQL Sever and other RDBMS are used for two different things (of course I am not so sure about that). In SQL Server you could use TABLE variables, but you can't loop in them. Cursors are used when you need to do something in a loop. BTW are you sure other RDBMS cursors are very fast?

>
>Randall
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform