Page 3 of 5

Re: DBF<-->SQLite Exporter

Posted: Thu Jun 21, 2012 7:13 am
by Rathinagiri
Hi,

It is not the .hbp file, but the .hbc file is important.

Further, I have updated to the new version of DBF <---> SQLite Explorer to export all the tables in a SQLite file into respective dbf files.

Note: Width of Field Names in DBF files is truncated to 10 characters.

Enjoy!
dbf2sqlite.zip
(1.14 MiB) Downloaded 900 times

Re: DBF<-->SQLite Exporter

Posted: Thu Jun 21, 2012 7:49 am
by bels79
rathinagiri, Chacal.GO I am grateful for the help, it can be run.


Chacal.GO wrote:Hello bels79 !

You just need to edit file: dbf2sqlite.hbp ( can be edited via HMG IDE )


If you dont have "HMGSQL LIB" just download from link below:
viewtopic.php?f=8&t=1562&p=12079&hilit=HmgSql#p12079


dbf2sqlite.hbp - before changes:

Code: Select all


main.prg
sqlite2dbf.prg

dbf2sqlite.hbp - After changes:

Code: Select all


main.prg
sqlite2dbf.prg

#
# libs
#
# 
-lhbsqlit3

#
# .hbc files
#
# 
hbsqlit3.hbc
dbf2sqlite.hbc


Re: DBF<-->SQLite Exporter

Posted: Thu Jun 21, 2012 7:39 pm
by IMATECH
Hello bels79 !


Please: can you explain any dificulties found ?


Regards...

Re: DBF<-->SQLite Exporter

Posted: Fri Jun 22, 2012 2:27 am
by bels79
I tried according to the instructions given, delete command "CFLAGS = -Wall -mno-cygwin -O3 " on file "makefile.gcc"



Chacal.GO wrote:Hello bels79 !


Please: can you explain any dificulties found ?


Regards...

Re: DBF<-->SQLite Exporter

Posted: Sat Jun 23, 2012 3:05 pm
by IMATECH
Then... new instructions:

01 - Copy project to your samples HMG folder
-> \HMG\SAMPLES\Dbf2Sqlite

02 - Command Prompt: (or build from HMG ide)
\HMG\SAMPLES\..\..\build.bat Dbf2Sqlite.hbp

03 - Now you have built Dbf2Sqlite... enjoy
\HMG\SAMPLES\Dbf2Sqlite.exe

Regards...

Re: DBF<-->SQLite Exporter

Posted: Sat Jun 23, 2012 3:34 pm
by Rathinagiri
Or simply use HMG-IDE, open and build the project.

Re: DBF<-->SQLite Exporter

Posted: Wed Oct 03, 2012 8:25 am
by Hazael
rathinagiri wrote:Hi,

It is not the .hbp file, but the .hbc file is important.

Further, I have updated to the new version of DBF <---> SQLite Explorer to export all the tables in a SQLite file into respective dbf files.

Note: Width of Field Names in DBF files is truncated to 10 characters.

Enjoy!
dbf2sqlite.zip
Hello Rathinagiri,

I just download and tried the DBF->SQLite converter but it does not recognize datatype + (auto-increment) - It was introduced on this changelog:

2007-09-25 03:20 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
...
* harbour/source/rdd/dbf1.c
+ added support for AUTOINC (+), ROWVERSION (^), TIME (T), DAYTIME (@)
and MODTIME (=) fields
...

It is interesting feature - you should check it.

Could you please add it to this nice utility?
Thanks

Qatan

Re: DBF<-->SQLite Exporter

Posted: Wed Oct 03, 2012 9:02 am
by Rathinagiri
Dear Qatan,

For your kind information, I am not using the RDD. I directly connect with hbsqlite library.

Re: DBF<-->SQLite Exporter

Posted: Wed Oct 03, 2012 2:51 pm
by Hazael
Hello Rathinagiri,

I think you didn't understand.
It talks about new datatypes in DBF fields. Before there were only C, L, N, M and D but now we have a few more. The auto increment is type | + | and is very useful.
What I wanted to express is that the DBF<-->SQLite Exporter utility does not know this new DBF datatype + so it gives an error (type not recognized or something like that...)
I was asking you if it is possible that you could update your nice utility to understand the new DBF datatypes. Do you think it is possible? I like your utility and I think it could support these new datatypes...

By the way I am considering to try some special features of SQLite:

1) Integration with ICU with localization features for finding "A" and "á" as the same thing: http://www.sqlite.org/src/artifact?ci=t ... README.txt
(also "a", "ã", "Â", "À", "â", etc... and goes to "o", "O", "ó", etc... etc...)

2) Integration with SQLCypher http://sqlcipher.net/ (I remember you succeded with this one, if I am not wrong)

3) FTS (Fast Text Search) feature: http://www.sqlite.org/fts3.html

I think SQLite is very good and what I like most is the simplicity of it (zero config), only one file for all tables and of course blazing fast. A query like this one in a big database is super fast:
SELECT * FROM table1 WHERE field1 LIKE '%core%' OR field2 LIKE '%core%' OR field3 LIKE '%core%' ORDER BY field4

The above query seeks for word "core" in many fields and in any part of the field way faster than using DBFNSX with OrdWildSeek()

Of course it demands a lot of research and try but a program using SQLite with the above features would be very nice. I would appreciate any previous experience with any of the above (of all of them)

Right now I can not do the above query to search for the following data (I am missing ICU component):

coré
corè
córe
côre
etc...

By the way you can use ICU component in the DBF files also:
2012-04-20 17:52 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
...
* harbour/src/codepage/cp_utf8.c
+ harbour/src/codepage/uc16def.c
+ harbour/src/codepage/utf8sort.c
* replaced UTF8ASC with new CP: UTF8EX
This CP uses character indexes instead of bytes one
and operates on unicode characters flags.
Tables for upper/lower conversions and upper/lower/alpha/digit
flags were generated automatically from
http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
It also uses custom collation rules. It's very simple one
level sorting based on UTF8 C collation.
If someone needs some advanced sorting rules, then it's enough
to create copy of this cp with user custom version of UTF8_cmp()
and UTF8_cmpi() functions, i.e. they can be redirected to some
external library like ICU (icu-project.org).
...


Also I can not encrypt the database so anyone can open it and see/modify it with a simple utility what could cause inconsistencies not to mention it would not protect the information on the database being accessed by anyone (in special in a shared folder on the network).

The FTS feature would just be an extra.

Thanks for your help

Qatan

Re: DBF<-->SQLite Exporter

Posted: Wed Oct 03, 2012 3:39 pm
by Rathinagiri
Thanks a lot for the detailed explanation Qatan.

I didn't use DBF autoincrement fields. So I didn't know about that. I will dig into it and make use of it.

1. Regarding ICU, unfortunately HMG is not ready for Unicode implementation even though Harbour is. There are many places to be changed for unicode implementation.

2. SQLCipher is possible now. You can encrypt/decrypt the whole database on the fly without any hustle. You can download the library and details from here.

viewtopic.php?f=7&t=2416

3. Will FTS be possible without ICU?

Regarding encryption and decryption I have coded a small utility if you have installed the SQLCipher properly.
encryptsqlite.zip
(622.26 KiB) Downloaded 771 times