HMG and SQL

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

HMG and SQL

Post by AUGE_OHR »

hi,

HMG have c:\hmg.3.4.4\SOURCE\HMGSQL\
it does have
hmgmysql.prg
hmgpgsql.prg
hmgsqlite.prg
to buildLib.BAT
libhmgmysql.a
libhmgpgsql.a
libhmgsqlite.a
we also have buildLib64.BAT

Question : does it work with 64 Bit DLL or 32 Bit DLL :idea:

---

Xbase++ v2.x have begin to use PostgreSQL so i try to use PQ* Function
now in hmgpgsql.prg

Code: Select all

FUNCTION connect2db(cHost,cUser,cPass,cDb,nPort)
function sql(dbo1,qstr)
function miscsql(dbo1,qstr)
function C2SQL(Value)
are some PQ* Function.
i can make Connection, use sql(dbo1,qstr) and get a Array.

---

under c:\hmg.3.4.4\HARBOUR\contrib\hbpgsql\tests i found "more" for PostgreSQL
it transfer ( INSERT ) data into PostgreSQL Table

Sample use CLASS TPQServer() so PQ* Function are "wrapped" as Method
under HMG it is available as hbpgsql.hbc but no Source or Description

---

MiniGUI Extended Version have c:\MiniGUI\SOURCE\HbPgSql\tpostgre.prg

Code: Select all

CLASS TPQServer
CLASS TPQQuery
CLASS TPQRow
CLASS TPQServer have Method for Connection, List/Create/Delete Table and send Query / Statement to SQL Server
CLASS TPQQuery have Method to handle Result-Set to navigate and get/set Field Value
CLASS TPQRow seem to be special for 1 Row e.g. Edit Row

---

HMGSQL can build 64 Bit LIB but how to build MinGW 64 Bit "hbpgsql" :?:
MiniGUI Extended Sample have MakeLib.bat ... but it is for BCC

so how to go on for 64 Bit HMG App and PostgreSQL :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG and SQL

Post by AUGE_OHR »

hi,

i found in Changelog
2013-05-22 13:29 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* contrib/sddpg/core.c
+ enhanced connection parameters support. Now it is possible to connect
to PostgreSQL server using:
1) URI string
RDDINFO(RDDI_CONNECT, {"POSTGRESQL", "postgresql://host"})
2) Key=value parameter pairs
RDDINFO(RDDI_CONNECT, {"POSTGRESQL", "host=localhost port=5432"})
3) separate parameters. Support for port, options, tty is added
RDDINFO(RDDI_CONNECT, {"POSTGRESQL", "host", "user", "passwd", "db",
"port", "options", "tty"})
so i try it but as Return Value i got Array ( of parameter ) and no Pointer ( Number )

Code: Select all

   xRet := RDDINFO(RDDI_CONNECT, {"POSTGRESQL", "host=localhost port=5432"})
i have search for RDDINFO() and found for ADO, MySQL / MariaDb, SQLite3 and other but not for PostgreSQL :(

---

i know how to use PostgreSQL "native" but than DBF Function like SKIP will not work.
i have to use Method o:Skip from my CLASS, under harbour it is CLASS TPQServer()

what do i need to use PostgreSL as RDD :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG and SQL

Post by AUGE_OHR »

hi,

i found "core-master" here https://codeload.github.com/harbour/core/zip/master
it does have hbpgsql.hbp hbpgsql.hbc to build LIB ... but how :?:

Code: Select all

-hblib
-inc

-o${hb_name}

-w3 -es2

-depkeyhead=pgsql:libpq-fe.h
-depcontrol=pgsql:no{HB_BUILD_3RDEXT='no'}
-depcontrol=pgsql:${HB_WITH_PGSQL}
-depincpath=pgsql:/usr/include
-depincpath=pgsql:/usr/local/pgsql/include
-depincpath=pgsql:/usr/local/pgsql/include/libpq
-depincpath=pgsql:/usr/include/pgsql
-depincpath=pgsql:/usr/include/postgresql
-depincpath=pgsql:/postgres/include
-depincpath=pgsql:/opt/local/include/postgresql84
-depincpath=pgsql:/opt/local/include/postgresql83
-depimplibs=pgsql:../lib/libpq.dll

-iflag={bcc}-a

${hb_name}.hbx

postgres.c
rddcopy.c

tpostgre.prg
i try

Code: Select all

Build.BAT hbpgsql.hbp
but get Error
hbmk2[hbpgsql]: Error: Missing dependency: pgsql
what do i miss :idea:
have fun
Jimmy
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG and SQL

Post by danielmaximiliano »

Hi Jimmy
ou'll need these packages to compile certain contribs and optional Harbour features.

for contrib/hbpgsql lib: postgresql-devel dependency

https://www.postgresql.org/download/windows/ OR
https://www.enterprisedb.com/downloads/ ... -downloads

in batch
set HB_WITH_PGSQL=C:\pgsql\include
2020-07-17 22_50_15-Window.png
2020-07-17 22_50_15-Window.png (26.21 KiB) Viewed 3894 times
Mibuild.rar
(1.24 KiB) Downloaded 147 times
2020-07-17 22_51_11-Window.png
2020-07-17 22_51_11-Window.png (13.7 KiB) Viewed 3894 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG and SQL

Post by AUGE_OHR »

hi,

THX

how does your hbpgsql.hbp look like :?:

Code: Select all

mibuild hbpgsql.hbp 
Error
Nombre de la Aplicacion:=hbpgsql.hbp

"}=={}" kann syntaktisch an dieser Stelle nicht verarbeitet werden.
C:\hmg.3.4.4\1\hbpgsql>
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG and SQL

Post by AUGE_OHR »

hi,

seems i got 64 Bit LibPQ.DLL (v9.5) running with 64 Bit HMG App :D

i have work with *.HBP file and saw this
-iflag={bcc}-a
now i change it to

Code: Select all

   -iflag={mingw64}-a 
---

i have rename "PGSQL:" to "hbpgsql:" and reduce -dep***
under D:\PG i have installed PostgreSQL v9.5.18.19191 64 Bit

Code: Select all

-depkeyhead=hbpgsql:libpq-fe.h
-depcontrol=hbpgsql:no{HB_BUILD_3RDEXT='no'}
-depcontrol=hbpgsql:${HB_WITH_PGSQL} 
-depincpath=hbpgsql:d:\PG\9.5\include
-depimplibs=hbpgsql:d:\PG\9.5\lib\libpq.dll  
to use it on your PC change path D:\PG to your Folder

when run build64 hbpgsql.hbp it produce 2 x LIB :o
hbpgsql-64.zip
(25.79 KiB) Downloaded 158 times
libhbpgsql.a
liblibpq.a
i copy both to c:\hmg.3.4.4\LIB-64\
DEMO.HBC

Code: Select all

libs=hbpgsql
libs=libpq
DEMO.HBP

Code: Select all

demo.prg
PG64DEMO.ZIP
(1.83 KiB) Downloaded 165 times
to run DEMO.EXE you need PostgreSQL 64 Bit DLL (from \LIB Folder)
libcurl.dll
libeay32.dll
libecpg.dll
libecpg_compat.dll
libiconv-2.dll
libintl-8.dll
libpgtypes.dll
libpq.dll
libxml2.dll
libxslt.dll
ssleay32.dll
zlib1.dll
---

now i can work with PostgreSQL under 64 Bit but while it is NOT a RDD you have to use Method of Tpostgre.prg
you have to build a SQL Statement instead of SET FILTER.

this also mean do NOT use a SELECT Statement to open big Table without LIMIT :!:
even PgAdmin need a long time to open Table with 2.000.000 Row when not give a LIMIT.
have fun
Jimmy
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG and SQL

Post by danielmaximiliano »

AUGE_OHR wrote: Sat Jul 18, 2020 4:24 am how does your hbpgsql.hbp look like :?:
Hello Jimmy: double click on Mibuild, enter the name [Enter], if it is a project it is compiled first, but the prg will be compiled, the next step is to enter the compilation parameters /n /c /d
the batch execution is a Loop so you don't have to enter it every time it is needed in tests from the CMD line. just entering [Enter] exits it.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG and SQL

Post by danielmaximiliano »

when run build64 hbpgsql.hbp it produce 2 x LIB
Hi Jimmy: At compile time the PgSQL library shows HBMK2 messages
no parameters compilation
Compile hbpgsql.hbp
hbmk2: Dependency 'pgsql' found: C:\pgsql\include
hbmk2: Found .lib file with COFF format with the same name, resort
to use this instead of the .dll.
import library created liblibpq.a <= C:\pgsql\lib\libpq.dll
creating static library libhbpgsql.a
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
AUGE_OHR
Posts: 2095
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: HMG and SQL

Post by AUGE_OHR »

hi,
danielmaximiliano wrote: Sat Jul 18, 2020 1:34 pm At compile time the PgSQL library shows HBMK2 messages
but it work, or :?:
many use BCC, that´s why i ask to use BCC for HMG instead of MinGW.

---

now we have LIB for 64 Bit PostgreSQL but no RDD. if someone can fix PgRDD it would be great.
have fun
Jimmy
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG and SQL

Post by danielmaximiliano »

Hi Jimmy:
Roberto chose Mingw for HMG Grigory BCC for HMG Extended.
one uses .a libraries and the other .lib, some time ago there was an HMG user who published the compilation differences I think here : http://hmgforum.com/viewtopic.php?f=15&t=2531

in this link I leave files to test HMG with the BCC and Open-Watcom compilers

https://code.google.com/archive/p/santy ... akechanges
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply