How to use PGDBE in CXP programs

Use this forum for questions and answers regarding PostGreSQL and the PGDBE.
Message
Author
Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

How to use PGDBE in CXP programs

#1 Post by Diego Euri Almanzar »

Hello!!

I have not been able to use the PGDBE database engine, nor ADSDBE, in CXP programs.

Hopefully someone can help me, especially with PGDBE, ADSDBE is not that important to me.

best regard

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: How to use PGDBE in CXP programs

#2 Post by Tom »

Hi, Diego.

Using the PGDBE in a CXP program is the same as using it in a standard program. Do you do that already?
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: How to use PGDBE in CXP programs

#3 Post by Diego Euri Almanzar »

Hello Tom

I tried to add PGDBE and ADSDBE in CxpEndpoint:defaultConfig, which is where the DBEs should be added, in CXP programs, and when I try to use those DBE engines in my CXPs, I get an error that it can't.

Meanwhile, I'm using FOXDBE, and I haven't had any problems. Although, in the future, or when I learn to configure it, I will use PGDBE because the DBF technology is obsolete, and it works slowly.

I appreciate a lot your help.



METHOD CxpEndpoint:defaultConfig(cToken)
LOCAL oDO := DataObject():New()

IF !("PGDBE" $ dbelist())
DbeLoad("PGDBE")
ENDIF

IF !("ADSDBE" $ dbelist())
DbeLoad("ADSDBE")
ENDIF


IF !("CDXDBE" $ dbelist())
DbeLoad("CDXDBE")
ENDIF

IF !("FOXDBE" $ dbelist())
DbeLoad("FOXDBE")
ENDIF

IF !("FOXCDX" $ dbelist())
DbeBuild("FOXCDX","FOXDBE","CDXDBE")
ENDIF

//
cToken := Lower(AllTrim(cToken))
IF cToken=="session"
oDO:Provider := "CxpCookieSessionManager"
oDO:Timeout := 15
ELSEIF cToken=="storage"
oDO:Provider := "AppStorageManager"
oDO:Store := "cxp-data\application-storage.dbf"
ENDIF
RETURN( oDO )

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: How to use PGDBE in CXP programs

#4 Post by Tom »

Loading the DBE is not enough, you have to establish a connection to the server, create a session and set this session as the default for every thread your server creates. Did you manage to migrate the MDI sample to PG? What error do you get?
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: How to use PGDBE in CXP programs

#5 Post by Diego Euri Almanzar »

Hello Tom

I already have a long time using PGDBE, in desktop programs. I had problems with the set filters, but I wrote to Alaska Software, and they gave me the technique to solve the problem. You even tried to help me with the subject. As you will notice, before establishing the connection, the dbe must be uploaded or called, and that is where I have the problem. Xbase++, you are not calling PGDBE, nor ADSDBE, in CXP applications.

In desktop applications, preferably, the following should be done, and it works very well:

PROCEDURE dbeSys()
DbeLoad("pgdbe")
DbeSetDefault("pgdbe")
cConnStr := "DBE=pgdbe;server="+servertype+";"
cConnStr += "db="+connectdatabase+";uid="+connectuser+";pwd="+connectkey
oSession := DacSession():New(cConnStr)
return


In CXP, the DBE calls must be compulsorily, through the following method:

METHOD CxpEndpoint:defaultConfig(cToken)

But this method ignores the DBE's call to the following dbe's: PGDBE, and ADSDBE. The other DBEs work fine. If I could call PGDBE, the connection is the least of it, it would be easy. But, if the DBE does not upload successfully, logically it will not achieve the connection. I am not writing to Alaska, because my license to consult has already expired.

I really appreciate that you always try to help me.

Best regards.

User avatar
SlavkoDam
Posts: 79
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: How to use PGDBE in CXP programs

#6 Post by SlavkoDam »

Hello!
It is not possible to use PGDBE.dll and ADSDBE .dll in CXP, because they depend on PGUTIL.dll and ADSUTIL.dll, respectively, and which are NOT dynamically unloadable. Each dll to be used in CXP must be dynamically unloadable, and these dlls are not prepared for that. If you execute in command prompt: dllinfo pgutil and dllinfo adsutil, you will get their type info: Xbase++ not prepared for dynamic unload.
To be prepared for dynamic unload, all dll's prg files must be compiled with XPP /DLL:DYNAMIC, and Alaska didn't do that with PGUTIL.dll and ADSUTIL.dll. That is why PGDBE.dll and ADSDBE.dll cannot be loaded with dbeload() in CXP.
You can use PowerSql library instead, which IS dynamically unloadable and doesn't depend on any Alaska dll. PowerSql library supports any type of SQL DBMS and can be used both in desktop and web apps. It supports both ODBC and ADO connections.
I suppose you are disappointed with Alaska support for PGBDE in CXP. There are other shortcomings in Alaska CXP, you will come to them, one by one.
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: How to use PGDBE in CXP programs

#7 Post by Tom »

Hello, Slavko.

This is very interesting, thanks for the information. There is no PDR about this to be found in the knowledgebase. :o

