INTRODUCTION This script adds a csv:// protocol to rebol. COPYRIGHT ©2001 Jean Holzammer. This is Freeware. You may use and modify this piece of software as long as: · you do not charge any fees for distribution · you include my name (Jean Holzammer) and a link to my homepage (http://www.holzammer.net) into the archive · send me a copy (mailto:Development@Holzammer.net) of your modified version You use this piece of software at your own risc !! CONTACT mailto:Development@Holzammer http://www.holzammer.net VERSION 0.1 RESTRICTIONS · source not commented · probably not fully tested · works synchron only · the complete csv file is always loaded into memory · you cannot open more than one port at the same time ! · data source / csv file must exist locally FILE FORMAT · ascii file · one record per line · columns separated by , USAGE In the beginning of your script add: do %csv-protocol.r Then the protocol is available example file: Adresses.csv Gorbi,Michail,Russia Smith,John,England Huber,Alois,Bavaria Montpellier,François,France URL looks like: csv://nohostname/path/to/file 1.to get a structured block: read csv:////ram/Addresses.csv or without path addresses: read csv:///Addresses.csv result is a block: [ ["Gorbi" "Michail" "Russia"] ["Smith" "John" "England"] ["Huber" "Alois" "Bavaria"] ["Montpellier" "François" "France"] ] 2.using port myport: open csv:///Addresses.csv addresses: copy myport close myport result: addresses looks like block described above 3.picking one specific record myport: open csv:///Addresses.csv record: pick myport 2 close myport record now is a block: ["Smith" "John" "England"] 4.insert records myport: open csv:///Addresses.csv insert myport ["Kaas" "Antje" "Netherlands"] insert myport ["Aznar" "Julio" "Spain"] close myport commit / saving is done when closing the port CREDITS Thanx goto Jeff for his example code at rebolforces Now have some fun with it... Jean