Rechercher dans le manuel MySQL

16.4 The CSV Storage Engine

The CSV storage engine stores data in text files using comma-separated values format.

The CSV storage engine is always compiled into the MySQL server.

To examine the source for the CSV engine, look in the storage/csv directory of a MySQL source distribution.

When you create a CSV table, the server creates a plain text data file having a name that begins with the table name and has a .CSV extension. When you store data into the table, the storage engine saves it into the data file in comma-separated values format.

  1. mysql> CREATE TABLE test (i INT NOT NULL, c CHAR(10) NOT NULL)
  2.        ENGINE = CSV;
  3. Query OK, 0 rows affected (0.06 sec)
  4.  
  5. mysql> INSERT INTO test VALUES(1,'record one'),(2,'record two');
  6. Query OK, 2 rows affected (0.05 sec)
  7. Records: 2  Duplicates: 0  Warnings: 0
  8.  
  9. mysql> SELECT * FROM test;
  10. +---+------------+
  11. | i | c          |
  12. +---+------------+
  13. | 1 | record one |
  14. | 2 | record two |
  15. +---+------------+
  16. 2 rows in set (0.00 sec)

Creating a CSV table also creates a corresponding metafile that stores the state of the table and the number of rows that exist in the table. The name of this file is the same as the name of the table with the extension CSM.

If you examine the test.CSV file in the database directory created by executing the preceding statements, its contents should look like this:

"1","record one"
"2","record two"

This format can be read, and even written, by spreadsheet applications such as Microsoft Excel or StarOffice Calc.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-csv-storage-engine.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut