Saturday, October 20, 2007

Dave Terry's Odyssey with 4D v11 SQL

Dave Terry of PDM gives talk on 4D v11 at 4D SummitThese are notes from the "Dave Terry's Odyssey with 4D v11 SQL" presentation given by Dave Terry of PDM at 4D Summit 2007.

(After 35 minutes of A/V problem Dave had to switch his presentation from a PC to a Mac... Then, the mouse on the Mac was acting up, so Dave's 'odyssey' turned out to be the presentation itself - or maybe it should be called and 'ordeal' rather than an odyssey.)

He was asked to write an app that could run stand alone and as a component...

Things he's been asking for for a long time that v11 delivers...
  • Deleting tables and fields - v1.0.6 was the last US version where you delete tables and fields
  • 255 character alpha field
  • Indexes on text fields
  • The fact that list boxes can access tables directly, and the fact that you can use expressions in columns
  • Most limits are gone, same with data segments
  • Project forms are great - gone is the [Dialogs] table
  • SQL
The check box you use to make component methods available can also be used to let the component get access to host methods.

You can put an alias to the matrix database in the Components folder - you don't have to put the actual component.

You'll see Component Methods as an option in the Explorer when a component is installed.

Components are just special databases that you put in a folder of another database. There really isn't that much that's special about how it works - a lot simpler than before.

If there's a naming conflict between the host method and a component method the host method will win.

You can't access the structure of the component.

Partitioned objects that, when called from the component, come from the component, not the host:
  • Style Sheets
  • Help tips
  • Choice lists
  • Library Pictures
  • Menus created in design
  • Unshared project methods
  • Semaphores
  • Variables
  • Project forms
  • Processes - host processes can be accessed from the component, and processes are uniquely numbered
If you use default tables you may have problems when you call up a form since project methods are called by omitting the table from the call.

Shared Items:
  • Sets
  • Named Selections
  • Procedurally created menus and HLists
  • Shared Project Methods
  • Pointers - key since they are the primary method for passing data between components and hosts
  • Windows
All calls to things like table, table name, etc. are for the host database, not the matrix database.

One of the items he did and glossed over is that you can now edit the names of tables and fields by just clicking on the table/field name and changing it. You don't need to go through a properties dialog.

One thing to think about is that components can create tables and fields in the host database automatically using SQL. In other wordds, if the component needs tables for data - it just creates them in the host database. All the forms it needs would then be project forms in the component. Bottom line it has everything it needs even though it can't access it's own structure.

You can use an HList to have the component store the structure it needs while it's running on it's own, and then use the same HList to create the structure it needds in the host database.

One thing he learned was to not try to do everything in SQL - just use what seems to best fit the task.

There's a new command for getting the default table. It's a good idea when you're writing a component to set the default table back to what it was when your component method was called.

Labels: , ,

Digg It!  Add to  Add to StumbleUpon  Add to Reddit  Add to Technorati  Add to Furl  Add to Netscape


Post a Comment

Links to this post:

Create a Link

<< Home