Rushmore wrote:
Otis wrote:
For which database do you want to develop a driver?
There is already a thread - Foxpro DBF Driver
But I want to give it a try.
Please give me the necessary information, that I can start my research
Regards,
Carlo
Ok, first step is the driver.
Foxpro needs teh OleDb provider for everything so I'd do the following:
- copy the MS Access driver sourcecode and rename files/project and the like so they match foxpro instead of access
- change the GUID in foxprodbdriver.cs -> DBDriverID and also in the driver.config file
- create a folder 'Foxpro' in llblgenpro installation folder\Drivers
- place driver.config and the compiled driver into that folder. Also create a Templates folder in that driver folder
Ok, now several things have to be setup. First you have to create type lists. Open foxprodbdriver.cs and at the top you'll see a list of enum defines, e.g AccessDbTypes. You define there all NATIVE types of the db. So in terms of sqlserver, you would see there int, bit, varchar, text, image etc.
Then, you've to create 3 mapping tables. Theses are filled in FillDBTypeConvertArrays(). The first, DbTypesAsProviderTypes is the OleDbType.xxxxx name for each native type. The rest of the 3 tables speaks for themselves.
You can re-use a lot from the access driver, as it generally works the same. Browse through the foxprodbdriver.cs file to see if you need to alter more things (I'm not familiar with the inner workings of foxpro), like the connectionstring format.
Next: FoxproConnectionData control. That's the control which is inserted into the create project wizard and gathers file name and other info about the db to be able to connect to it and read schema data.
Next: FoxprocatalogRetriever. This is the retriever for each schema. Foxpro uses a single file per db, so this is largely the same as MS Access' code, also because ms access code uses solely OleDb for schema retrieval, so you can simply re-use this code.
Next: FoxproSchemaRetriever, the actual schema data retriever. Now, the RetrieveSchema routine is where it all starts. Start there and work down. If foxpro supports identity fields, you've to add a sequence object. This is then later on used to retrieve / set the newly inserted pk value.
If foxpro supports procs (I've no idea it does or doesn't), you might need to port code from the other drivers to this one, but if you don't need that leave it at this for now.
The code which retrieves the PK fields is custom, though shoudl also work for foxpro (populatealltablefields routine).
If you have this working, please report back so we can go look at the templates/dqe.