Page 1 of 2

Installation program for SqlQuery and Xdot

Posted: Wed Jul 31, 2019 5:20 pm
by rdonnay
I have created an installation program that installs Sqlquery and Xdot on any computer and does not require any installation of either Xbase++ or eXpress++. It creates an installation folder that includes all the necessary run time files.

This can be very handy because both programs (SqlQuery.Exe and Xdot.Exe) will always run regardless of the version of eXpress++ and/or Xbase++ you have installed or even if you don't have either of them installed.

The programs are built from the latest build of SqlQuery and from build 267 of eXpress++ (to be released soon).

http://bb.donnay-software.com/sqlquery/sqlquery20.exe

Re: Installation program for SqlQuery and Xdot

Posted: Wed Jul 31, 2019 9:54 pm
by Auge_Ohr
hi,

will it work with PostgreSQL ODBC Driver found here :?:
https://www.postgresql.org/ftp/odbc/versions/msi/

i guess 32 Bit ODBC Version is need, or :?:

---

got it working :dance:
WOW that GREAT :clap:
PG_ODBC.JPG
PG_ODBC.JPG (215.85 KiB) Viewed 17001 times

Re: Installation program for SqlQuery and Xdot

Posted: Thu Aug 01, 2019 5:25 am
by rdonnay
I have tested it with the Devart PostGreSql ODBC driver but had some problems with other drivers.

This is not any problem with SqlQuery, but is a problem with the ODBCDBE.

Which PostGreSql driver are you using and which version of PostGreSql Server are you using?

Re: Installation program for SqlQuery and Xdot

Posted: Thu Aug 01, 2019 1:09 pm
by Auge_Ohr
hi,
rdonnay wrote:I have tested it with the Devart PostGreSql ODBC driver but had some problems with
Which PostGreSql driver are you using and which version of PostGreSql Server are you using?
i use PostgreSQL v9.5 with PgAdmin3 (as EXE) while since v9.6 PgAdmin4 is a Web App.

ODBC Driver (psqlodbc_09_05_0400-x86.zip -> psqlodbc_09_05_0400-x86.zip) are from this Website
https://www.postgresql.org/ftp/odbc/versions/msi/

Re: Installation program for SqlQuery and Xdot

Posted: Thu Aug 01, 2019 2:10 pm
by rdonnay
Your screen shot shows that you are using the PGDBE and not the ODBCDBE, therefore your ODBC driver is not being used.

Re: Installation program for SqlQuery and Xdot

Posted: Thu Aug 01, 2019 5:20 pm
by Auge_Ohr
rdonnay wrote:Your screen shot shows that you are using the PGDBE and not the ODBCDBE, therefore your ODBC driver is not being used.
hm ... do you mean "Alaska-Software" Table :?:

these Table and Trigger are not create by "UpSize".
i use libpq.dll native (Demo Phil Ide) to import DBF to PostgreSQL Table.

how can i test if ODBC is used :?:

Re: Installation program for SqlQuery and Xdot

Posted: Thu Aug 01, 2019 6:03 pm
by rdonnay
Table and Trigger are not create by "UpSize".
I learned that UpSize is not required when adding tables to a PostGreSql database that is used by PGDBE.

The additional fields and tables added by DbfUpSize are only there for ISAM emulation, and an upsized table still performs badly in ISAM mode. Record numbers, Record count, etc. are not always reliable. If I were to create a new project using PostGreSql I think that PGDBE would be a fine database engine if only SQL was used.

I added a lot of tables to my 8.3 PostGreSql installation using the import routine of SqlQuery using the below procedure.
This procedure works with ADSDBE, ODBCDBE or PGDGE, whichever is bound to <oSession>. Try opening some of your tables in SQL mode and then ISAM mode. You can put the windows side by side. They will be opened in new threads. Then you can make comparisons. Press the Alt-D key to get a dot prompt so you can use database navigation commands.

Code: Select all

