SqlQuery.exe (a new database query tool)

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4728
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

SqlQuery.exe (a new database query tool)

#1 Post by rdonnay »

SqlQuery.Exe is a tool written entirely in Xbase++ using eXpress++.

The Query tool allows a user to make multiple connections to ADS, ODBC or PostGreSQL data sources.
You don't need to know anything about SQL to use this application to query all of your data tables.

A tree view window displays the tables, fields, views and index info for each data connection.

It allows you to browse data in ISAM or SQL SELECT mode.
You can pick fields (columns) to browse then filter the data using a new feature built into the
eXpress++ DCBROWSE system that takes advantage of SQL WHERE clauses for fast filtering
and ORDER BY for sorting.

You can tag rows and columns for printing or exporting to Excel.

You can execute Views that are already in the data source or create your own views using SQL
commands and save them to the SqlQuery view dictionary.

These features can also be built into your own applications and work with workareas or arrays
of data objects.

You do not need to use ADSDBE, ODBCDBE or PGDBE in your applications to use this SQL capability
in your applications if you are using .DBF/.CDX files. You only need the free ADS client DLLs which
are in the runtime folder of the Xbase++ Professional Version. (Ace32.dll,Axcws32.dll,AdsLoc32.dll)

You do not need to create an Ads Data-Dictionary to use this capability because SQL queries can be
made against a set of free tables. However, if you want to create a data-dictionary you don't need
the Ads Architect to do this. It can be created in SqlQuery.Exe.

Here is a testimonial:

"SF had a result they could not find from CRL on 12/11/18. I used SqlQuery
and located the record easily. It worked as expected and I was able to see
that it was marked done which is why it wasn't showing in drreview.exe. But
it wasn't showing in drmove.exe as being moved.

I did all of this using SqlQuery. Really good tool!"

Richard Covington - Behavioral Health Systems, Inc.


SqlQuery.Dll can be used in your own applications.

There is no documentation at this time but the source code is included.

There are 2 new classes that are used as sub-classes of the DC_XbpBrowse() system.
They will be documented in eXpress++ build 267 and there will be plenty of samples.
Integrating this feature into your own browses requires only adding a few lines of code
to your DCBROWSE commands. The name of the sub-classes are DC_XbpBrowseFiltered()
and DC_XbpColumnFiltered(). Look in the SqlQuery.Prg file to see how they are used.

I am providing this to all eXpress++ users who have the Xbase++ Professional Subscription
because I want some more beta-testers before releasing build 267.

If you want to use SqlQuery.exe with PostGreSql you can use a PGDBE connection or an
ODBCDBE connection. For ODBC, I recommend that you install the following free
ODBC driver: Devart ODBC Driver for PostgreSQL

It is recommended that you create a new folder named SqlQuery and unzip SqlQuery.zip
into that folder.

http://bb.donnay-software.com/sqlquery/sqlquery.zip

This file will be updated on a regular basis as new features and bug fixes are added.

Run SqlQuery.Exe.
It will load SqlQuery.Ini and connect to all of your data sources.

This has been tested with the following data sources:

ODBCDBE - Sql Server
ODBCDBE - MySql ODBC 8.0 Unicode Driver
ODBCDBE - Advantage StreamlineSQL ODBC
ODBCDBE - Devart ODBC Driver for PostGreSql
ODBCDBE - PostgreSQL Unicode
ADSDBE - Connection to Data Dictionary (DBF/CDX/ADT) (Remote and Local)
ADSDBE - Connection to Free Tables (DBF/CDX) (Remote and Local)
PGDBE - Connection to PostGreSQL server

I anticipate that release by April 2019.

As of now this is a query tool only.
It does not allow SQL statements that can change your data.
If you use Advantage Architect or Sql Server Manager for queries, you will find this to
be much more useful. Right-click a browse column header to set a range for that column.
Left-click a browse column header to sort on that column.

If you need help getting started, make a posting on the forum or Skype me at roger.donnay.

This is an example of how to setup connections to data sources in SqlQuery.Ini:

Code: Select all

[SYSTEM]
TreeFont=10.Lucida Console
ShowBrowseCautionMessages=No
TreeFGColor=1
TreeBGColor=0

[ODBC_1]
Name=MyFireRules (BillingFD)
ConnectString=
Driver={SQL Server}
ServerDict=DESKTOP-O5IFT5O\SQLEXPRESS
Database=BillingFD
UID={||GetEnv('BILLINGFD_UID')}
PWD={||GetEnv('BILLINGFD_PWD')}
ConnectTimeOut=15

[ODBC_2]
Name=Behavioral Health (HippaSuites)
ConnectString=
Driver={SQL Server}
ServerDict=DESKTOP-O5IFT5O\SQLEXPRESS
Database=HippaSuites
UID=
PWD=
ConnectTimeOut=15

