SQLRDD library for Harbour and MiniGUI

805 views
Skip to first unread message

Grigory Filatov

unread,
Oct 6, 2023, 10:37:05 AM10/6/23
to Harbour Minigui
Dear Friends,

Since the SQLRDD source codes have already been published, I have adapted this library for use with MiniGUI.
image.png

You can see the attached file with the full source code of the example above.
Changes required in your source code:

If your application already runs in xHarbour with DBF files, you will need to
make the following changes:

1 - Add database connection instructions. You can use the ones in
    samples\SQLRDD folder. See samples\SQLRDD\connect.prg.

2 - Upload your DBF files to database. You may use samples\SQLRDD\dbf2sql.prg
    for this.

3 - Add needed REQUESTs and include files in your main PRG:

#include "sqlrdd.ch"       // SQLRDD Main include
#include "pgs.ch"          // Needed if you plan to use native connection to Postgres
#include "mysql.ch"        // Needed if you plan to use native connection to MySQL
#include "oracle.ch"       // Needed if you plan to use native connection to Oracle
#include "firebird.ch"     // Needed if you plan to use native connection to Firebird

REQUEST SQLRDD             // SQLRDD should be linked in
REQUEST SR_ODBC            // Needed if you plan to connect with ODBC
REQUEST SR_PGS             // Needed if you plan to use native connection to Postgres
REQUEST SR_MYSQL           // Needed if you plan to use native connection to MySQL
REQUEST SR_ORACLE          // Needed if you plan to use native connection to Oracle
REQUEST SR_FIREBIRD        // Needed if you plan to use native connection to Firebird

My question : is it interested to someone?

Best regards,
Grigory
mysql1.prg

Aure

unread,
Oct 6, 2023, 4:07:13 PM10/6/23
to Grigory Filatov, Harbour Minigui
A mí me interesa utilizar o trabajar con alguno de esos motores, ya que sigo manejando DBF.

El tema es, que no tengo experiencia en cambiar o migrar las DBF a alguno de estos motores.

Mi ignorancia o inexperiencia se resuelve investigando, a prueba y error. El problema que tengo, es que no tengo el tiempo suficiente pero tengo que darme los tiempos si no, me quedo en lo mismo.

No sé cuál motor de bases de datos me convenga, son las cosas que necesito investigar.

Muchas gracias, un abrazo.

Cuidate mucho, saludos desde México.
--
Visit our website on https://www.hmgextended.com/ or https://www.hmgextended.org/
---
You received this message because you are subscribed to the Google Groups "Harbour Minigui" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minigui-foru...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/minigui-forum/d3526631-a411-4f12-a860-5f6eb7ac3a8fn%40googlegroups.com.


jnfg...@gmail.com

unread,
Oct 6, 2023, 5:17:12 PM10/6/23
to Harbour Minigui
Hi, Yes, this will be of great help to the Harbor/Minigui community, I even tried more with limited knowledge and was unable to compile, I am eagerly awaiting this Library

Dan Campbell

unread,
Oct 6, 2023, 8:21:24 PM10/6/23
to Harbour Minigui
fkng beautiful.

Sending you a donation, thanks chief.

José Quintas

unread,
Oct 7, 2023, 7:53:28 PM10/7/23
to Harbour Minigui

I prefer to use ADO, and create a class to do not need source code on each prg.
It begans as a wrapper, but add features on it.
One thing that I use on migration was this:
:QueryCreate()
:QueryAdd( "CODE", nCode )
:QueryAdd( "NAME", cName )
:DBFQueryExecuteInsert() // and/or
:QueryExecuteInsert( "CLIENT" )
for DBF:
APPEND BLANK
FOR EACH aValues IN aList
   FIeldPut( FieldNum( aValues[1] ), aValues[2])
NEXT
For SQL:
cSQL := "INSERT INTO " + cTable + "("
FOR EACH aValues IN aList
   cSQL += aValues[1] + iif( aValues:__EnumIsLast, "", "," )
