summaryrefslogtreecommitdiffstats
path: root/kexi/doc/dev/kexi_import.txt
blob: be640ba1cbc2856ba40cafdb1e81088387212748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
kexiImport proposal - piggz (www.piggz.co.uk)
=============================================

This is a proposal for some import functionality for kexi.  
As of this moment i have no idea how it will work, but ive 
been thinking and figured i should get something down in 
writing.  Hopefully you will all improve on this and we can 
get something working.

The way i see it we need to do a few things:

1) A common api to different import systems
   This would be similar in concept to kexidb drivers, but would 
   only provide limited, specific functionality
   
2) DB specific classes that provide import functionality 
   for postgres, mysql firebird etc...


For 1) we need to to:

i) Connect to backend    -|
                          |
ii) Get list of databases | All this is already catered for in
                          | kexidb
iii) Get list of tables  -|

iv) For a given table, get list of columns as stringlist

v) For a given table/column combination, get extended information for 
   that column:
   
   type
     +--If a known kexi type then ok
     +--If unknown then driver may be able to automagically map to suitable type
     +--Ask the user what to do (map to type, convert column, drop column)
     
   index (yes/no)
   
   pkex (yes/no)
   
   default value
   
   Alot of this is already catered for in old kexi api, so maybe some 
   chunks fo code could be reused, though a bit of a rewrite is inevitable 
   to limit the functionality to the above
   
Once the table/column information is available then a tableschema object would be 
created and standard kexidb api could create nescessary structure.  For this there 
would be 2 modes of operation

A) Structure will be created under new db name, and kexidb api would be used as
   normal
  
B) Structure will be created in existing db.  Kexi api would need a mode where
   kexi__* structure is created, but tables are not created as they already exist
   
   
Ideas, suggestions and designs welcome :o)

PiggZ