I want to put, modify and retrieve comments in sqlite, to the database, to the tables and to the columns

-1

For now I am only commenting on the table columns.

To put comments at the time of creating it I am using this query:

CREATE TABLE KBase (
    n1tId INTEGER UNIQUE PRIMARY KEY AUTOINCREMENT  NOT NULL /* ####### AutoNumerico  */, 
    a1tNombrePrograma        VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tNombreTabla           VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tNombreArchivoDBF      VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tLetra                 VARCHAR (2)  /* CC Texto  */, 
    a1tCampoNombreDBF        VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tCampoNombreTabla      VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tCampoTipo             VARCHAR (1)  /* C Texto  */, 
    n1tCampoLargo            VARCHAR (5)  /* ##### Numerico  */, 
    n1tCampoDecimales        VARCHAR (5)  /* ##### Numerico  */, 
    a1tCreoPicture           VARCHAR (400)/* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    n1tManteOrden            VARCHAR (3)  /* ### Numerico  */, 
    a1tManteTitulo           VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tMantePicture          VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */,
    n1tManteTamano           VARCHAR (5)  /* ##### Numerico  */, 
    n1tManteDecimales        VARCHAR (5)  /* ##### Numerico  */, 
    l1tManteMuestro          BOOLEAN      /* # YesNo  */, 
    n1tAltaOrden             VARCHAR (3)  /* ### Numerico  */, 
    a1tAltaTitulo            VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tAltaPicture           VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    n1tAltaTamano            VARCHAR (5)  /* ##### Numerico  */, 
    n1tAltaDecimales         VARCHAR (5)  /* ##### Numerico  */, 
    l1tAltaMuestro           BOOLEAN      /* # YesNo  */, 
    l1tAltaGets              BOOLEAN      /* # YesNo  */, 
    n1tBajaOrden             VARCHAR (3)  /* ### Numerico  */, 
    a1tBajaTitulo            VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tBajaPicture           VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    n1tBajaTamano            VARCHAR (5)  /* ##### Numerico  */, 
    n1tBajaDecimales         VARCHAR (5)  /* ##### Numerico  */, 
    l1tBajaMuestro           BOOLEAN      /* # YesNo  */, 
    n1tFichaOrden            VARCHAR (3)  /* ### Numerico  */, 
    a1tFichaTitulo           VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tFichaPicture          VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    n1tFichaTamano           VARCHAR (5)  /* ##### Numerico  */, 
    n1tFichaDecimales        VARCHAR (5)  /* ##### Numerico  */, 
    l1tFichaMuestro          BOOLEAN      /* # YesNo  */, 
    n1tModifOrden            VARCHAR (3)  /* ### Numerico  */, 
    a1tModifTitulo           VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tModifPicture          VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    n1tModifTamano           VARCHAR (5)  /* ##### Numerico  */, 
    n1tModifDecimales        VARCHAR (5)  /* ##### Numerico  */, 
    l1tModifMuestro          BOOLEAN      /* # YesNo  */, 
    l1tModifGets             BOOLEAN      /* # YesNo  */, 
    a1tRelacionTabla         VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tRelacionTablaCampo    VARCHAR (20) /* CCCCCCCCCCCCCCCCCCCC Texto  */, 
    l1tOrdenado              BOOLEAN      /* # YesNo  */, 
    l1tRequerido             BOOLEAN      /* # YesNo  */, 
    a1tAntes                 VARCHAR (80) /* CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tDespues               VARCHAR (80) /* CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tValid                 VARCHAR (80) /* CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC Texto  */, 
    a1tValidacion            VARCHAR (80) /* CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC Texto  */, 
    l1tUnico                 BOOLEAN      /* # YesNo  */, 
    l1tPrimarykey            BOOLEAN      /* # YesNo  */, 
    l1tAutoincrement         BOOLEAN      /* # YesNo  */
)

I would like to read those comments and modify them (one by one) that I would query in each case?

Data is saved in the table, inserted, deleted and modified as usual.

With this order I create the table and I put a comment or description to each column.

With ztree (tool that allows among other things to visualize hexadecimalmente the content of the files ( link )) I see that said information is stored.

What I want is to edit, delete, view these comments, for this I need the query.

The comments is what is to the right of each line where I define each column, placed between: / * * /

In the ms-access databases it is possible to add a description to the columns (the columns are called fields), then this description can be edited later.

    
asked by Hugo Mariño 20.06.2016 в 14:42
source

2 answers

0

Testing a sqlite file manager program: SQlite Expert Personal 3.5.67.2487 (there are newer versions)

Having opened a database and having a table selected, I observed that when I clicked DDL it shows me the statement of creation of the table, so I deduced that it is possible to obtain it through a command.

Searching in google for DDL, I found a query to get it:

    select sql from sqlite_master where type ='table';

This is the answer I expected to get !!!

    
answered by 24.06.2016 / 20:54
source
0

According to this post , it appears that SQLite stores the comments you place on your DDL (Definition Language) statements. Data). That is, if you have a script like this:

sqlite> create table KBase (

... > id integer unique primary key autoincrement, / * comment test /    ... > varchar value (20) / another test comment * /);

When you execute the .schema command, you return the table outline with your comments:

sqlite> .schema KBase
CREATE TABLE KBase (
id integer unique primary key autoincrement, /* prueba de comentario */
valor varchar(20) /* otro comentario de prueba */ );

Comments work even if you alter the table, for example:

sqlite> alter table KBase
   ...> add column otro varchar(20) /*intentando agregar comentario*/
   ...> ;

And returning to execute .schema results in:

sqlite> .schema KBase
CREATE TABLE KBase (
id integer unique primary key autoincrement, /* prueba de comentario */
valor varchar(20) /* otro comentario de prueba */ , otro varchar(20) /*intentando agregar comentario*/);

If you need to modify any comments, it means that you must change the DDL, that is, you must delete ( DROP ) the table and recreate it with the appropriate comments. Anyway, I think it's not a good practice to constantly change the comments of a table.

    
answered by 21.06.2016 в 04:35