(** ~ Yehovah is the Holly Name ~ **)
(This version is updated at 25/04/2018
@conta,@dna_show,@bigdata,@hash CQL Functions Added
Changes on @html and @html_resposta Syntax
Adl Development Ltd.
CSV Comp DB - Syntax CQL
Author: Almir Bispo
Youtube: https://www.youtube.com/user/AlmirXXXX
Objective
This document is brief and goal, trying to explain the way each function
command block CQL should be used.
Tutorial soon to run scripts type * .CQL using Prompt_pas
A practical example of doing an experiment using the application Prompt_pas.Linux
version or Windows, can run the same scripts CQL.In our example, we will use the
Lubuntu Linux 32 bits.
A CQL script with @tabela function, @campos @adicionar was created within the
database directory using a simple text editor and saved as script.cql (type ANSI)
(script within the DB)
Soon after, the prompt_pas_linux_32 was invoked in line comando.Enter the
command menu options, choose [X], and inform the way Cgl type script: "BANCO-CSV /
script.cql".
we left the CQL content within the right text editor.At right, running on the Linux
Lubuntu prompt_pas 32-bit)
Results can be seen immediately below
(both in spreadsheet or prompt_pas, we can see the data from AGENDA.csv table)
(* We have prompt_pas for Windows and Linux 32 bits.Devem be performed in the
presence of CSV_PARSER or CSV_PARSER.exe in related operating systems)
legend
Syntax can be applied to release:
[wd32] - Windows 32-bit Desktop
[ws32] - CGI Windows Server 32-bit
[wd64] - Windows 64-bit Desktop
[ws64] - CGI Windows Server 64-bit
[wc32] - Windows CE Mobile Desktop 32-bit
[ld32] - Linux Desktop 32-bit
[ls32] - CGI Linux Server 32-bit
[ld64] - Linux Desktop 64-bit
[ls64] - CGI Linux Server 64-bit
* be informed on the description of each block
As reported, the CQL syntax can be embedded in any programming language for
CSV data management within the CSV Comp DB and is arguably the best API to CSV data
management.
Standard formatting CSV Comp DB
The CSV file used in CSV Comp should follow the following formatting model:
The default delimiter must be semicolon (;)
eg Child; 23,56; male; [photo]
• In the first line of a CSV file must have a header stating the table
fields, preferably in capital letters and text without space, using
underscore (_) instead of space.
eg TIPO_PESSOA; WEIGHT; SEX; PHOTO
• Do not include text quotations or blank in a particular field.
eg "my data"; "other data" <wrong way
eg meu_dado; outro_dado <right way
(in case of URL, the dash "-" should be used instead to underscore "_")
• Use a comma to real numbers
eg 2,34; 34,67 <that allows mathematical calculations
• An empty field can be used, just leave it blank, but keeping the frame.
eg TIPO_PESSOA; WEIGHT; SEX; PHOTO <4 fields in the table
Child; 23,56;; [photo] <SEX field is left blank
CSV Comp DB - Syntax CQL
(* Syntax in blue, black and description in comments red.O
cometary should not be part of the CQL code execution).
id_query, id_destino must be an integer value that inform
the content of a field in required cases.
------------------------------------------------------------------------
A file in the format * .CSV formatted according to this document is considered
a database table able to be treated as a true relational table (or if no other
application needs) .In image below, see the description of how the mechanism
using search pointers and Input and Output (I / O) * .csv table.
(Operational details of the search pointers and I / O)
In cases where "id_query" and "id_destino" are required, the function works
with sub internal functions using pointers in RAM.While the verification pointer
traverses the top of the table below, it does so using the index pointed to by
"id_query" informing the search column where data coincide (identifier) .The
function will make a read or write to point where "id_destino" set.Each column
(field) of the table * .csv has a number from 0 to N (provided that there is some
field in this given table) .All process is performed in RAM (buffer) after the
shot CSV_PARSER.
This new CQL command was added into Project
@conta
{
..path\table;
@conta;
(word_list_semicolon_separated);
0;
0;
0;
query=0;
destino=0
}
A result with all words count ocurrency will be shown on *.que*
table file result
------------------------------------------------------------------------
@dna_show
{
none;
@dna_show;
(input_que_result_file);
(bitmap_output_file);
0;
0;
query=1; //index position
destino=0
}
This will produce a bitmap file from a que result
file with dna pixels representantions as:
(each pixel has a color)
1. The DNA base A as BLUE COLOR
2. The DNA base C as RED COLOR
3. The DNA base G as GREEN COLOR
4. The DNA base T as YELLOW COLOR
------------------------------------------------------------------------
@bigdata
{
none;
@bigdata;
(table_name);
(fields_list);
(max_table_number[0..n]);
0;
query=0;
destino=0
}
It permites create a bigdata structure with shardding tables
------------------------------------------------------------------------
@hash
{
none;
@hash;
(c:\tables_list;c:\more_tables);
(csv_out_table_name);
0;
0;
query=0;
destino=0
}
Permites to create a detail table with given table name.
------------------------------------------------------------------------
@dna_match
{
...path\table; //table
@dna_macth;
(id_identifier); //id on table
(id_dna_sequence); //ACGCTG...
0;
0;
query=id_query; //index where to find
destino=id_destin //index where to write to
}
It permites to compares two dna fragments ,resulting in
percent os macth between them.(0 to 100%).
------------------------------------------------------------------------
@fragmentar
{
...path\table; //table
@fragmentar;
(...path\dir\); //Output dir
0;
0;
0;
query=0;
destino=0
}
This function permites to shard a table.Each field of header
becames a single table.Usefull to search one data on table and shard
the result in single table by field.After we can plot (@plotar) on
html form page like this:
(A data "003" is searched on table)
After @fragmentar CQL command,"Table.que" is shardded and reload
with @plotar function to html page like this:
(New Form created with loadded result dataset)
------------------------------------------------------------------------
@stl
{
none;
@stl;
(path/bitmap-file.bmp); //Input bmp File
(path/stl-file.stl); //Output stl file
(1); // Number must be 1
0;
query=0;
destino=0
}
(bmp to stl 3d mash file.You can import to Google Skatchup)
This function allow to transform a Gray Scale bitmap file ,based on www.inpe.br
to create a 3D Mash stl file (3d printer compatible)
------------------------------------------------------------------------
@Pesquisar_dif
{
Path/Table;
@pesquisar_dif;
Field; //Field name
id_data; // Different Data (returns all register/docs)
0;
0;
query=id_query; //index to find on table (value)
destino=0
}
It permits find all different (<>) data. (e.g data<>id_data by key
index on field at id_query)
------------------------------------------------------------------------
@incluir_campo
{
Path/Table;
@incluir_campo;
New Field; //New Field add
0;
0;
0;
query=0;
destino=id_destino //index to where sets new field
}
It permits insert a new field on csv table.
------------------------------------------------------------------------
@excluir_campo
{
Path/Table;
@excluir_campo;
0;
0;
0;
0;
query=0;
destino=id_destino //index from where exclud a field
}
It permits exclude a field on csv table.
------------------------------------------------------------------------
@Max
//select all itens of one column
{path/Table;@listar;0;0;0;0;query=id_query;destino=0}
//create a result table
{path/Result;@tabela;0;0;0;0;query=0;destino=0}
//copy the results ".que" to new table "Result"
{path/Result;@datamemo;(path/table.que);0;0;0;query=
0;destino=0}
//select max on the new table
{path/Result;@max;0;0;0;0;query=0;destino=0}
This function allow to find a max value in a regular column.Must be used after
@listar CQL Command.
------------------------------------------------------------------------
@Min
//select all itens of one column
{path/Table;@listar;0;0;0;0;query=id_query;destino=0}
//create a result table
{path/Result;@tabela;0;0;0;0;query=0;destino=0}
//copy the results ".que" to new table "Result"
{path/Result;@datamemo;(path/table.que);0;0;0;query=
0;destino=0}
//select min on the new table
{path/Result;@min;0;0;0;0;query=0;destino=0}
This function allow to find a min value in a regular column.Must be used after
@listar CQL Command.
------------------------------------------------------------------------
@Media
//select all itens of one column
{path/Table;@listar;0;0;0;0;query=id_query;destino=0}
//create a result table
{path/Result;@tabela;0;0;0;0;query=0;destino=0}
//copy the results ".que" to new table "Result"
{path/Result;@datamemo;(path/table.que);0;0;0;query=
0;destino=0}
//select average on the new table
{path/Result;@media;0;0;0;0;query=0;destino=0}
This function allow to find a average value in a regular column.Must be used
after @listar CQL Command.
The @imp_mapa and @exp_mapa can handle bitmap,pixels by use select etc.The
@imp_mapa allow import a bitmap gray scale (or other color) as a Geo Process
normalized table.The gray scale is based o *INPE colors to altitude.Resolution
30,86m by offset(64 offset colors)
(*Instituto Nacional de Pesquisas Espaciais :http://www.inpe.br)
you can see how it works on my youtube channel:
https://www.youtube.com/watch?v=1r5-TbNc3Q4
So,you can handle Geo Process using CQL on Desktop or WEB ( Bitmap nativelly
created from a normalized table)
(A River in green was select from csv table and show us as a bitmap.It means,select by
entity or coords)
------------------------------------------------------------------------
@tabela
{
path/id_table; < table criated
@tabela; < operation
0;
0;
0;
0;
query=0;
destino=0
}
Creates a table where informed the path / table without writing extension *
.csv
(+)Adição
{
id_table; < table access
+; < operation
id_field;
id_data; < if exists
id_value; < value sum
id_field_destino;
query=id_query;
destino=id_destino
}
CQL block for Addition (+). A value in a certain field (id_destino) of a table
(id_table) in csv will be added if (id_field) is found in the search index
(id_query).
------------------------------------------------------------------------
(-)Subtração
{
id_table; < table access
-; < operation
id_field;
id_data; < if exists
id_value; < value que será subtraído
id_field_destino;
query=id_query;
destino=id_destino
}
And in addition, however, subtracting value in the field informed
------------------------------------------------------------------------
(*)Multiplicação
{
id_table; < table access
*; < operation
id_field;
id_data; < if exists
id_value; < value set
id_field_destino;
query=id_query;
destino=id_destino
}
As in addition, multiplication using
------------------------------------------------------------------------
(/)Divisão
{
id_table; < table access
/; < operation
id_field;
id_data; <if exists
id_value; < value set
id_field_destino;
query=id_query;
destino=id_destino
}
As in addition, division using
------------------------------------------------------------------------
(%)porcentagem
{
id_table; < table access
%; < operation
id_field;
id_data; < if exists
id_value; < value set
id_field_destino;
query=id_query;
destino=id_destino
}
And in addition, using percetagem calculations where the target will be
reduced by the amount in id_value.If id_value is 50, then the value of the column
will be id_destino half.
------------------------------------------------------------------------
@power
{
id_table; < table access
@power; < operation
id_field;
id_data;
0;
0;
query=id_query;
destino=id_destino
}
Where given match, the value specified in the column will be informed id_destino
squared.
------------------------------------------------------------------------
@raiz
{
id_table; < table access
@raiz; < operation
id_field;
id_data; < data
0;
0;
query=id_query;
destino=id_destino
}
Transforms the data found in id_destino content on his square root only if
id_data on id_field in the tuple is coincidental.
------------------------------------------------------------------------
@somar
{
id_table; < table access
@somar; < operation
id_field;
id_field; < Only if exists
0;
0;
query=id_query;
destino=id_destino
}
Sum of all items in a column (id_destino) that occurring in id_field is
conincidente in the tuple, sending results to msg.csv.
------------------------------------------------------------------------
@somartodos
{
id_table; < table access
@somartodos; < operation
id_field;
0;
0;
0;
query=id_query; < colunm index sum
destino=0
}
Sum of all items in a column (id_query), not changing the data in csv table,
but extracting the value added to msg.csv file.
------------------------------------------------------------------------
@subs
{
id_table; < table access
@subs; < operation
id_field;
id_field; < Only if exists
id_novo_dado; < data is changed
id_field_destino;
query=id_query;
destino=id_destino
}
Runs csv table, replacing the id_destino column at id_novo_dado every time
id_field is coincidente.See below:
(Prompt_pas Application in Lubuntu Linux 32-bit)
------------------------------------------------------------------------
@adicionar
{
id_table; < table access
@adicionar; < operation
(DADOS_X;DADOS_Y;DADOS_Z); < added
0;
0;
0;
query=0;
destino=0
}
In this case, the data is entered in CSV.O number of fields table must be
accurate.
------------------------------------------------------------------------
@adicionar_formatado
{
id_table; < table access
@adicionar_formatado; < operation
2; < ( length till 32)
(DADOS_X;DADOS_Y;DADOS_Z); < added
1; < field or colunm
0;
query=0;
destino=0
}
Field is added to the specified format, where the maximum length is
determined, with the right count to the left of a given string;
-----------------------------------------------------------------
@excluir
{
id_table;
@excluir;
(table_a,table_b,table...); < exclude in many
(records_by_key); < records in index 0
0;
0;
query=0;
destino=0
}
Exclude in many tables records with key in index 0 (zero)
------------------------------------------------------------------------
@algo
{
id_table; < table access
@algo; < operation
(data_search_in_full_text_mode); < data
0;
0;
0;
query=0;
destino=0
}
Returns all rows (records) which occur such information, even duplicadas.The
result is automatically saved to files *.que that of the same name
(id_table.que).
------------------------------------------------------------------------
@pesquisar
{
id_table; < table access
@pesquisar; < operation
(id_field);
(id_field); < data
0;
0;
query=id_query; < value ,index column
destino=0
}
Returns all rows (records) which occur such information, even dobled.The
result is automatically saved to files *.que that of the same name
(id_table.que) .This command allows you to search with similar parameter.Function
the (Select * from id_table where id_query = data)
------------------------------------------------------------------------
@pesquisar>=
{
id_table; < table access
@pesquisar>=; < operation
(id_field);
(id_field); < data
0;
0;
query=id_query; < value ,index colunm
destino=0
}
Returns all rows (records) which occur such information, even dobled.The result
is automatically saved to files *.que that of the same name (id_table.que)
.Search values greater than or equal to id_field.
------------------------------------------------------------------------
@pesquisar<=
{
id_table; < table access
@pesquisar<=; < operation
(id_field);
(id_data); < data
0;
0;
query=id_query; < value ,index colunm
destino=0
}
Returns all rows (records) which occur such information, even dobled.The result
is automatically saved to files *.que that of the same name (id_table.que)
.Search less than or equal to id_field values.
------------------------------------------------------------------------
@banco
{
none; < none access to table
@banco; < operation
(/home/user/your_DB); path/your_DB
0;
0;
0;
query=0;
destino=0
}
It lets you create a folder (DB) or directory in the location.
------------------------------------------------------------------------
@campos
{
id_table; < table access
@campos; < operation
(field_X;field_Y;field_...); < fields
0;
0;
0;
query=0;
destino=0
}
It allows you to create fields in the table CSV.Each field must be separated
by semicolons.
------------------------------------------------------------------------
@datamemo
{
id_table; < table access
@datamemo; < operation
(path/file.que); < copied file
0;
0;
0;
query=0;
destino=0
}
Copy a file to the table informada.Normalmente is used to create a function "Join"
to add search results files *.que which.
eg
{X;@algo, (id_data); 0; 0; 0; query = 0; destino = 0} <research X
{Y;@datamemo; (X.que); 0; 0; 0; query = 0; destino = 0} <adds results in Y
This allows many functions together.Must inform full path of the file and csv table.
------------------------------------------------------------------------
@del
{
id_table; < table access
@del; < operation
(#); < changes delimiter ";" by "#"
0;
0;
0;
query=0;
destino=0
}
CQL to replace delimter table CSV.Only used in case of need to export any
table to another platform.
------------------------------------------------------------------------
@redel
{
id_table; < table access
@redel; < operation
(#); < change delimiter by...
0; default delimiter (;)
0;
0;
query=0;
destino=0
}
Replaces any delimiter by default (;)
------------------------------------------------------------------------
@del_reg
(* delete all versions)
------------------------------------------------------------------------
@deletar_banco
{
none; < no tabela access
@deletar_banco; < operation
(/home/user/your_folder/); < your folder DB
0;
0;
0;
query=0;
destino=0
}
Deletes the database or folder.Must be observed changes in Windows and Linux:
path/database (Windows)
path/database/ (Linux)
------------------------------------------------------------------------
@delete
{
id_table; < table access
@delete; < operation
0;
0;
0;
0;
query=0;
destino=0
}
Delete the CSV table definitely informed.
------------------------------------------------------------------------
@desencriptar
{
id_script_cql_refrash;
@desencriptar; < operation
id_key; < key (int 0...9999)
id_HTTP_GET_cql_command;
id_delimiter(str);
0;
query=0;
destino=0
}
This command is used in Web Service using CGI to decrypt an integer value
(id_key) to meet an encrypted request (id_HTTP_GET_cql_command) .This way a desktop
application can modify a remotely based id_delimiter Security.The (str) varies with
the application of developer while id_key can serve as the private key code.
------------------------------------------------------------------------
@erase
{
id_table; < table access
@erase; < operation
0;
0;
0;
0;
query=0;
destino=0
}
Deletes contents of the CSV table, including their fields.
------------------------------------------------------------------------
@footer
{
id_table; < table access
@footer; < operation
(<elements_html>);
0;
0;
0;
query=0;
destino=0
}
Creates element that is part of the report or html pages.
------------------------------------------------------------------------
@header
{
id_table; < table access
@header; < operation
(<elements_html>);
0;
0;
0;
query=0;
destino=0
}
Inserts elements to html or web, such as <css>, <script> on servers.
------------------------------------------------------------------------
@html
{
id_table; < table access
@html; < operation
1; < bord with
2; < font size
red; < font color
(prop/sobriedade_v2.css );< html,css url with css path
query=0;
destino=0
}
This command draws a html page for the csv informed in id_table, including elements
stored in footer and header.
We can create a multitude of models for that command
(an desktop example of report using @html)
(an example of dynamic web page using @html)
------------------------------------------------------------------------
@html_objeto_div
{
id_tablea;
@html_objeto_div;
0;
0;
0;
0;
query=0;
destino=0
}
This commando inserts div html elements where "[]" is found.Used always @html or
@html_resposta
------------------------------------------------------------------------
@importar
{
id_local_table; <local table
@importar;
(http://remote_server/id_full_url.csv); < remote
0;
0;
0;
query=0;
destino=0
}
Imports a Remote CSV table from other server to a local table.The table
musb be creted before it
-----------------------------------------------------------------------
@indice
{
id_data_table; < table with records
@indice;
(key_index_table); <table with key index
(id_key_data); < key_to_find
0;
0;
query=0;
destino=0
}
The very fast search using key.Millions lines records in few seconds.
---------------------------------------------------------------------
@html_resposta
{
id_table; < table access
@html_resposta; < operation
1; < bord with
2; < font size
red; < font color
(prop/sobriedade_v2.css );< html,css url with css path
query=0;
destino=0
}
As @html, however, the html file is created based on file type *.que that what
exactly are the results of searches.The technique allows the development of dynamic
web pages or Desktop.An way to use them is of servers follows:
{X;@algo, (id_data); 0; 0; 0; query = 0; destino = 0} <"id_data" search.Results is
written in X.que.So, is created an html page with content:
{X;@html_resposta; 1; 2; red; <h1> Result </ h1>; query = 0; destino = 0}
(* especially used in Zframes application)
------------------------------------------------------------------------
@imagem
{
id_table; < table access
@imagem; < operation
(width='10'//height='12'); < Dimensions
0;
0;
0;
query=0;
destino=0
}
This command is used after the invocation of @html or @html_resposta.It allows the
html page for the CSV, all occurrences of "[... / image_file]" is displayed such an
image, informed by the file path.
In the example table:
NAME: PHOTO
Almir; [/home/User/foto.jpg]
in all occurrences "[]", an image will appear in the related html.
------------------------------------------------------------------------
@link
{
id_table; < table access
@link; < operation
(go_to_site); < link text
0;
0;
0;
query=0;
destino=0
}
This command is used after the invocation of @html or @ html_resposta.It allows the
html page for the CSV, all occurrences of "[... / file.pdf]" is shown such a link,
reported by the file path.
In the example table:
NAME: PHOTO
Almir; [/home/User/file.pdf]
in all occurrences "[]" a link will appear in the related html.
------------------------------------------------------------------------
@key
{
id_table; < table access
@key; < operation
id_field; < field search
(id_data); < data to find
0;
0;
query=id_query; < index field
destino=0
}
Do a search with the parameter informed csv table, returning only 1
result.Case there is more than one record, only returns the last.The return format
is in the form of stacked list.
------------------------------------------------------------------------
@length
{
id_table; < table access
@length; < operation
id_field; < field search
(id_data); < data to find
id_comprimento; < length integer
0;
query=id_query; < search index
destino=id_destino < to conform
}
Do a search parameter to the CSV table at locations that occur in the data search
index (csv column, ie id_query), place (id_destino column) is formed conform.The
data is formatted with id_comprimento.
------------------------------------------------------------------------
@listar
{
id_table; < table access
@listar; < operation
0;
0;
0;
0;
query=id_query; < search colunm index
destino=0
}
Do a search on the table, listing the column informed by id_query.The data is sent
to id_table.que file.
------------------------------------------------------------------------
@min_max
{
id_table; < table access
@min_max; < operation
id_field; < field search
(id_value_min); < value min
(id_value_max); < value max
0;
query=id_query; < search index
destino=0
}
Do a search on the table, trying column informed by id_query only real or
integer values between MINIMUM and MAX.How informed, results are written in file
type * .that the same name (id_table.que).
------------------------------------------------------------------------
@ordenar
{
id_table; < table access
@ordenar; < operation
id_value; < value defined colunm
id_value_comp.; < from 0 to 7 ,format
0;
0;
query=0;
destino=0
}
This command replaces all the items in a column, a numerical order that the length
of which ranges from 1 to 7 decimal places, with
the number 7 indicates only one string lenght.
------------------------------------------------------------------------
@parse
{
id_table; < table access
@parse; < operation
0;
0;
0;
0;
query=0;
destino=0
}
This command replaces all space (" ") by underscores ("_")
@reparse
{
id_table; < table access
@reparse; < operation
0;
0;
0;
0;
query=0;
destino=0
}
This command replaces all underscores ("_") by space (" ")
------------------------------------------------------------------------
@plotar
{
id_table; < table access
@plotar; < operation
<tag>; < tag changed
(path/file.xxx); < template file
0;
0;
query=0;
destino=0
}
Replaces <tag> contained in a CSV table for the content of inform.A copy html
file is saved based on CSV.It is useful in WEB dynamism, where a model can be
replicated.
------------------------------------------------------------------------
@resposta
{
none; < no tabela access
@resposta; < operation
<script>window.location='http://home.html'</script>;
0;
0;
0;
query=0;
destino=0
}
Specifically for use in web server where an HTML form or link sends browser to
the page indicated by the <java script>.
------------------------------------------------------------------------
@schema
{
id_table; < tabela access
@schema; < operation
0;
0;
0;
0;
query=0;
destino=0
}
Specifically for use in "GUI Prompt" on the desktop, which has the function to
show CSV.In case of the use table "prompt_pas" we have other means of opening the
CSV table to display data.
------------------------------------------------------------------------
more information at: http://adltecnologia.blogspot.com.br
mailto:[email protected]
Almir Bispo,
Ribeirão das Neves,25/04/2018