Difference between revisions of "SDF/fr"

From Lazarus wiki
Jump to navigationJump to search
Line 5: Line 5:
  
 
== Format SDF ==
 
== Format SDF ==
 +
  * * * A FINIR * * *
 +
 
A summary of the SDF format as used in [[TStringList]], as paraphrased/synthesized from various versions of Delphi help (e.g. [http://docwiki.embarcadero.com/Libraries/en/System.Classes.TStrings.DelimitedText DelimitedText], [http://docwiki.embarcadero.com/Libraries/en/System.Classes.TStrings.StrictDelimiter StrictDelimiter])
 
A summary of the SDF format as used in [[TStringList]], as paraphrased/synthesized from various versions of Delphi help (e.g. [http://docwiki.embarcadero.com/Libraries/en/System.Classes.TStrings.DelimitedText DelimitedText], [http://docwiki.embarcadero.com/Libraries/en/System.Classes.TStrings.StrictDelimiter StrictDelimiter])
 
* If you get DelimitedText, strings that include spaces, Delimiter (e.g. ,) or QuoteChar '''must''' be enclosed in QuoteChars (" by default) aka quoted. (In practice - read Delphi does this -, however, with StrictDelimiter on, e.g. spaced text is not quoted)
 
* If you get DelimitedText, strings that include spaces, Delimiter (e.g. ,) or QuoteChar '''must''' be enclosed in QuoteChars (" by default) aka quoted. (In practice - read Delphi does this -, however, with StrictDelimiter on, e.g. spaced text is not quoted)
Line 12: Line 14:
 
* QuoteChars in the string '''must''' be repeated to distinguish them from the QuoteChars enclosing the string.
 
* QuoteChars in the string '''must''' be repeated to distinguish them from the QuoteChars enclosing the string.
 
* Delimiters that are not contained within QuoteChar marks '''must''' be handled as delimiters
 
* Delimiters that are not contained within QuoteChar marks '''must''' be handled as delimiters
* If StrictDelimiter is false, spaces that are not contained within QuoteChar marks '''must'' be handled as delimiters.
+
* Si StrictDelimiter est à False, les espaces qui ne sont pas contenus dans des marques QuoteChar ''doivent'' être traités comme des délimiteurs.
* Two Delimiters in a row indicate an empty string.
+
* Deux délimiteurs dans une lignes indique une chaîne vide.
  
 
== Exemple de sortie ==
 
== Exemple de sortie ==

Revision as of 13:56, 14 June 2017

English (en) français (fr)

Portail de la base de données

Références:

Tutoriels/articles pratiques :

Bases de données

Advantage - MySQL - MSSQL - Postgres - Interbase - Firebird - Oracle - ODBC - Paradox - SQLite - dBASE - MS Access - Zeos

SDF est format de fichier en texte délimité utilisé dans Delphi (et ensuite par Free Pascal) qui est très proche de CSV sans être identique. (.sdf est aussi l'extension des fichiers de données de Microsoft SQL Server, il n'est donc pas conseillé d'employer cette extension pour vos fichiers.

Format SDF

 * * * A FINIR * * *

A summary of the SDF format as used in TStringList, as paraphrased/synthesized from various versions of Delphi help (e.g. DelimitedText, StrictDelimiter)

  • If you get DelimitedText, strings that include spaces, Delimiter (e.g. ,) or QuoteChar must be enclosed in QuoteChars (" by default) aka quoted. (In practice - read Delphi does this -, however, with StrictDelimiter on, e.g. spaced text is not quoted)
  • In addition, a QuoteChar in a string must be repeated.
  • When setting DelimitedText, strings must be separated by Delimiter characters or spaces.
  • Strings may be enclosed in QuoteChars.
  • QuoteChars in the string must be repeated to distinguish them from the QuoteChars enclosing the string.
  • Delimiters that are not contained within QuoteChar marks must be handled as delimiters
  • Si StrictDelimiter est à False, les espaces qui ne sont pas contenus dans des marques QuoteChar doivent être traités comme des délimiteurs.
  • Deux délimiteurs dans une lignes indique une chaîne vide.

Exemple de sortie

Exemple de sortie SDF (testé dans Delphi et FPC après application du correctif au problème 19610):

Light bulb  Remarque: Les versions de FPC versions antérieures à 2.6.0 ne génère pas de SDF respectant la spécification

Ces séries de chaînes dans une stringlist (note : les nombres en début indiquent le champ pour la clarté, ils ne font pas partie des données) :

0normal_string
1includes;delimiter
2includes space
3includes"quote
4includes "quote and space
5tab	character
6"single_starting_quote
7multi
line.
8   SpacesInFront
9SpacesAtTheEnd

donne la sortie telle que ceci avec la propriété StrictDelimiter à True (et ; comme délimiteur) :

normal_string;"includes;delimiter";includes space;"includes""quote";"includes ""quote and space";tab	character;"""single_starting_quote";multi
line.;   SpacesInFront;SpacesAtTheEnd  

... et sort ceci avec StrictDelimiter à False :

normal_string;"includes;delimiter";"includes space";"includes""quote";"includes ""quote and space";"tab	character";"""single_starting_quote";"multi
line.";"   SpacesInFront";"SpacesAtTheEnd  "

Voir aussi