PGDBE testing

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
skiman
Posts: 1184
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

PGDBE testing

#1 Post by skiman »

Hi,

I just did a test to see if the PGDBE could be an option.

I have the following test program, as you can find in the docs.

Code: Select all

#include "Common.ch"

// PostgresSQL DBE header file is required
#include "pgdbe.ch"

PROCEDURE Main
  LOCAL cConnect
  LOCAL oSession

  // Load the PostgreSQL DatabaseEngine
  IF(!DbeLoad("pgdbe"))
    Alert( "Unable to load the PostgreSQL DatabaseEngine", {"Quit"} )
    QUIT
  ENDIF

  // Establish the connection
  cConnect := "DBE=pgdbe;SERVER=localhost;DB=northwind;UID=postgres;PWD=aboservice"
  oSession := DacSession():New( cConnect )

  // Check for connection success
  IF .NOT. oSession:isConnected()
    ? oSession:GetLastMessage()
    Alert( "Unable to establish connection to server", {"Quit"} )
    QUIT
  ENDIF
  // Perform simple select and browse
  // the result set
  SELECT * FROM customers VIA (oSession)   // IMPORTANT oSession MUST be between (  )  !!!!

  Browse()

  // Up to here it is working.
  alert("Use and show name of first record")
  use customers alias klant  via PGDBE
  klant->(dbgoto(1))
  alert( klant->companyname )

  // Disconnect from server
  oSession:disconnect()
RETURN
I don't receive any error, but I don't succeed to show any data in ISAM style. The 'use customers alias klant via PGDBE' opens the database, when i Put a klant->(BROWSE()) I see the browse with correct columns but no data.
After the dbgotop of dbgoto(1), the klant->companyname remains empty.

Anyone an idea what's wrong with this?
Best regards,

Chris.
www.aboservice.be

User avatar
PedroAlex
Posts: 229
Joined: Tue Feb 09, 2010 3:06 am

Re: PGDBE testing

#2 Post by PedroAlex »

Hi,

I use to connect a remote DB.
I can add new records and consult records.
but in SQL mode.

I remember doing some tests on ISAM mode and it works ok, but very slow..

Have you tried DbAppend() and populate some records?

Regards
Pedro
Pedro Alexandre

skiman
Posts: 1184
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: PGDBE testing

#3 Post by skiman »

Hi,

Just tried the following.
klant->(dbappend()) -> this gives me an error.

Then I did the following:
dbesetdefault("pgdbe").
The I removed the VIA clause of the use.

Result remains the same.

The I tried : use customers alias klant NEW -> adding the NEW clause gives an error.

Meanwhile I tried to find more info about the PGDBE. I also checked the Alaska newsgroup. I suppose I better stop with it. I didn't read any positive comment about this driver.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4728
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: PGDBE testing

#4 Post by rdonnay »

I am not using any of the new SQL features of Xbase++ 2.0.
There are just too many problems with it.

Fortunately ADS handles ISAM and SQL very nicely and that's what I suggest for my customers.
The eXpress train is coming - and it has more cars.

User avatar
PedroAlex
Posts: 229
Joined: Tue Feb 09, 2010 3:06 am

Re: PGDBE testing

#5 Post by PedroAlex »

Hi Chris..

The future of our dbfs is SQL.
With pgdbe or without pgdbe ..
I would believe it will be with PgDbe ..
I think it would be very useful if Roger created a specific topic for PostGre SQL

Try this code:

Code: Select all


PROCEDURE Main()

LOCAL oSession
LOCAL cConnStr

DbeLoad("pgdbe")
DbeSetDefault("pgdbe")

cConnStr := "DBE=pgdbe;SERVER=localhost;"
cConnStr += "DB=northwind;UID=postgres;PWD=aboservice"

oSession := DacSession():New(cConnStr)
IF(!oSession:IsConnected())
  MsgBox("Connection failed ("+Var2Char(oSession:GetLastMessage())+")")
  QUIT
ENDIF

//MsgBox("Connected to PostgreSQL server")

// Test of Table exist
IF(!TABLE("Customers"))
   MsgBox("No Customers table")
Else
   MsgBox("Table Customers ok")
ENDIF

USE CUSTOMERS INDEX CustName ALIAS Cust NEW

Cust->( DbsetOrder(1) )
Cust->( DbGoTop() )
Cust->( Browse() )


//......


oSession:disconnect()
DbeUnLoad("pgdbe")
ReTURN

Pedro Alexandre

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: PGDBE testing

#6 Post by Auge_Ohr »

hi,

since 2012 i use PostgreSQL "native" with libpq.dll
http://bb.donnay-software.com/donnay/vi ... f=7&t=2160

If you want to use SQL i recommend to learn "real" SQL Query and not to follow Alaska ISAM Stuff.
greetings by OHR
Jimmy

skiman
Posts: 1184
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: PGDBE testing

#7 Post by skiman »

Hi,
USE CUSTOMERS INDEX CustName ALIAS Cust
I created the index on the table Customers, but now I get an error 'Order can not be found' with the operation DbSetIndex.
USE CUSTOMERS INDEX CustName ALIAS Cust NEW
Adding the NEW clause gives 'Internal data structures corrupted' on Operation DbUseArea.

Since the PG20 help manual is empty in the chapter 'Navigational Support ISAM' it is really hard to start with this.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1184
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: PGDBE testing

#8 Post by skiman »

Auge_Ohr wrote:hi,

since 2012 i use PostgreSQL "native" with libpq.dll
http://bb.donnay-software.com/donnay/vi ... f=7&t=2160

If you want to use SQL i recommend to learn "real" SQL Query and not to follow Alaska ISAM Stuff.
Hi Jimmy,

We want to use 'real SQL' and we will use it in another language. I thought to move to PostGres with Xbase++. At the same moment we can work on our new software, which could use the same database. This way our users of our software can decide when to upgrade to the new software, but can still use the old software.

It looks as this would be a nightmare, so I don't think this is the way to go.
Best regards,

Chris.
www.aboservice.be

User avatar
pedroah
Posts: 28
Joined: Wed Nov 05, 2014 7:15 pm
Location: Dominican Republic
Contact:

Re: PGDBE testing

#9 Post by pedroah »

Dear Chris

The first thing you have to do is migrating your actual table to Postgresql with the dbfupzise tool from Alaska. It needs a xml structure to do the job, here is a tool to make it

http://bb.donnay-software.com/donnay/vi ... f=7&t=1403

You can use universal sql for dbf and postgresql and work for both.

Roger have excellents samples here

http://bb.donnay-software.com/donnay/vi ... =15&t=1993

Isam is slow, but you can play making temp file dbf, xml or other, and you can move data from one source to another wherever you want.

The better thing is with a single change in compilation, you can have both version, dbf style and postgresql isam style.

The last Release have resolve issues about PostgreSQL ISAM.

A personal recommendation, SSD Disk and good amount of memory.

User avatar
cobasystems
Posts: 15
Joined: Wed Nov 12, 2014 4:44 pm

Re: PGDBE testing

#10 Post by cobasystems »

rdonnay wrote:I am not using any of the new SQL features of Xbase++ 2.0.
There are just too many problems with it.

Fortunately ADS handles ISAM and SQL very nicely and that's what I suggest for my customers.

O'Sensei Roger,
your advice is worth gold. Therefore, tell it to me.
When at last solve to start working with SQL database
What to choose:

   1. Alaska Xbase ++ 2.0 and PgSQL (min. $ 2500)
   2. Oracle 11g XE and Oracle Apex 5.1 (free)

Thank you in advance.

Post Reply