The CHT Blogger

Thanks for your interest in The Clarion Handy Tools, an awesome collection of productivity enhancements for Clarion developers. These tools consist of an ever-expanding set of Clarion Templates and OOP Classes that extend or complement the normal functionality of the Clarion Application Development System from SoftVelocity.

Wednesday, July 2, 2008

About Optimize For SQL Option

Just a reminder that those of you with SQL apps, should be taking a look at the JULY 1, 2008 what's new page: What's New July 2008 to read about the new option switch called "Optimize For SQL" found on the "Use SQL" dialog of ExplorerBrowse and HandyMarkerBrowse (soon als implemented on LocatorOverrideControl).

For a while now, I'd been noticing that under certain conditions C6 SQL apps produced more than one SELECT statement per browse query or per browse order change. In theory to change browse order to descending from ascending, one would issue the identical select statement with a DESC following the fields in the ORDER BY clause.

What I was seeing, in reality, was this:
• When the browse queue was empty, the browse produced generally one or two select statements per new query, one select statement to issue the select that filled the browse and one select to reget the currently selected record into the record buffer (to honour the new selection event).

• When the browse queue had records already in it, the browse produced generally 3 or 4 select statements per new query. One select statement to fill the browse forwards from the currently selected record; One select statement to fill the browse backward from the currently selected record; One select statement to fetch the currently selected record into the record buffer. And sometimes a fourth select was issued if the fill-forward or fill-backward phases, bumped into the end of file or beginning of file condition. This wonky behaviour is supposed to be controlled by setting the RetainRow driver flag off in the ABC classes. Even SV's documentation recommends that retain row be turned off for SQL, yet the current crop of C6's behave as if retain row is on even when it's off. That behaviour is hard coded into the ABC BrowseClass INIT method.

In earlier iterations of Clarion, I'd spent quite a lot of time getting Clarion ABC browses to "cut the chatter" to the point that a single select per browse query or per browse order change was issued. I don't know when C6 ABC classes and templates changed to wrestle away the well controlled ABC-browse situation we'd had till that point, but they did, somewhere along the way.

The "Optimize For SQL" switch on our browse templates, lets you optimize your browse so that only a single select is issued for any new browse condition such as a query change or an order change. I suggest you compare this yourself on your own SQL apps, using HNDSQLTRACE.APP to trace various browses with and without the "Optimize For SQL" switch turned on.

Cheers...
Gus Creces
The Clarion Handy Tools Page
Visit Website

About HNDSQLTRACE.APP 2.01

Earlier today I uploaded HNDSQLTRACE Version 2.01. This has the following new features:

• The ability to have a File Based Trace (will trace any C6 Clarion SQL App).

• The ability to have Direct-From-App Trace (requires other CHT template applied to traget procedure). There's a menu item to set to one or the other of the above two settings.

• The buttons have been removed from the tool bar and have been replaced with menus. Three of the key menu items have now been given System Hot Keys. F9 (Clear) F10 (Read Next) F11 (Minimize/UnMinimize). The advantage of these system hot keys is that the trace app does not have to have focus for you to apply these commands to it.

• There's an entry control now on the tool bar that when doing a file trace, any table name entered in here is filtered out of the trace, so that if you have SQL stuff appearing in the trace, say from something like INIFile, you can have the trace extract them by entering INIFile in the field provided.

At the moment, the Direct-From-APP trace is transmitted only when you apply HandyQueryTracingButton_EXPB (for ExplorerBrowse) or HandyQueryTracingButton_HNDMB (for HandyMarkerBrowse) on your browse. You can see how I've applied these, and test the Direct-From-App tracing feature on demo apps HNDSQL7.APP and HNDSQL8.APP.

In the next iteration, perhaps as early as the beginning of next week, I'm going to add a dialog on our browse templates that let's you opt to have the browse intercept trace on/off commands directly from HNDSQLTRACE. A hot key in the trace app will send a command to the Browse Procedure to have it turn on it's tracing communications and to start talking to HNDSQL trace.

Cheers...

Gus Creces
The Clarion Handy Tools Page
Visit Website

Tuesday, July 1, 2008

CHT Changes Posted To WEBUPDATER July 1, 2008

We've posted another update on the road to Build 12C1.00 at the end of July, 2008.

This adds another new locator: HandyMarkerBrowseLocatorControlEx which has the same features for HandyMarkerBrowse that we introduced last time for ExplorerBrowse. There are also two new demo applications that apply these locators. They are HNDSQL7.APP - illustrating ExplorerBrowseLocatorControlEX - and HNDSQL8.APP - illustrating HandyMarkerBrowseLocatorControlEX.

