From: Jim S. <ja...@ne...> - 2004-06-02 17:56:49
|
Samofatov, Nickolay wrote: >Hi, Jim! > > > >>Take two is creating an ad hoc, hard coded, recursive descent >>parser based on the Lex used by configuration file system. >> >> > >I would have extracted first 3 words from SQL statement and checked if >first word is CREATE, second is DATABASE or SCHEMA and third is string >literal. >Then I would resolve provider from filespec, rewrite it and pass >resulting statement down the stream to provider interface. This all is >~20 lines of code and it doesn't require heavy lexer or parser on the >client side. > > That is sorely tempting, but there's a problem. The createDatabase method in the provider interface needs to pass the configuration objects for database and provider (provider is chained off the database object) so the target provider can pick up database and provider specific attributes from the configuration files. I'd really like to avoid having to pass those things an every dsqlExecuteImmediate call. The positive side is that the actual parsing code is trivial, as is the code to transform parameters into dpb (well, at least it should be), and this will let us rip the create database code out of dsql, which is among the ugliest code in the engine. Thanks for the suggestion, but on balance I think leveraging the createDatabase code is well worth the cost of an existing lightweight lex and a trivial parse. -- Jim Starkey Netfrastructure, Inc. 978 526-1376 |