Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor adapter with text files
Message
From
23/07/2007 08:58:02
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
 
 
To
23/07/2007 06:18:41
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01242234
Message ID:
01242737
Views:
10
I use VFP9. I just need read and insert record. PK is an unique number...

text file like that:

1,00007,14,LIN, 0005,08:01:25
1,00008,01,FIS,041 0005,000004
1,00009,03,TAR,11/03/2006 ,08:16
1,00010,04,SAT,03.000099377,02 0.90
1,00011,08,TOP, , 0.90
1,00012,09,NAK, , 0.90
1,00013,37,NWS, 1,
1,00014,11,SON, ,
1,00015,33,MLC,00002011 ,
1,00016,34,VER,05/09/2005 ,C++ 8.02.01h
1,00017,01,FIS,041 0005,000005
1,00018,03,TAR,11/03/2006 ,08:18
1,00019,04,SAT,01.000010545,04 0.39
1,00020,08,TOP, , 0.39
1,00021,09,NAK, , 0.39
1,00022,37,NWS, 1,
1,00023,11,SON, ,
1,00024,33,MLC,00002011 ,



>Metin,
>
>I'm puzzeld.
>
>Lets see if I can ask the right questions
>1) What version of VFP and what primary database?
>
>2) The CA should deal with the data to make the import fit for the storage (Data types, integrity etc.))
>
>2) The CA will on one hand read data from the text file and on the other hand write those data to place from 1)
> 3a) In wich way you generate PK's?
>
>3) this is all work the CA should do
>
>Agnes
>
>>I know I can do it but I need to an updatable cursor with text file. I don't want to do export-import frequently...
>>
>>>Metin,
>>>
>>>so I guess you would like to import the file. And the result should be an cursor bound to a CA. A assumption is that we talk about native VFP databases.
>>>
>>>I will describe a "write only" CA. (you can not query a database with it)
>>>
>>>
>>>One way would be to create a cursor with the appropriate fields eg
>>>
>>>CREATE CURSOR curImport (c1 c(n1), c2 c(n2),..., t1 Type, t2 Type ...)
>>>
>>> where cx is the number of the field in the import and ni the lenght of the field.
>>>
>>>t1 .. tn are representations for the targets of the imports.
>>>
>>>Provide the properties of the CA as needed (CURSORSCHEMA, TABLES, KEYFIELDS, etc), note that only the tn fields are bound to the target tables.
>>>
>>>Bound the cursor via CURSORATTACH to the CA
>>>
>>>Import the file via APPEND FROM filename TYPE SDF
>>>
>>>Now you have a cursor with all the information from the file. All is character in the c fields yet. t fields are empty.
>>>Now you can transform each c field to the appropriate t field. You may do any needed validation here.
>>>
>>>A TABLEUPDATE should write to the target.
>>>
>>>
>>>
>>>You may also generate a CA with the CursorFill way. (Fill SELECTCMD and call Cursorfill with nodata parameter.)
>>>Then you may generate the cursor mentioned above, do all the transformations and fill the CA from that cursor.
>>>TABLEUPDATE.
>>>
>>>
>>>Just keep in mind that a CA bound cursor is just an VFP cursor. The CA is just an object that holds all the things otherwise set via DBCSETPROP and some events for special table operations.
>>>
>>>
>>>I personally, do not use CA's for such work. Normaly imports are a little bit to tricky to do them in normal operation. So I lock the DBC for a single user and use plain cursors.
>>>
>>>Hope that helps
>>>AFK
>>>
>>>
>>>Agnes
>>>>>Hi Metin,
>>>>>
>>>>>it would be helpfull if you could provide what access you need. There is a range from reading filename to import the file
>>>>>
>>>>>Agnes
>>>>>>Hi All,
>>>>>>
>>>>>>I need access a text file with cursor adapter class. I tried connection strings which I found from web but not success... :(
>>>>
>>>>Hi Agnes,
>>>>
>>>>That's a fixed lenght text file like:
>>>>
>>>>AAAAA00005555BBBBBB
>>>>CCCCC00003556CCCCCC
>>>>QREWW00432445GFDGDF
Previous
Reply
Map
View

Click here to load this message in the networking platform