The new demo applications implement an optional new feature available on the "Use SQL" tab of the two templates, ExplorerBrowse and HandyMarkerBrowse. This feature optimizes the SQL select statement and cuts down the chatter. Use HNDSQLTRACE.APP on the two demo apps and you'll see the difference when you run the trace first with the "Optimize For SQL?" switch on and then recompile and trace with the switch off. Let us know what you think, this totally eliminates the secondary selects that Clarion browses normally perform as they try and backfill to the currently selected record.

HNDSQLTRACE.APP has been changed. Compile and use HNDSQLTRACE.APP to test the two new apps by setting HNDSQLTRACE so that "Direct Trace On/Off" is checked.

This new feature lets you drop a HandyQueryTracingButton_EXPB or HandyQueryTracingButton_HNDMB directly on your browse, as we have in HNDSQL7.APP and HNDSQL8.APP, respectively. These button templates cause the procedure on which they're applied to communicate directly with HNDSQLTRACE.APP.

Cheers...
Gus M. Creces
The Clarion Handy Tools Page
gcreces@cwhandy.com

Sunday, June 29, 2008

CHT Changes Posted To WEBUPDATER June 27, 2008

We posted some changes to CHT WEBUPDATER June 27, 2008. This was not done as a version change for the time being, as the basic CHT classes and templates have not changed from the 12B1.01 which you've had since May 22, 2008.

At least until the end of July 2008, which is our target date for the release of build 12C1.00, there are going to be fairly frequent periodic updates without version number changes in order to introduce some new templates into the system so that an SQL project I'm working on can make use of them. You can feel comfortable downloading this un-reversioned update since it does not affect existing templates and classes that you've already been using. And it will give you a chance, if you're interested, in getting a preliminary look at some new templates,many of which are going to be targeted at SQL.

In this upload is a new template called ExplorerBrowseLocatorEx. This is an expanded version of ExplorerBrowseLocator (hence the "EX" suffix) that adds some features:

•  A "Go" button beside the locator to execute the locator. (Tab still works as before).

•  An automatic pass-through of the browse's "Data With Query Only" feature when the locator is set up as a filtering locator. This does work in the previous locator, but not if you've embedded your own filter into the browse. This new control lets you embed your own filter in the browse's ApplyFilter method, and still enforce "Data With Query Only" so that nothing displays unless the locator has been used.

•  There is a more sophisticated algorithm for "Drill-Down" in this locator, including a "bread-crumbs" string control that displays the current query, either as SQL or as CHT Query language. This works like "QBE", or "Query By Example" if you set the locator for "Drill-Down" since you can filter on multiple columns one after the other just by clicking on them and entering a new value in the locator. The new query is ANDed to the previous one until you click the Clear button.

Also coming for this new locator - when in filtering mode - is the ability to define on a column-by-column basis what the query keyword is for that column. So, a date or numeric column can use EQUAL while a text column can use CONTAINS.

There will be an equivalent locator for HandyMarkerBrowse early in July.

We're also working on a new SQL trace feature for CHT browses using HNDSQLTRACE.APP. This isn't available yet in the June 27th posting. The next HNDSQLTRACE.APP will have a filter feature that lets you trace a particular table or exclude a particular table. You'll also be able to direct output from our other SQL trace features, for example HandyQueryTracingButton_EXPB into HNDSQLTRACE.APP and a new option on that template lets you opt to see the entire SQL select including WHERE and ORDER BY.

More SQL-related features coming. I'll tell you about those as they are introduced and uploaded for you to try. We're about ready to release an "Experimental" switch on all CHT browse extension templates. This feature optimizes your CHT-extended ABC browse for SQL by overriding some of the ABC browse features that were really intended for ISAM tables and get in the way of SQL.

We're calling this "Experimental" because it's not default behavior, you have to turn this setting on to invoke the features set. We're going to let you try this feature on your browses for a while by way of an "experiment". Primarily it reduces the amount of SQL "chatter" that ABC browses - especially page loaded browses - tend to produce and slows them down. We'll be looking for your feedback on the impact of this on your SQL browses and, of course, we're prepared to take your questions and suggestions for improvements.

Cheers...
Gus M. Creces
The Clarion Handy Tools Page
http://www.cwhandy.ca

New SQL Trace Tool - HNDSQLTRACE.APP

We've got a new SQL trace tool for you to try. It's called HNDSQLTRACE.APP. This application is designed to help you with your SQL application development projects by assisting with easy SQL tracing.

Start tracing by configuring the specific driver(s) used by your SQL application followed by a click on the "Minimize" button. Once HNDSQLTRACE.APP starts, then start your SQL application.

Navigate in your SQL application to the specific area to be tested and bring HNDSQLTRACE.APP back up using the windows task bar icon menu provided.