@Diego: You mentioned Alaska gave you a solution for the filter problem with ISAM PGDBE. Can you say a little more about that, if you are allowed to? I'm still struggling with complex filters, everything else works excellent.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: How to use PGDBE in CXP programs

#8 Post by Diego Euri Almanzar »

Dear friend, Slavoljub Damnjanovic

When I bought Xbase 2.0 I did it hoping to develop a web application, and that my desktop program would stop using dbf files.

I have managed to permanently remove DBFs from my desktop program. Now my program is more robust, secure, and above all faster. I don't understand the reason why reading and writing DBF files is so slow, especially in Windows 10. But well, that's another issue that is not so important, and the important thing is that I manage to update.

And, just as I am disappointed in DBFs, so I am disappointed in Alaska Software after your explanation. Since I thought that in CXP, it would also have the ease, and availability of use, of PGDBE. Since I have already advanced enough in my CXP programs, I deduced that it was the right moment to replace the driver that they recommend, which is FOXDBE, with the modern PGDBE. Your explanation is very logical, it shows the great mastery you have of the subject. You are a great programmer. It's definitely disappointing, not being able to use PGDBE.

I received an email from Alaska Software, indicating that they will have a new version for January of next year, where they highlight "impressive" improvements... But, if I can't use a safe driver like PGDBE, obviously I won't invest money in it.

Friend, remember that you owe me how to upload a PDF to the browser, through CXP. In case you can't help me, I'll try to configure a URL, from IIS, or from APACHE. I'm not good at those setups, but I'll have to learn.

Thanks.

Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: How to use PGDBE in CXP programs

#9 Post by Diego Euri Almanzar »

Hello Tom

Yes, I have solved the problem of the set filter, thanks to the collaboration of Alaska Software. They asked me for an example of PRG, and then they sent it back to me with the problem solved. They sent me 3 options, two of them I present to you below, and the other one I sent to you later, because I can't find it. They recommend the use of codeblocks.


// wrong: SET FILTER TO DCMONTORIG >= mont1 .AND. DCMONTORIG <= mont2



Right:

// #define USE_ISAM_FILTER


#ifdef USE_ISAM_FILTER
// Variant 1 using ISAM methodolgy

cb := "{|| DCMONTORIG >= " + Str(mont1) + ".AND. DCMONTORIG <=" + Str(mont2) + "}"
cb := &cb
DbSetFilter( cb )

#else
// Variant 2 using SQL query

oStmt := DACSqlStatement():fromChar( "select dccodigo, dcfechdocu, dcmontorig from maefactu
where dcmontorig >= ::mont1 AND dcmontorig <= ::mont2" )

oStmt:mont1 := mont1
oStmt:mont2 := mont2
oStmt:build():query()

#endif

k-insis
Posts: 94
Joined: Fri Jan 28, 2011 4:07 am

Re: How to use PGDBE in CXP programs

#10 Post by k-insis »

Hello Mr Diego

CXP is presented kinda flagship module and that it does not support PGDBE is ... bummer. And I would not rely on their "we will have 2023 Q1 a impressive improvement" statement either as it is used too lightly without action.

One addition: Mind that PGDBE is slow (compared to direct SQL connections) because on server side it relies on executing several stored procedures to implement support for recno(), indexkey() and similiar on each insert/update of records - and it is based on those special __xxxxxxx columns added to each table. It is not noticeable for small databases (up to few 100k records total), but it shows weakness on everything larger.

No such performance problems should persist with ODBCDBE or SQLexpress , and esp not when calling direct via sockets, but again not sure if ODBCDBE applies to CXP (sqlexpress should be allright imho as it is used extensively in xb2net server environments).

Greetings, MJ
Diego Euri Almanzar wrote: Wed Sep 14, 2022 12:05 am Dear friend, Slavoljub Damnjanovic

When I bought Xbase 2.0 I did it hoping to develop a web application, and that my desktop program would stop using dbf files.

I have managed to permanently remove DBFs from my desktop program. Now my program is more robust, secure, and above all faster. I don't understand the reason why reading and writing DBF files is so slow, especially in Windows 10. But well, that's another issue that is not so important, and the important thing is that I manage to update.

And, just as I am disappointed in DBFs, so I am disappointed in Alaska Software after your explanation. Since I thought that in CXP, it would also have the ease, and availability of use, of PGDBE. Since I have already advanced enough in my CXP programs, I deduced that it was the right moment to replace the driver that they recommend, which is FOXDBE, with the modern PGDBE. Your explanation is very logical, it shows the great mastery you have of the subject. You are a great programmer. It's definitely disappointing, not being able to use PGDBE.

I received an email from Alaska Software, indicating that they will have a new version for January of next year, where they highlight "impressive" improvements... But, if I can't use a safe driver like PGDBE, obviously I won't invest money in it.

Friend, remember that you owe me how to upload a PDF to the browser, through CXP. In case you can't help me, I'll try to configure a URL, from IIS, or from APACHE. I'm not good at those setups, but I'll have to learn.

Thanks.

Post Reply