#1 2024-08-11 17:07:49

igors233
Member
Registered: 2012-09-10
Posts: 241

TDocVariantData.InitCSV

I see InitCSV was removed from mORMot2 in past year, any builtin alternative for it?

Offline

#2 2024-08-11 17:38:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,651
Website

Re: TDocVariantData.InitCSV

We did not "remove" this method, we renamed it because it was very misleading.
If you want to work as InitCsv() did in the past, just use TDocVariantData.InitFromPairs.
Because in fact, InitCsv() was NOT about load CSV content, but about loading pairs of name/value data.

If you want to work with a true CSV input, you have DynArrayLoadCsv() from mormot.core.search.pas.
It allows to fill a dynamic array of fields, directly from the CSV.
It is both much faster and more conformant to the CSV standard.
See e.g. how https://github.com/synopse/mORMot2/blob … angCmp.dpr uses it to load very efficiently a huge CSV, and quickly access its content.

Offline

Board footer

Powered by FluxBB