Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


[xHarbour] SQLRDD problems.

[xHarbour] SQLRDD problems.

[xHarbour] SQLRDD problems.


I currently try to use xharbour in order to run my clipper programs on
a SQL Server database.
Many points that surprised me :

- A program that just displays all the records of a table is twice
faster running on a .dbf file than running on a SQL Server database.
Is it normal ?

- What is a lot more surprising is that the same program compiled with
the original clipper v 5.2 compiler is about 25 times faster than
compiled with the xHarbour compiler ! Why such a difference ??

- Is there a possibility to change the name of the tables in the sql
database without changing the use instructions in the clipper
program ?
For instance, having this instruction :
use c:\aFolder\Order.dbf VIA "sqlrdd"
should the name of the sql table necessarily be named :
"_aFolder_Order_DBF" ? Or is there a way to remove "_DBF" for
example ?

- It seems that xHarbour doesn't support exclusive file opening and
record locking. I mean exclusive instructions and FLOCK(), RLOCK()
functions have no effects. Is there something more to do to have
exclusive access on a table/record ?

Thank you in advance for any help, clarifications or suggestions.


RE: [xHarbour] SQLRDD problems.

I think you should study on the differences of relational database models (SQL) compared to simple table based database models (DBF). You seem to be comparing apples to pears here. SQL is transaction & resultset based, while DBF is record based. Retrieving SQL records 1 by 1 is _very_ inefficient, doing a "SELECT * FROM Table", and displaying rows from the resultset is much more efficient. (xHarbour even supports the "FOR EACH" statement...)

Performance of my xHarbour compiled Clipper apps is 2 to 5 times better, when compiled with xHarbour. Depends on the type of operations you do. If only the above mentioned database actions are measured and using SQLRDD, speed could be problematic, but bare metal loops en calculations can be much faster.

On the USE statement, check out the ALIAS clause, it allows you to name the working area any way you need (within naming restrictions ofcourse)

(Btw, I haven't used SQLRDD driver myself, only the free Mediator from OTC.pl, but it has similar 'issues')


RE: [xHarbour] SQLRDD problems.

Thank you for your explanations, ThonHu. In fact it is the display that is a lot slower with xHarbour.
Here was my test program :

#include "sqlrdd.ch"
procedure harb()
        Connect()  // function in C:\xHB\samples\sqlrdd\connect.prg
        use q:\test.dbf VIA "SQLRDD"

        debut = seconds()

        for i:=1 to 5000
                go top
                do while !eof()
                        ? valu
        next i

        fin = seconds()
        ? "Execution time: ", trim(str(fin -debut))

If I remove the line
? valu
The program is a lot faster and even faster when compiled with xHarbour if it runs on .dbf files.
However it's always a lot slower when running on a sql table (takes about 4 seconds with sql server to 0,02 seconds with .dbf files). Do you think a such difference is due to the fact that many one-result queries are send to the database ?
Or is there an other problem ?
Concerning the display, someone told me that it is a lot slower in xharbour than clipper due to the way clipper works (dos and direct screen memory access) that is forbidden under windows. Do you know if there is a way to improve the speed of display ?

I try adding an alias to the "use" instruction like that :
use q:\MyFolder\orders.dbf alias orders via "sqlrdd"
but it always research a table called "_MyFolder_orders_dbf" whereas I would like it to research a table called "orders"...

An other question: When compiling a .prg file, the compilator throws an error :
"Statement not allowed outside of procedure or function"
So it seems that all code needs to be encapsulated in a procedure or function whereas it is not necessary for the original Clipper 5.2 compilator. I would like to know if there is a way (maybe a compilation option) so that it is not necessary to add a function around my code. I have hundreds of .prg files and would rather prefer to avoid adding function in each of them.

Thanks a lot for your help.



RE: [xHarbour] SQLRDD problems.

Changing your GT driver to GTWVT or GTWVW could solve some of the slower display issues, especially on WinXP systems.

The ALIAS feature is probably better answered at the xHarbour NG on Google Groups.

The "Statement not allowed..." means that you are compiling with -n option as advised in the xHarbour docs, so your prg doesn't get a 'surrounding' procedure <progname>, which is the default with Clipper. But Clipper does support that same compile-time switch... xHarbour and Clipper -n parameter does not allow executable code to exist outside of a function or procedure, and by not having the <progname> procedure, you are outside of any procedure... Are you calling your <progname> procedure directly? If not you should be able to remove the offending lines, IMHO.
Removing the -n switch should give the Clipper compatible situation you want.


RE: [xHarbour] SQLRDD problems.


How can I change the Gt driver. Is it something to install ? Is there any url where I can download those drivers ?

Concerning my compilation problem, I've read in the documentation that xBuild Project Builder by default set the –n option. As far as I've understood, the only way to remove this option is to define other options. That's not a problem for me at the moment because I want to compile my program with the /M option, but I would be a serious problem if I wouldn't like to define other options and although remove -n...

However I still have a problem for converting my .rmk file to a .xbp file.
Here is what my .rmk file looks like :

    clipper $< /M

    clipper $< /M/N


As you can see, some .prg files are compiled with /N options and other are compiled without it.
In xBuild Project Builder I cannot find a way to do that... There is a field where we can define some compilation flags but they applied to all the .prg files. Do you have a solution for this problem ?

Thank you for your help.


RE: [xHarbour] SQLRDD problems.

Sorry, but I'm using the .org (open source) version of xHarbour (without the support by xHarbour.com) If you have a valid contract with them, they should give you the support for questions like this, as I'm using HBMake for creating  and running make scripts. These can be manually modified.

I'd go for having the /n option on all your sources, as that's the default for xHarbour.

Linking in GTWVW or GTWVT (called WVW or WVT in xHarbour.com, AFAIRC) should cause GTWIN (the default GT) to be left out of your exe, but I'm not sure it does. Just try and see.


RE: [xHarbour] SQLRDD problems.


I currently try the 30 days trial version of xHarbour, but maybe make scripts of .org version could be used with my version. In any case, I would be interested to know how do that with HBMake.

Sorry, but I'm quite novice and I don't understand what you explain to me about GTWVW or GTWVT. Could you detail me the steps for installing those drivers ?

Thank you.


RE: [xHarbour] SQLRDD problems.

Hm, sorry, but the HBMake tol is not delivered with xHarbour.com. As said before, I'm not using the commercially supported version of xHarbour, so I wouldn't know how to add these mods to the scripts used by the Builder tool of xHarbour.com. Last time I saw it it was very easy to add libs etc. by drag&drop into the right windows, when Builder is open.
There must be some hints or info on how to change the GT driver (helpfile?), it would usually only require to change a lib and optionally add some initialisation.


RE: [xHarbour] SQLRDD problems.

Linking in GTWVW or GTWVT (called WVW or WVT in xHarbour.com, AFAIRC) should cause GTWIN (the default GT) to be left out of your exe, but I'm not sure it does. Just try and see.

I try adding those libraries to the linkage, but the display is still slow. How to check that GTWIN isleft out of my exe ?


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close