[ODBC_3]
Name=MySql (Donnay Web Forum)
ConnectString=FileDSN=c:\SqlQuery\MySql.dsn
ConnectTimeOut=15

[ODBC_4]
Name=Advantage ODBC (BhsTest)
Driver={Advantage StreamlineSQL ODBC}
ConnectTimeOut=15
UID=AdsSys
Database=C:\bhs\bhsmed.add
ConnectString=ServerTypes=2

[ODBC_5]
Name=Advantage ODBC (Medallion)
Driver={Advantage StreamlineSQL ODBC}
ConnectTimeOut=15
UID=AdsSys
Database=C:\medalion\medalion.add
ConnectString=ServerTypes=2

[ADS_1]
Name=Medallion (Medalion.add)
Database=C:\Medalion\medalion.add
ServerFree=C:\Medalion\
AdsLockingType=1
UID=AdsSys

[ADS_2]
Name=Medallion (Free Tables)
ServerFree=c:\medalion
AdsLockingType=1

[ADS_3]
Name=BHS (BhsTest.add)
UID=AdsSys
Database=C:\bhs\bhstest.add
ServerFree=C:\bhs\
AdsLockingType=0

[ADS_4]
Name=BHSServices (c:\bhsservices)
ServerFree=C:\bhsservices\
AdsLockingType=0

[ADS_5]
Name=Sample Program (SqlTest1)
ServerFree=c:\expd20\samples\adssql\files\data\
AdsLockingType=0

[ADS_6]
Name=Meter Shop
ServerFree=c:\meter
AdsLockingType=1

[ADS_7]
Name=DD-787 Ship's Roster
ServerFree=y:\wamp64\www\dd787
AdsLockingType=0

[ADS_8]
Name=Drugs (Free)
ServerFree=c:\drugs
AdsLockingType=0

[ADS_9]
Name=SQL Test (Ads Free)
ServerFree=c:\expd20\samples\adssql\files\data
AdsLockingType=0

[ADS_10]
Type=ADS
Name=Jack SQL
Database=c:\test\jacksql\RecreaNet.add
ServerFree=c:\test\jacksql\
UID=
PWD=
ConnectTimeOut=15
AdsLockingType=0
AdsTableType=2

[ADS_11]
Name=Meter (SqlQuery.add Dictionary)
UID=AdsSys
Database=C:\meter\sqlquery.add
ServerFree=C:\meter\
AdsLockingType=1

[ADS_12]
Database=c:\drugs\SqlQuery.Add
Name=c:\drugs\SqlQuery.Add
UID=AdsSys
AdsLockingType=0
AdsTableType=2

[PG_1]
Name=Northwind (PostGreSql)
ConnectString=
ServerDict=localhost
Database=northwind
UID=postgres
PWD={||GetEnv('POSTGRESQL_PASSWORD')}

[PG_2]
Name=Medallion (PostGreSql)
ConnectString=
ServerDict=localhost
Database=medallion
UID=postgres
PWD={||GetEnv('POSTGRESQL_PASSWORD')}
The is a field picker to help create quick queries.  16 different data sources are shown in the tree view.
The is a field picker to help create quick queries. 16 different data sources are shown in the tree view.
SqlQuery1.JPG (178.42 KiB) Viewed 20263 times
This is a SELECT statement saved as a VIEW to be executed at any time.
This is a SELECT statement saved as a VIEW to be executed at any time.
SqlQuery2.JPG (196.15 KiB) Viewed 20263 times
This is the resultant browse of a pre-defined view - DTR End of Year Report
This is the resultant browse of a pre-defined view - DTR End of Year Report
SqlQuery3.JPG (284.87 KiB) Viewed 20263 times
This screen shows how columns can be tagged for exclusion, exporting or printing.
This screen shows how columns can be tagged for exclusion, exporting or printing.
SqlQuery4.JPG (283.71 KiB) Viewed 20263 times
This screen shows how 3 columns were filtered to reduce down to only 42 rows.
This screen shows how 3 columns were filtered to reduce down to only 42 rows.
SqlQuery5.JPG (262.71 KiB) Viewed 20263 times
The eXpress train is coming - and it has more cars.

danielF
Posts: 5
Joined: Tue Feb 12, 2019 7:58 am

Re: SqlQuery.exe (a new database query tool)

#2 Post by danielF »

Hi Roger...

I'm using your tool...
I've configured the ini file and it works perfect...

I will try... and learn more about SQL, I have to migrate an app to PostGreSQL and this tool will help me.

Thank you
King Regards

Daniel

richardc
Posts: 21
Joined: Sat May 11, 2013 3:46 pm

Re: SqlQuery.exe (a new database query tool)

#3 Post by richardc »

Roger has done an excellent job writing this tool. I am using it for MS-SQL Server, ADS Dictionary and ADS free connections.

I use the stand alone SqlQuery.exe daily for routine work. Saving queries either as views or .sql files for later retrieval is a one of the features I like the most.

I have also incorporated it in my main application browses. It has already paid off in terms of not having to write special reports/queries for my users. Users can now simply right mouse on any column and define top and bottom values. Report done, and I didn't have to write one line of code.

Roger's tool deserves a look from everyone.

Thanks Roger!

Richard Covington
Behavioral Health Systems.

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

Re: SqlQuery.exe (a new database query tool)

#4 Post by rdonnay »

I just improved performance when expanding a connection in the Tree View.
It will build the sub-branch of TABLES much faster now because it doesn't build the FIELDS and VIEWS sub-branches unless they are double-clicked the first time.

http://bb.donnay-software.com/sqlquery/sqlquery.zip.
The eXpress train is coming - and it has more cars.

User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: SqlQuery.exe (a new database query tool)

#5 Post by digitsoft »

Excellent Roger Tool, and it works for Alaska 1.9 and 2.0

rdonnay wrote:I just improved performance when expanding a connection in the Tree View.
It will build the sub-branch of TABLES much faster now because it doesn't build the FIELDS and VIEWS sub-branches unless they are double-clicked the first time.

http://bb.donnay-software.com/sqlquery/sqlquery.zip.
Nolberto Paulino
Regards

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

Re: SqlQuery.exe (a new database query tool)

#6 Post by rdonnay »

Excellent Roger Tool, and it works for Alaska 1.9 and 2.0
I hadn't tested it with 1.9.
It will take changes to the code to make it work with 1.9.
It won't even compile yet.
I will need to add some conditional compiling.

Also, I don't see how the browses can work unless you have the latest DCLIPX.DLL compiled in Xbase++ 1.9.
I did not include that in SqlQuery.Zip.
Are you sure that you can browse ?

I'm guessing that the ADSDBE and ODBCDBE have not changed much since 1.9.

Of course PGDBE connections will not work with 1.9, but if the user wants to use PostGreSQL with 1.9 all they need to do is use the Devart ODBC driver.
The eXpress train is coming - and it has more cars.

User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: SqlQuery.exe (a new database query tool)

#7 Post by digitsoft »

Thank you
Roger
rdonnay wrote:
Excellent Roger Tool, and it works for Alaska 1.9 and 2.0
I hadn't tested it with 1.9.
It will take changes to the code to make it work with 1.9.
It won't even compile yet.
I will need to add some conditional compiling.

Also, I don't see how the browses can work unless you have the latest DCLIPX.DLL compiled in Xbase++ 1.9.
I did not include that in SqlQuery.Zip.
Are you sure that you can browse ?

I'm guessing that the ADSDBE and ODBCDBE have not changed much since 1.9.

Of course PGDBE connections will not work with 1.9, but if the user wants to use PostGreSQL with 1.9 all they need to do is use the Devart ODBC driver.
Nolberto Paulino
Regards

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

Re: SqlQuery.exe (a new database query tool)

#8 Post by rdonnay »

I updated SqlQuery.Zip to allow SqlQuery.Prg to compile with Xbase++ 1.9

The SqlQuery.exe and SqlQuery.dll included in this distribution were compiled
in Xbase++ 2.0. If you want an Xbase++ 1.9 version, then just run
PBUILD SqlQuery.Xpj with your 1.9 installation. The PostGreSQL (PGDBE) connections
will not work with Xbase++ 1.9. You will also need to rename DCLIPX.DLL.19 to
DCLIPX.DLL.

http://bb.donnay-software.com/sqlquery/sqlquery.zip
The eXpress train is coming - and it has more cars.

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

Re: SqlQuery.exe (a new database query tool)

#9 Post by rdonnay »

More improvements to SqlQuery.

A custom, filtered query browse can now be exported to a database as well as to Excel or CSV file.

Even if you have an ODBC connection and build a complex query, that data can be saved to a FOX / ADS compatible database.

This is better than using the INTO clause of the SELECT statement because it can be done post hoc.
For example, I was given the job of building 7 queries that took over 15 minutes each to build each cursor because they were so complicated. I then exported the query result to a Fox compatible database and a CSV file in a few seconds.

http://bb.donnay-software.com/sqlquery/sqlquery.zip
The eXpress train is coming - and it has more cars.

Volker
Posts: 5
Joined: Sun Mar 14, 2010 9:01 am

Re: SqlQuery.exe (a new database query tool)

#10 Post by Volker »

Hello Roger,

i can't start SqlQuery.exe, because "OdbcUt10.dll" is not available.

Is this a file from the professional edition?

Regards
Volker

Post Reply