NEXT
cCmd += ") VALUES ("
FOR EACH aValues IN aList
   cSQL += ValueSQL( aValues[2] ) + iif( aValues:__EnumIsLast(), "", "," )
NEXT
cCmd += ")"
cnSQL:Execute( cSQL )

While migrating, I was studying what to do on next step, and updating source code to works as SQL and not as DBF.
Not all structures was ready for SQL.
At first time, write on DBF.
On next step, write on DBF + MySQL, but using DBF as reference.
On next step, write on DBF + MySQL, but using MySQL as reference.
When ok, only MySQL as reference.

On this way, I never stop users, and allways last code was in use.
MySQL was backup of DBF and DBF was backup of MySQL.
When all ok, remove DBF update, and remove DBF.

At the beginning, one DBF at a time, but while migrating, chaning how to make next step.


José M. C. Quintas

José Quintas

unread,
Oct 7, 2023, 8:00:50 PM10/7/23
to Harbour Minigui
Complement:
Convert the application to SQL is only one step.
Programmer needs "to be converted" too.
While I was converting to SQL I  was also learning SQL.
My first creation was the backup of all.

José M. C. Quintas

juanpere...@gmail.com

unread,
Oct 8, 2023, 12:16:14 PM10/8/23
to Harbour Minigui
Good morning.
I am quite interested in being able to use a database manager like mysql, firebird and sqlrdd that provides that capability. It would be a great contribution to the entire community.

Grigory Filatov

unread,
Oct 8, 2023, 2:15:18 PM10/8/23
to Harbour Minigui
Hello Juan,

Thanks for your interest :!:

I'm finishing to test the SQLRDD library with MySQL server only.

Note that this is adapted for the Harbour version of the library, since the original xHarbour source code did not work with the Harbour compiler (when starting the application, a runtime error was shown).

> It would be a great contribution to the entire community.
Thanks for your kind words.

Regards,
Grigory

воскресенье, 8 октября 2023 г. в 18:16:14 UTC+2, juanpere...@gmail.com:

Grigory Filatov

unread,
Oct 11, 2023, 10:20:57 AM10/11/23
to Harbour Minigui
  Hi All,

I have prepared a simple example showing how to migrate from DBFCDX to SQLRDD using the standard BROWSE control (see attachment).

You can compare the codes to see the difference.
The SQLRDD use  needs the following modifications: 1) added connecting to SQL server and 2) call dbunlock() function after append a record.

Thanks for your attention.

HTH,
Grigory

воскресенье, 8 октября 2023 г. в 18:16:14 UTC+2, juanpere...@gmail.com:
Good morning.
dbfcdx.prg
sqlrdd.prg

Grigory Filatov

unread,
Oct 22, 2023, 4:51:53 AM10/22/23
to Harbour Minigui
Hi All,

Here is the first screenshot of the MySqlCli example using the SQLRDD library.
image.png

Your feedback is welcome.

Regards,
Grigory

среда, 11 октября 2023 г. в 16:20:57 UTC+2, Grigory Filatov:

Anand Gupta

unread,
Oct 22, 2023, 7:13:17 AM10/22/23
to Grigory Filatov, Harbour Minigui
Looks Great !

Regards,

Anand


--
Visit our website on https://www.hmgextended.com/ or https://www.hmgextended.org/
---
You received this message because you are subscribed to the Google Groups "Harbour Minigui" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minigui-foru...@googlegroups.com.

Grigory Filatov

unread,
Oct 22, 2023, 10:51:25 AM10/22/23
to Harbour Minigui
Hi Anand,

Thanks for your feedback.

Here is the second screenshot of this example with the table data filled in.
image2.png

HTH,
Grigory

воскресенье, 22 октября 2023 г. в 13:13:17 UTC+2, agh...@gmail.com:

Anand Gupta

unread,
Oct 22, 2023, 1:23:32 PM10/22/23
to Grigory Filatov, Harbour Minigui
Thanks for the updated image.

Regards,

Anand

Reply all
Reply to author
Forward
0 new messages