The message is resent because my last message (without attachment) has
already reached mailing list.
Instead of attaching .zip file, you'll find it at:
http://www.dbtopas.lt/hrb/sdd.zip
======================================
Hi,
Przemyslaw Czerpak wrote:
Before you will started the work then I suggest you to look at
CLIP project - you will find in SF.
I've looked to CLIP code. The basic idea (Clip's SQL interface gives
possibility to access SQL databases, but are not plug-and-play tool for
DBF to SQL migration) seams to be the same. I also see a lot of
similarities in implementation. Of cause some differences exists, the
main differences are:
1) CLIP uses different function names to RDD and SQL. For example, it
uses SQLGOBOTTOM() instead of DBGOBOTTOM(). My implementation is uses
RDD interface. Some new SQL functionality is obtained using RDDINFO()
call. For example, I use:
RDDINFO(RDDI_EXECUTE, "DROP TABLE something")
instead of
SQLEXECUTE("DROP TABLE something")
but these SQL*() functions can be easy implemented. Actually, the same
situation is in DBF implementation. You can use
DBORDERINFO(DBOI_ORDERCOUNT) or ORDCOUNT().
2) I guess CLIP does not have possibility to access field values using
names, i.e.
FIELD NAME
? NAME
is impossible, the only way to get field value is:
? SQLGETVALUE(1) // 1 is field number
I found it a drawback. Using native Clipper syntax support for accessing
field is a big benefit, it make code much more shorter and readable.
Of cause, there are some implementation differences. CLIP has prepare()
method, but I know MySQL the best from SQL API's and it did not use
prepare function, so I haven't included it into SQL database driver
method table. The similar situation is for start(), commit(),
rollback(). In MySQL you need to do execute() call with parameter
"commit" or "rollback". I have not added BLOB suport yet.
The few problems have to be solved writing RDD for SQL access. One is
NULL/NIL question? Another is: should we PAD field values for SQL RDD to
be compatible with DBF RDD's?
I attach some of my code (only MySQL database driver) is included:
sqlbase.c - basic RDD for interfacing with SQL database driver;
sqlmix.c - this RDD implements indexes using B-trees in memory.
It is inherited from SQLBASE;
mysqldd.c - SQL database driver for MySQL;
hbsqldd.h - include files for all above. Some defines should be moved
to should dbinfo.ch;
test1.prg - test code.
I hope you'll be able to compile it.
Best regards,
Mindaugas
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour