www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
csv_cols_def
csv_load
csv_load_file
csv_parse
csv_table_def
file_delete
file_dirlist
file_mkdir
file_mkpath
file_open
file_stat
file_to_string
file_to_string_outpu...
file_unlink
get_csv_row
gz_file_open
os_chmod
os_chown
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Phrases
RDF data
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
VAD
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
XML
XPATH & XQUERY

Functions Index

csv_parse

Parses a CSV file.
csv_parse (in string_session_input any, in callback_sp_name varchar, inout callback_user_data varchar, [in from_line integer], [in to_line integer], [in opts any]);
Description

Parses string session containing CSV data and then calls stored procedure by given callback_sp_name parameter. The call back will be invoked for lines between from_line and to_line argument's values. The default from/to is 0/null which means from begining to end. The callback function must take three arguments: the vector which contains parsed csv row, the line number, inout the callback_user_data.

Parameters
string_session_input – String session containing CSV data will be parsed as CSV where it will insert into the table specified as table_name the lines between from_line and to_line offsets.
callback_sp_name – The name of the stored procedure.
callback_user_data – The user data.
from_line – Default - 0, This means counted from the begining.
to_line – Default - null, This means counted to the end.
opts – Default - null. The opts paramater is used to specify the delimiter and quote it should look like this:
vector ('csv-delimiter', self.delim, 'csv-quote', self.quot)
Examples

create procedure y_csv_cb (inout r any, in inx int, inout cbd any)
{
 if (cbd is null)
   cbd := vector ();
 cbd := vector_concat (cbd, vector (r));
}
;

....
 h := null;
 csv_parse (ss, 'DB.DBA.y_csv_cb', h, 0, 10);
....