Articles menu

 

The best components for the best developers

maj 01. 2007
Running Win32 kbmMW application servers on Linux using WINE
User article

apr 03. 2007
Performance comparison of kbmMemTable Std/Pro and AnyDAC CDS

nov 15. 2006
The king has died...
Borland/CodeGear

jun 16. 2006
The story of 3rdparty announcements and reactions on them
General

maj 29. 2006
Solving the 'cannot find drf file' problem when compiling packages.
Delphi

feb 21. 2006
kbmMWCnnfig.inc explained
kbmMW

feb 14. 2006
ReportBuilder 10 enduser report design with kbmMW
kbmMW/RB10

feb 09. 2006
Tips to setup IIS/ISA to operate as proxy between kbmMW client and server.
kbmMW/IIS

feb 08. 2006
Some thoughts about Borlands decision to split out its IDE/Tools division
Borland

jan 08. 2006
Things to be aware about when moving from Datasnap to kbmMW
kbmMW related

jan 08. 2006
Long running client controlled (stateful) transactions and the query service.
kbmMW related

jan 08. 2006
Secure messaging tips.
kbmMW WIB related

jan 08. 2006
Updating time in MSAccess Database with ADO
kbmMW related

jan 08. 2006
Upgrade from kbmMW v1 to kbmMW v2
kbmMW related

jan 08. 2006
Cross database and macro support
kbmMW related

Cross database and macro support

kbmMW related

Cross adapter

Few easy steps:

1) On the form/datamodule where you normally place a TkbmMWNexusDBConnectionPool, leave it there (provided you still want your application server to be able to connect to NexusDB), but also put a TkbmMWXConnectionPool, and connection pools for all other databases/databaseAPI's you want to use and configure them with the needed connection setups just like if you would use them the normal kbmMW way.

2) Set the ConnectPool property of the TkbmMWXConnectionPool to point on the database specific connection pool you want your application to talk with. This way you can connect the cross adapter to any database specific connection pool at any time you choose, by setting only one property.

3) Instead of using TkbmMWNexusDBQuery etc. components on your query services, use TkbmMWXQuery etc. components. Hook them up to the TkbmMWXConnectionPool, either via a TkbmMWPooledSession (required in v.1.xx) or directly via the ConnectionPool property of the components (requires kbmMW v.2).

4) If you want to have concurrent access to multiple different databases, of which you want to be able to switch between database types at runtime, simply add multiple TkbmMWXConnectionPool component, one for each concurrently open database.

This is about it. Then there are some more interesting things you can optionally do if you need to:

Macros

Normally you would define the SQL in the query service's query components. But if the different databases have different dialects, tablestructure etc. that wont easily work without some remapping. For this purpose you can use the Macro property of the database API connection pool. Its a simple string list which contains elements of the form NAME=DATA. Each name is a macro name, and the data is anything you can think about.

Thus if one database require you to use one specific SQL statement to extract the data you need from it, you can put a macro with that statement in that database's Macro property, and instead of writing SQL in the TkbmMWXQuery component, refer to the macroname.

Eg. we have macro:

somesql=select a,b,c from xyz

in the NexusDB connectionpool, and for example:

somesql=select x+y as a,b,c from xyz

in some other database's connection pool, both statements giving the expected result for
the enduser. Then the TkbmMWXQuery.Query property would be set to: ''

You could have chosen to set the somesql macro like this:

somesql=a,b,c

and

somesql=x+y,b,c

respectively and the query statement like this:

'select from xyz'

This is equally valid.

You can have multiple macros in each statement if you want that. You can also use the macros from the client side. In this case you have a 2 step macro conversion. First the client will substitute all macros defined on the TkbmMWClientConnectionPool, then the server will substitute whats left (the ones not matching on the client side) by whats defined in the database API's connection pool's macro property.

Macros works not only in combination with the cross adapter, but also directly with database API adapters.

To enable the macro replacement, set EnableMacros:=true on the connection pool.

An event exists, OnUpdateMacros, for you to be able to update the macro settings you want (for example loading them from
a file or something) when the connection pool is activated if thats needed. For the event to fire, the AutoUpdateMacros property must be set to true.

Meta data

kbmMW v2 includes database independant metadata handling. This is described in one of the whitepapers on the C4D documentation page.

In a nutshell, it allows you to operate generators/sequences/pivot tables, create/delete/empty etc. tables and create/delete/rebuild indexes without having to worry about the type of database.

kbmMW takes care of generating the right operations (SQL or not) to make it happen.

--
best regards
Kim Madsen
kbm@components4developers.com
www.components4developers.com

The best components for the best developers
kbmMW          - RAD n-tier application server framework
kbmMemTable - High performance memory table
kbmWABD      - RAD web development
kbmX10           - RAD house automation


(Top)

 
 

User comments

 



The first time I took a glance at it I thought ... HUH ?
 .. but now I've had the time to take a better look ...
(more)

On my "personal projects", I also own kbmMW ...
(more)

I think kbmMW is the most powerful, flexible, innovative, well supported framework available for Delphi today.
I ...
(more)

 
 
 
CodeGear Technology Partner Components4Developers is the only major 3rdparty CodeGear Technology Partner approved n-tier vendor!

Copyright© 2001-2009 Components4Developers - All rights reserved