QBE with MySql (an idea)

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: QBE with MySql (an idea)

Post by Rathinagiri »

Thanks for your comments on Firebird. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: QBE with MySql (an idea)

Post by Rathinagiri »

Can you tell me why you prefer ODBC to connect to Firebird?

What about the native API?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: QBE with MySql (an idea)

Post by sudip »

Hello Friend Vanguarda,
Thanks a lot for your answer.
Vanguarda wrote: Some time ago (4 years may be), i had work with firebird and xHarbour Comercial Version + SQLRDD. Currently i work with firebird + ODBC + HMG and the performance is was like with xHarbour. :o
I am very happy to hear this. So, Master Roberto gave us a software tool free of cost which has the same performance of a highly priced and excellent software tool!!! :) Thank you Roberto. Your software is priceless :D

Now, I also want to know like Rathi, which is YOUR CHOICE between native API call and ODBC? And pros and cons about 2 methods.

Thank you again.

With best regards.

Sudip
With best regards,
Sudip
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: QBE with MySql (an idea)

Post by Vanguarda »

rathinagiri wrote:Can you tell me why you prefer ODBC to connect to Firebird?

What about the native API?
Hi my friends SUDIP, Rathi.

At first, sorry my delaying for response.

Well, I prefer ODBC because this way is the ONLY way that i was able for connect to firebird :?
ONLY way free. Because the SQLRDD driver is very, very expensive for me. And with ODBC i was very glad. The performace is the same.

sorry friends, but i don´t know about this NATIVE API. :(

with best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: QBE with MySql (an idea)

Post by Rathinagiri »

Thanks Vanguarda.

Recently Roberto had added connectivity to various databases like SQLite, MySQL, Firebird, Postregsql from harbour source code. They are already inbuilt with the name lib*.a in c:\hmg\harbour\lib folder.

For Firebird the library is libhbfbird.a. With this library we can easily connect to the Firebird databases without any ODBC connection. Since it is a direct connection it should be faster than ODBC, I think.

Here is the example code to how to connect and access Firebird database from Harbour source code,

Code: Select all

/*
 * $Id: test.prg 8659 2008-06-08 10:22:37Z vszakats $
 */

#include "common.ch"

Function Main()
   LOCAL cDir, cName
   LOCAL cDBName
   LOCAL nDialect := 1

   LOCAL trans, qry

   hb_FNameSplit( hb_argv( 0 ), @cDir, @cName, NIL )
   cDBName := hb_FNameMerge( cDir, cName, ".gdb" )
   
   if File( cDBName )
       FErase( cDBName )
   endif
   
   ? FBCreateDB(cDBName, 'sysdba', 'masterkey', 1024, 'ASCII', nDialect )
   
   /* Connect rdbms */
   db := FBConnect("127.0.0.1:" + cDBName, "sysdba", "masterkey")
   
   if ISNUMBER(db)
      ? 'Error'
      quit
   endif
   
   ? FBExecute(db, 'sldjfs;ldjs;djf', nDialect)
   
   ? FBClose(db) 
   
   trans := FBStartTransaction(db) 
   qry := FBQuery(db, 'create table teste (code smallint)', nDialect, trans)
   FBCommit(trans)
   
   
   ? "Status Execute: ", FBExecute( db, 'insert into customer(customer) values ("test 1")', nDialect, trans)
   
   ? "Status no Rollback: ", FBRollback(trans) 
   
   trans := FBStartTransaction(db)
   ? "Status Execute: ", FBExecute( db, 'insert into customer(customer) values ("test 2")', nDialect, trans )  
   ? "Status commit: ", FBCommit(trans)
   
   
   ? "Status Execute: ", FBExecute( db, 'insert into customer(customer) values ("test 3")', nDialect )
   
   // FIX WINDOWS GPF BELOW
   
   qry := FBQuery(db, "SELECT * FROM sales", nDialect) 
   
   num_cols := qry[4]
   columns := qry[6]
   
   For x := 1 to num_cols
      ? x, "> "
      For y := 1 to len(columns[x])
          ?? columns[x,y], ' '
      Next
   Next
    
   ? '---'
   
   do while (fetch_stat := FBFetch(qry)) == 0
      ? fetch_stat
      for x := 1 to num_cols
          ?? FBGetData(qry,x), ', '    
      next 
   enddo
   
   ? 'Fetch code:', fetch_stat
   
   ? "Status Free sql: ", FBFree(qry)
   
     
   /* Close connection with rdbms */
   ? "Status Fechar Database: ", FBClose(db)
 
   Return Nil

East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: QBE with MySql (an idea)

Post by sudip »

Rahi, Vanguarda,
Thanks a lot.
Regards.
Sudip
With best regards,
Sudip
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: QBE with MySql (an idea)

Post by Rathinagiri »

I had linked a sample file using the provided libhbfbird.a. It gives error.

We have to create libfbclient.a (by converting fbclient.dll distributed with firebird) or use the fbclient.dll and ibase.h in our software. I don't know how to do that. :(
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: QBE with MySql (an idea)

Post by Vanguarda »

hi friends,

Rathi, thanks for the info. Is is a great new. I´ll test it ASAP.


with best regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: QBE with MySql (an idea)

Post by sudip »

Hello Vanguarda,
Vanguarda wrote:....
...
Because the SQLRDD driver is very, very expensive for me ...
Hope you will be interested about this link viewtopic.php?f=7&t=860

With best regards.
Sudip
With best regards,
Sudip
User avatar
Vanguarda
Posts: 543
Joined: Wed Feb 11, 2009 10:56 am
Location: Americana - SP
Contact:

Re: QBE with MySql (an idea)

Post by Vanguarda »

sudip wrote:Hello Vanguarda,
Vanguarda wrote:....
...
Because the SQLRDD driver is very, very expensive for me ...
Hope you will be interested about this link viewtopic.php?f=7&t=860

With best regards.
Sudip
Thank´s a lot my friend,

regards,
--
Paulo Sérgio Durço (Vanguarda)


http://hmglights.wordpress.com/
Post Reply