When HNDSQLTRACE.APP re-appears all SQL statements executed to that point are displayed in reverse chronological order, with newest statements at the top. From this point forward, to trace specific actions, click the "Clear" button and interact briefly with your SQL application. Click the "Read Next" button to view the most recent SQL activity raised by your application. Repeat as necessary.

This is the first of a number of SQL-related features and improvements you'll see added to CHT in the upcoming months. There's a video explaining how to use it located on our Video Education page.

For a direct link to the video click here: CHT SQL Trace.

Cheers...

Gus Creces
The Clarion Handy Tools Page
http://www.cwhandy.ca

Saturday, May 24, 2008

Build 12B1.01 - Update Posted

On May 22, 2008 we posted some changes for the 12B1.00 Build. This includes one new demo app, a new video, and some low-level additional code that warrants a version number change (to 12B1.01). The low-level code additions are in preparation for some new templates coming for the 3rd quarter build so we won't discuss the specifics of that in the context of this sub-release of the second quarter build.

However, we do want to focus some attention on the new demo app called HNDSQLTRACE.APP since it has the potential to be extremely useful to those of you who write SQL applications using Clarion 6. The application's splash screen and the video available from it's About menu explain in considerable detail how the application works and what benefit it is designed to provide. We'll let those things do the talking to tell you about HNDSQLTRACE.APP. Here are the links: HNDSQLTRACE.APP Information and HNDSQLTRACE.APP Video

Cheers...
Gus M. Creces
The Clarion Handy Tools Page
http://www.cwhandy.ca/

Friday, May 16, 2008

Build 12B1.00 - Minor Update Posted

I've posted some changes for the 12B1.00 Build, to fix some reported problems since the May 1st posting. These changes are minor and do not warrant a version number change.

The ABCBrowseRecordTaggerEx template should work correctly now with either hot key, MouseLeft or MouseLeftUp. In the prior release, the ABCBrowse would not select correctly when the hotkey used was MouseLeft. It did work correctly with MouseLeftUp. I've changed the hotkey selection mechanism on all XXXRecordTaggerEx templates to a dropdown from the built-in template alert key mechanism which does not provide for the easy insertion of MouseLeftUp as a standard alert key.

I could not reproduce the Calculator problem reported here by one user no matter where I tried it, so I think that may be isolated to the fact that he was using an older Clarion 6 version. The threaded calculator uses an ANY variable as the data transfer mechanism across threads and I've added an explicit CLEAR to initialize that variable. Earlier versions of Clarion 6 did require this, though the present version does not, since ANY variables are now implicitly initialized by Clarion itself.

Terry I've posted with this update the HNDSTRLB.CLW changes that you requested in these two functions:


HndStrLib.CStringToWideString PROCEDURE (*CSTRING xIn, *STRING xpOut, LONG xCodePage=0)
HndStrLib.WideStringToCString PROCEDURE (LONG xlWide, *CSTRING xOut, LONG xCodePage=0)


These functions work as before if you do nothing. However, you can now add a 3rd parameter providing a code-page value to have the correct code-page translation applied if you supply the code-page number. I've added specific CHT equates to handle the code-pages you asked about:


HND_CP_UTF8 EQUATE (65001) ! UTF-8 translation
HND_CP_GB2312 EQUATE (936) ! Chinese Simplified
HND_CP_Big5 EQUATE (950) ! ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5)


You should be able to use any code-page number or combination in the 3rd parameter as required by the language in use.

Terry, since I haven't got any reliable way to test this myself, I'm relying on you for feedback as to whether this works to your satisfaction.

I've included fresh copies of all pre-compiled apps located in /3rdparty/hnd/ including HNDSCRPT.EXE since I neglected to do that in the last update. Also included are the following apps compiled with the latest version of C7: HNDZIPNFTP.EXE, HNDZIPNEMAIL.EXE and HNDHTTPZIPNPOST.EXE. These are supplied purely as a reminder that CHT is fully C7 compatible.

Take a look also at HNDCMP.EXE - the CHT Compile Manager - since it now implements a couple of the new templates: HANDYMARKERBROWSEROWMOVEBUTTONS and HANDYMARKERBROWSERECORDTAGGEREX.

In the prior release, a few of the demo apps had dictionary paths embedded in them. If I'm not careful to remove the dictionary path from our demo apps, those of you with clarion installed somewhere other than c:/clarion6/ can have problems compiling the demo apps. I've gone through all demo apps to make sure that dictionary paths were removed so all apps assume that the .DCT is located in the same directory as the application itself. This is how it's supposed to work.

Cheers...
Gus Creces
The Clarion Handy Tools Page
Visit Website