| Subject |
Re: SQLite to DbF |
| From |
Mervyn Bick <invalid@invalid.invalid> |
| Date |
Thu, 16 Feb 2023 16:37:30 +0200 |
| Newsgroups |
dbase.getting-started |
On 2023/02/16 15:37, Ralf Krieg wrote:
> Ken, thanks a lot for translating my post.
> Best regards
> Ralf
I've never used SQLite so this suggestion may not work.
If you have already created the empty tables in dBASE you should be able
to use two query objects to transfer the data. I assume that the fields
are identical except that in the .dbf file you have used the MEMO field
type for the long text fields.
Creating 585 empty .dbf files by hand will be a lot of work. You may be
able to automate this by using cretable7.prg from the dUFLP. With the
table in SQLite selected in the Navigator
do :duflp:cretable7 with '*.dbf'
This will place code to create the .dbf file in cretable.txt and
although it has .txt as the extension it can be executed.
First make sure that the long text fields are shown as MEMO and, if
necessary, edit the file.
do cretable.txt
To transfer the data.
cTablename = 'mytable'
d = new database()
d.databasename = 'mydatabase'
d.loginstring = 'whatever'
d.active = true
qsql = new query()
qsql.database = d
qsql.sql = 'select * from '+cTablename
qsql.active = true
qdbf = new query()
qdbf.sql = 'select * from '+cTablename
qdbf.active = true
if qdbf.rowset.count() = 0 //Skip if already done
do while not qsql.rowset.endofset
qdbf.rowset.beginAppend()
for n = 1 to qsql.rowset.fields.size
qdbf.rowset.fields[n].value = qsql.rowset.fields[n].value
next
qdbf.rowset.save()
qsql.rowset.next()
enddo
endif
qdbf.active = false
qsql.active = false
d.active = false
You can use an array object's dir() method to feed the tables to the
program in a loop.
The code is untested so it may not do the job.
Mervyn.
|
|