STATIC FUNCTION _ImportDBF( cTable, cTargetName, self )

LOCAL aStruct, aStructNew, i, aTableType, lGoodUse, bError, ;
      oSession := ::sessionDict, cPath, cSavePath := DC_CurPath(), ;
      GetList[0], oProgress, oDlg, nCount, nEvery, nRecCount, ;
      cVia, lCancelled := .f.

aTableType := DC_DbeType(cTable)

IF 'DBF' $ aTableType[3]
  cVia := 'DBFDBE'
ELSEIF 'ADS' $ aTableType[3]
  DbeSetDefault('ADSDBE')
  DbeInfo( COMPONENT_DATA, ADSDBE_TBL_MODE, ADS_CDX )
  DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADS_CDX )
  DbeInfo( COMPONENT_DATA, ADSDBE_TABLENAME_IS_ALIAS, .f. )

  cPath := DC_Path(cTable)
  cVia := ::AdsSessionCreate(cPath)
  cTable := DC_Path(cTable,.t.)
  DC_ChDir(cPath)
ELSEIF 'FOX' $ aTableType[3]
  cVia := 'FOXDBE'
ELSE
  DC_WinAlert( 'Unknown Database Type' )
  RETURN .f.
ENDIF

bError := ErrorBlock({|e|_Break(e)})
BEGIN SEQUENCE
lGoodUse := .f.

USE (cTable) ALIAS SOURCE EXCLUSIVE VIA (cVia)
lGoodUse := .t.
END SEQUENCE
ErrorBlock(bError)

IF !lGoodUse
  DCMSGBOX 'Error opening file: ' + cTable FONT '10.Lucida Console'  ;
     OWNER AppDeskTop()
  RETURN .f.
ENDIF

aStruct := DbStruct()
IF cTargetName = NIL
  cTargetName := cTable
ENDIF
cTargetName := MakeSqlTableName(cTargetName)
aStructNew := AClone(aStruct)

IF ::type = 'ODBC'
  AEval(aStructNew, {|e,i| aStructNew[i][1] := MakeSqlFieldName(aStructNew[i][1],oSession) })
  AEval(aStructNew, {|e,i| aStructNew[i] := MakeSqlFieldType(aStructNew[i], oSession) })
ENDIF

bError := ErrorBlock({|e|_Break(e)})
BEGIN SEQUENCE
lGoodUse := .f.

DbCreate(cTargetName, aStructNew, oSession)
USE (cTargetName) EXCLUSIVE VIA (oSession) ALIAS TARGET NEW
lGoodUse := .t.
END SEQUENCE
ErrorBlock(bError)

IF !lGoodUse
  DCMSGBOX 'Error creating table: ' + cTargetName FONT '10.Lucida Console' ;
     OWNER AppDeskTop()
  RETURN .f.
ENDIF

@ 0,0 DCSAY 'Creating table: ' + cTargetName

@ 2,0 DCPROGRESS oProgress SIZE 80,1 PERCENT COLOR GRA_CLR_CYAN, GRA_CLR_WHITE

@ 4,0 DCPUSHBUTTON CAPTION 'Cancel' SIZE 10,1.2 ;
      ACTION {||lCancelled := .t.}

DCREAD GUI FIT TITLE 'Importing Data' PARENT @oDlg EXIT

nRecCount := SOURCE->(RecCount())
nEvery := Int(nRecCount/200)
IF nEvery > 5000
  nEvery := 5000
ENDIF

nCount := 0
DO WHILE !SOURCE->(Eof()) .AND. !lCancelled
  nCount++
  IF nCount%100 == 0
    DC_CompleteEvents()
  ENDIF
  IF nEvery > 0 .AND. nCount%nEvery == 0
    DC_GetProgress(oProgress,nCount,nRecCount)
  ENDIF
  TARGET->(DbAppend())
  FOR i:= 1 TO TARGET->(Fcount())
    TARGET->(FieldPut(i, SOURCE->(FieldGet(i))))
  NEXT
  SOURCE->(dbSkip())
