Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor adapter with text files
Message
From
23/07/2007 04:39:22
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turkey
 
 
To
20/07/2007 09:17:23
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:
01242690
Views:
10
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
Next
Reply
Map
View

Click here to load this message in the networking platform