ENDDO
TARGET->(DbCommit())
SOURCE->(dbCloseArea())
TARGET->(dbCloseArea())

IF Valtype(cVia) == 'O'
  cVia:disconnect()
ENDIF

IF !lCancelled
  DCMSGBOX 'Done. ', ;
         'Table: ' + cTargetName + ' was created in Database: ' + ::database ;
         FONT '10.Lucida Console' OWNER AppDeskTop()
ENDIF

oDlg:destroy()

DC_ChDir(cSavePath)

RETURN .T.

Re: Installation program for SqlQuery and Xdot

Posted: Thu Aug 01, 2019 8:57 pm
by Auge_Ohr
about PG-ODBC
i have installed ODBC Driver and add "PostgreSQL30 ANSI" to Datasource.
PostgreSQL30.JPG
PostgreSQL30.JPG (109.19 KiB) Viewed 16972 times
when double-Click in Treeview on "PG Test1" i got a XppFatal.LOG
XPPFATAL.ZIP
(543 Bytes) Downloaded 820 times
it work with Menu -> ODBC Drivers -> postgreSQL ANSI -> double-Click -> connect
than i can click in Treewiew on "PG Test1"

Re: Installation program for SqlQuery and Xdot

Posted: Fri Aug 02, 2019 6:15 am
by rdonnay
That error doesn't make sense.

Code: Select all

IF !('PGDBE'$aDbeList) .AND. !DbeLoad( "PGDBE",.f.)  <<<<<<<<<<<<<<<<<<<  XPPFATAL.LOG error
  DC_WinAlert('Database-Engine PGDBE not loaded')
  RETURN .f.
ENDIF
Adding the new ODBC driver should have had no effect because PGDBE doesn't use ODBC drivers.

If you want to use the ODBC driver, you need to create a new connection:

You can added it to your SQLQUERY.INI file or you can click on Create New Connection from the menu.

Code: Select all

[ODBC_4]
Name=PostGreSQL ANSI
Driver={PostgreSQL ANSI}
Uid=<your user id>
Pwd=<your password>
Database=<your database>
After adding it your your SQLQUERY.INI file, click on restart Sqlquery.exe from the menu.

If you have Teamviewer or Skype, I would like to arrange a time that I can connect to you and see if we can make this work for you.
Early in the morning works best for me. We have an 8 hour time difference. 8 am here is 4 pm in Germany.

Re: Installation program for SqlQuery and Xdot

Posted: Fri Aug 02, 2019 10:34 am
by Auge_Ohr
rdonnay wrote:That error doesn't make sense.

Code: Select all

IF !('PGDBE'$aDbeList) .AND. !DbeLoad( "PGDBE",.f.)  <<<<<<<<<<<<<<<<<<<  XPPFATAL.LOG error
  DC_WinAlert('Database-Engine PGDBE not loaded')
  RETURN .f.
ENDIF
Adding the new ODBC driver should have had no effect because PGDBE doesn't use ODBC drivers.
i understand
rdonnay wrote: If you want to use the ODBC driver, you need to create a new connection:

You can added it to your SQLQUERY.INI file or you can click on Create New Connection from the menu.

Code: Select all

[ODBC_4]
Name=PostGreSQL ANSI
Driver={PostgreSQL ANSI}
Uid=<your user id>
Pwd=<your password>
Database=<your database>
After adding it your your SQLQUERY.INI file, click on restart Sqlquery.exe from the menu.
that is what i have done before

Code: Select all

[PG_1]
Type=PG
Name=PG Test1
Driver=
Server=localhost
Database=mdidemo
UID=***
PWD=***
ConnectTimeOut=0
i see the Difference @Driver=

when create a new Connection i can't type into Field "Driver" while it is disable.
i add ={PostgreSQL ANSI} but still the same