SlideShare une entreprise Scribd logo
1  sur  2
Télécharger pour lire hors ligne
funct_format_sql_statement.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include   "constant_definition.h"
#include   "case_constant_definition.h"
#include   "case_constant_sql_stmt_def.h"
#include   "constant_oracle_versions.h"

extern vaciar_cadena();
extern pasar_amayus ();
extern stmtsqlncmp ();

char *formatear_sql_statement ( void *punt_cadena )
        {
        static char order_stmt [MAX_STMT_SIZE];
        static char auxi_stmt [MAX_STMT_SIZE];
        static char auxiliar [MAX_WORD_STMT];

       int    profu_parent =0;
       int    profu_comita =0;
       int    profu_comilla =0;

       int    contador_blanco =0;
       int    largo_cadena=0;
       int    posicion1=0;
       int    posicion2=0;
       int    posicion3=0;
       int    caracter=0;

       largo_cadena = (int )strlen ((char *) punt_cadena);
       vaciar_cadena (order_stmt, MAX_STMT_SIZE);
       vaciar_cadena (auxi_stmt, MAX_STMT_SIZE);

       posicion2=0;

       /* ************ Quitando espacios en blanco ************* */
       for (posicion1=0; posicion1 <= largo_cadena; posicion1++)
               {
               caracter = ((char *) punt_cadena )[posicion1];
               if ( caracter == ASCII_SPACE )
                       if ( contador_blanco == 0 )
                               {
                               contador_blanco++;
                               auxi_stmt [posicion2]=caracter;
                               posicion2++;
                               }
               if ( caracter != ASCII_SPACE)
                       {
                       contador_blanco=0;
                       auxi_stmt[posicion2]=caracter;
                       posicion2++;
                       }
               }
       auxi_stmt[posicion2]=ASCII_FIN_LINEA;
       /* ************ ||||||||||||||||||||||||||| ************* */
       largo_cadena=(int )strlen(auxi_stmt);
       posicion2=0;
       posicion3=0;
       vaciar_cadena (auxiliar,MAX_WORD_STMT);
       for (posicion1=0; posicion1 <= largo_cadena; posicion1++)
               {
               caracter = auxi_stmt [posicion1];
/*             printf ("C [%c=%d] ",caracter,caracter);               */
               if ( caracter != ASCII_SPACE )
                       {
                       auxiliar[posicion3]        = caracter;

                                      Página 1
funct_format_sql_statement.c
/*                  order_stmt[posicion2] = caracter;
                    posicion2++;
                    order_stmt[posicion2] = ASCII_FIN_LINEA;
*/
                     posicion3++;
                     auxiliar[posicion3] = ASCII_FIN_LINEA;
                     }
             else if (caracter == ASCII_SPACE )
                     {
                     if ( ( stmtsqlncmp (auxiliar,"select",6)==0 ) )
                             {
                             strcat (order_stmt," n");
                             strcat (order_stmt,auxiliar);
                             strcat (order_stmt," n");
                             posicion3=0;
                             vaciar_cadena (auxiliar,MAX_WORD_STMT);
                             }
                     else if ( (stmtsqlncmp (auxiliar,"from",4)==0 ) )
                             {
                             strcat (order_stmt," n");
                             strcat (order_stmt,auxiliar);
                             strcat (order_stmt," n");
                             posicion3=0;
                             vaciar_cadena (auxiliar,MAX_WORD_STMT);
                             }
                     else if ( (stmtsqlncmp (auxiliar,"where",5)==0 ) )
                             {
                             strcat (order_stmt," n");
                             strcat (order_stmt,auxiliar);
                             strcat (order_stmt," n");
                             posicion3=0;
                             vaciar_cadena (auxiliar,MAX_WORD_STMT);
                             }
                     else if ( (stmtsqlncmp (auxiliar,"group",5)==0) )
                             {
                             strcat (order_stmt," n");
                             strcat (order_stmt,auxiliar);
                             strcat (order_stmt," n");
                             posicion3=0;
                             vaciar_cadena (auxiliar,MAX_WORD_STMT);
                             }
                     else if ( (stmtsqlncmp (auxiliar,"order",5)==0) )
                             {
                             strcat (order_stmt," n");
                             strcat (order_stmt,auxiliar);
                             strcat (order_stmt," n");
                             posicion3=0;
                             vaciar_cadena (auxiliar,MAX_WORD_STMT);
                             }
                     strcat (order_stmt,auxiliar);
                     strcat (order_stmt,"    ");
                     posicion3=0;
                     vaciar_cadena (auxiliar,MAX_WORD_STMT);
                     }
             }
     return (order_stmt);
     }




                                 Página 2

Contenu connexe

En vedette

Func time sleep.c
Func time sleep.cFunc time sleep.c
Func time sleep.calbertinous
 
Funciones auxiliares.c
Funciones auxiliares.cFunciones auxiliares.c
Funciones auxiliares.calbertinous
 
Func dyn proc_func_set.c
Func dyn proc_func_set.cFunc dyn proc_func_set.c
Func dyn proc_func_set.calbertinous
 
Func dyn size_set.c
Func dyn size_set.cFunc dyn size_set.c
Func dyn size_set.calbertinous
 
Func dyn title_set.c
Func dyn title_set.cFunc dyn title_set.c
Func dyn title_set.calbertinous
 
Orastat line command
Orastat line commandOrastat line command
Orastat line commandalbertinous
 

En vedette (8)

Func time sleep.c
Func time sleep.cFunc time sleep.c
Func time sleep.c
 
Funciones auxiliares.c
Funciones auxiliares.cFunciones auxiliares.c
Funciones auxiliares.c
 
Func dyn proc_func_set.c
Func dyn proc_func_set.cFunc dyn proc_func_set.c
Func dyn proc_func_set.c
 
Func dyn size_set.c
Func dyn size_set.cFunc dyn size_set.c
Func dyn size_set.c
 
Func dyn title_set.c
Func dyn title_set.cFunc dyn title_set.c
Func dyn title_set.c
 
Orastat line command
Orastat line commandOrastat line command
Orastat line command
 
Menu orastat.c
Menu orastat.cMenu orastat.c
Menu orastat.c
 
Senten500.c
Senten500.cSenten500.c
Senten500.c
 

Similaire à Funct format sql_statement.c

Ugly code
Ugly codeUgly code
Ugly codeOdd-e
 
Climbing the Abstract Syntax Tree (Midwest PHP 2020)
Climbing the Abstract Syntax Tree (Midwest PHP 2020)Climbing the Abstract Syntax Tree (Midwest PHP 2020)
Climbing the Abstract Syntax Tree (Midwest PHP 2020)James Titcumb
 
Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)James Titcumb
 
Interpret this... (PHPem 2016)
Interpret this... (PHPem 2016)Interpret this... (PHPem 2016)
Interpret this... (PHPem 2016)James Titcumb
 
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)James Titcumb
 
Climbing the Abstract Syntax Tree (DPC 2017)
Climbing the Abstract Syntax Tree (DPC 2017)Climbing the Abstract Syntax Tree (DPC 2017)
Climbing the Abstract Syntax Tree (DPC 2017)James Titcumb
 
Climbing the Abstract Syntax Tree (phpDay 2017)
Climbing the Abstract Syntax Tree (phpDay 2017)Climbing the Abstract Syntax Tree (phpDay 2017)
Climbing the Abstract Syntax Tree (phpDay 2017)James Titcumb
 
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)James Titcumb
 
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)James Titcumb
 
Climbing the Abstract Syntax Tree (PHP South Africa 2017)
Climbing the Abstract Syntax Tree (PHP South Africa 2017)Climbing the Abstract Syntax Tree (PHP South Africa 2017)
Climbing the Abstract Syntax Tree (PHP South Africa 2017)James Titcumb
 
QA Auotmation Java programs,theory
QA Auotmation Java programs,theory QA Auotmation Java programs,theory
QA Auotmation Java programs,theory archana singh
 
Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)James Titcumb
 
Climbing the Abstract Syntax Tree (Southeast PHP 2018)
Climbing the Abstract Syntax Tree (Southeast PHP 2018)Climbing the Abstract Syntax Tree (Southeast PHP 2018)
Climbing the Abstract Syntax Tree (Southeast PHP 2018)James Titcumb
 
Climbing the Abstract Syntax Tree (Forum PHP 2017)
Climbing the Abstract Syntax Tree (Forum PHP 2017)Climbing the Abstract Syntax Tree (Forum PHP 2017)
Climbing the Abstract Syntax Tree (Forum PHP 2017)James Titcumb
 
Climbing the Abstract Syntax Tree (PHP Russia 2019)
Climbing the Abstract Syntax Tree (PHP Russia 2019)Climbing the Abstract Syntax Tree (PHP Russia 2019)
Climbing the Abstract Syntax Tree (PHP Russia 2019)James Titcumb
 
Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)ujihisa
 
Climbing the Abstract Syntax Tree (PHP Developer Days Dresden 2018)
Climbing the Abstract Syntax Tree (PHP Developer Days Dresden 2018)Climbing the Abstract Syntax Tree (PHP Developer Days Dresden 2018)
Climbing the Abstract Syntax Tree (PHP Developer Days Dresden 2018)James Titcumb
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and GoEleanor McHugh
 

Similaire à Funct format sql_statement.c (20)

Ugly code
Ugly codeUgly code
Ugly code
 
Climbing the Abstract Syntax Tree (Midwest PHP 2020)
Climbing the Abstract Syntax Tree (Midwest PHP 2020)Climbing the Abstract Syntax Tree (Midwest PHP 2020)
Climbing the Abstract Syntax Tree (Midwest PHP 2020)
 
Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)Climbing the Abstract Syntax Tree (IPC Fall 2017)
Climbing the Abstract Syntax Tree (IPC Fall 2017)
 
Interpret this... (PHPem 2016)
Interpret this... (PHPem 2016)Interpret this... (PHPem 2016)
Interpret this... (PHPem 2016)
 
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
Climbing the Abstract Syntax Tree (ScotlandPHP 2018)
 
Climbing the Abstract Syntax Tree (DPC 2017)
Climbing the Abstract Syntax Tree (DPC 2017)Climbing the Abstract Syntax Tree (DPC 2017)
Climbing the Abstract Syntax Tree (DPC 2017)
 
Climbing the Abstract Syntax Tree (phpDay 2017)
Climbing the Abstract Syntax Tree (phpDay 2017)Climbing the Abstract Syntax Tree (phpDay 2017)
Climbing the Abstract Syntax Tree (phpDay 2017)
 
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
Climbing the Abstract Syntax Tree (Bulgaria PHP 2016)
 
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
Climbing the Abstract Syntax Tree (CodeiD PHP Odessa 2017)
 
Climbing the Abstract Syntax Tree (PHP South Africa 2017)
Climbing the Abstract Syntax Tree (PHP South Africa 2017)Climbing the Abstract Syntax Tree (PHP South Africa 2017)
Climbing the Abstract Syntax Tree (PHP South Africa 2017)
 
QA Auotmation Java programs,theory
QA Auotmation Java programs,theory QA Auotmation Java programs,theory
QA Auotmation Java programs,theory
 
Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)Climbing the Abstract Syntax Tree (PHP UK 2018)
Climbing the Abstract Syntax Tree (PHP UK 2018)
 
Climbing the Abstract Syntax Tree (Southeast PHP 2018)
Climbing the Abstract Syntax Tree (Southeast PHP 2018)Climbing the Abstract Syntax Tree (Southeast PHP 2018)
Climbing the Abstract Syntax Tree (Southeast PHP 2018)
 
Climbing the Abstract Syntax Tree (Forum PHP 2017)
Climbing the Abstract Syntax Tree (Forum PHP 2017)Climbing the Abstract Syntax Tree (Forum PHP 2017)
Climbing the Abstract Syntax Tree (Forum PHP 2017)
 
Climbing the Abstract Syntax Tree (PHP Russia 2019)
Climbing the Abstract Syntax Tree (PHP Russia 2019)Climbing the Abstract Syntax Tree (PHP Russia 2019)
Climbing the Abstract Syntax Tree (PHP Russia 2019)
 
Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)Hacking parse.y (RubyKansai38)
Hacking parse.y (RubyKansai38)
 
Climbing the Abstract Syntax Tree (PHP Developer Days Dresden 2018)
Climbing the Abstract Syntax Tree (PHP Developer Days Dresden 2018)Climbing the Abstract Syntax Tree (PHP Developer Days Dresden 2018)
Climbing the Abstract Syntax Tree (PHP Developer Days Dresden 2018)
 
week-18x
week-18xweek-18x
week-18x
 
week-17x
week-17xweek-17x
week-17x
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
 

Plus de albertinous

Local functions preceded_calls.h
Local functions preceded_calls.hLocal functions preceded_calls.h
Local functions preceded_calls.halbertinous
 
Func menu mostrar.c
Func menu mostrar.cFunc menu mostrar.c
Func menu mostrar.calbertinous
 
Func dyn statement_set.c
Func dyn statement_set.cFunc dyn statement_set.c
Func dyn statement_set.calbertinous
 
Func dyn column_set.c
Func dyn column_set.cFunc dyn column_set.c
Func dyn column_set.calbertinous
 
Extern functions funciones_auxiliares.h
Extern functions funciones_auxiliares.hExtern functions funciones_auxiliares.h
Extern functions funciones_auxiliares.halbertinous
 
Decode name mode.c
Decode name mode.cDecode name mode.c
Decode name mode.calbertinous
 
Decode name lock.c
Decode name lock.cDecode name lock.c
Decode name lock.calbertinous
 
Decode lock mode.c
Decode lock mode.cDecode lock mode.c
Decode lock mode.calbertinous
 
Decode command oracle.c
Decode command oracle.cDecode command oracle.c
Decode command oracle.calbertinous
 
Constant oracle versions.h
Constant oracle versions.hConstant oracle versions.h
Constant oracle versions.halbertinous
 
Constant definition.h
Constant definition.hConstant definition.h
Constant definition.halbertinous
 
Case constant sql_stmt_def.h
Case constant sql_stmt_def.hCase constant sql_stmt_def.h
Case constant sql_stmt_def.halbertinous
 
Case constant func_def.h
Case constant func_def.hCase constant func_def.h
Case constant func_def.halbertinous
 
Case constant definition.h
Case constant definition.hCase constant definition.h
Case constant definition.halbertinous
 
Ver menu opcion.c
Ver menu opcion.cVer menu opcion.c
Ver menu opcion.calbertinous
 

Plus de albertinous (17)

Resource1
Resource1Resource1
Resource1
 
Local functions preceded_calls.h
Local functions preceded_calls.hLocal functions preceded_calls.h
Local functions preceded_calls.h
 
Func menu mostrar.c
Func menu mostrar.cFunc menu mostrar.c
Func menu mostrar.c
 
Func dyn statement_set.c
Func dyn statement_set.cFunc dyn statement_set.c
Func dyn statement_set.c
 
Func dyn column_set.c
Func dyn column_set.cFunc dyn column_set.c
Func dyn column_set.c
 
Extern functions funciones_auxiliares.h
Extern functions funciones_auxiliares.hExtern functions funciones_auxiliares.h
Extern functions funciones_auxiliares.h
 
Decode name mode.c
Decode name mode.cDecode name mode.c
Decode name mode.c
 
Decode name lock.c
Decode name lock.cDecode name lock.c
Decode name lock.c
 
Decode lock mode.c
Decode lock mode.cDecode lock mode.c
Decode lock mode.c
 
Decode command oracle.c
Decode command oracle.cDecode command oracle.c
Decode command oracle.c
 
Constant oracle versions.h
Constant oracle versions.hConstant oracle versions.h
Constant oracle versions.h
 
Constant definition.h
Constant definition.hConstant definition.h
Constant definition.h
 
Case constant sql_stmt_def.h
Case constant sql_stmt_def.hCase constant sql_stmt_def.h
Case constant sql_stmt_def.h
 
Case constant func_def.h
Case constant func_def.hCase constant func_def.h
Case constant func_def.h
 
Case constant definition.h
Case constant definition.hCase constant definition.h
Case constant definition.h
 
Ver menu opcion.c
Ver menu opcion.cVer menu opcion.c
Ver menu opcion.c
 
Orasta500.c
Orasta500.cOrasta500.c
Orasta500.c
 

Dernier

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Dernier (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Funct format sql_statement.c

  • 1. funct_format_sql_statement.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include "constant_definition.h" #include "case_constant_definition.h" #include "case_constant_sql_stmt_def.h" #include "constant_oracle_versions.h" extern vaciar_cadena(); extern pasar_amayus (); extern stmtsqlncmp (); char *formatear_sql_statement ( void *punt_cadena ) { static char order_stmt [MAX_STMT_SIZE]; static char auxi_stmt [MAX_STMT_SIZE]; static char auxiliar [MAX_WORD_STMT]; int profu_parent =0; int profu_comita =0; int profu_comilla =0; int contador_blanco =0; int largo_cadena=0; int posicion1=0; int posicion2=0; int posicion3=0; int caracter=0; largo_cadena = (int )strlen ((char *) punt_cadena); vaciar_cadena (order_stmt, MAX_STMT_SIZE); vaciar_cadena (auxi_stmt, MAX_STMT_SIZE); posicion2=0; /* ************ Quitando espacios en blanco ************* */ for (posicion1=0; posicion1 <= largo_cadena; posicion1++) { caracter = ((char *) punt_cadena )[posicion1]; if ( caracter == ASCII_SPACE ) if ( contador_blanco == 0 ) { contador_blanco++; auxi_stmt [posicion2]=caracter; posicion2++; } if ( caracter != ASCII_SPACE) { contador_blanco=0; auxi_stmt[posicion2]=caracter; posicion2++; } } auxi_stmt[posicion2]=ASCII_FIN_LINEA; /* ************ ||||||||||||||||||||||||||| ************* */ largo_cadena=(int )strlen(auxi_stmt); posicion2=0; posicion3=0; vaciar_cadena (auxiliar,MAX_WORD_STMT); for (posicion1=0; posicion1 <= largo_cadena; posicion1++) { caracter = auxi_stmt [posicion1]; /* printf ("C [%c=%d] ",caracter,caracter); */ if ( caracter != ASCII_SPACE ) { auxiliar[posicion3] = caracter; Página 1
  • 2. funct_format_sql_statement.c /* order_stmt[posicion2] = caracter; posicion2++; order_stmt[posicion2] = ASCII_FIN_LINEA; */ posicion3++; auxiliar[posicion3] = ASCII_FIN_LINEA; } else if (caracter == ASCII_SPACE ) { if ( ( stmtsqlncmp (auxiliar,"select",6)==0 ) ) { strcat (order_stmt," n"); strcat (order_stmt,auxiliar); strcat (order_stmt," n"); posicion3=0; vaciar_cadena (auxiliar,MAX_WORD_STMT); } else if ( (stmtsqlncmp (auxiliar,"from",4)==0 ) ) { strcat (order_stmt," n"); strcat (order_stmt,auxiliar); strcat (order_stmt," n"); posicion3=0; vaciar_cadena (auxiliar,MAX_WORD_STMT); } else if ( (stmtsqlncmp (auxiliar,"where",5)==0 ) ) { strcat (order_stmt," n"); strcat (order_stmt,auxiliar); strcat (order_stmt," n"); posicion3=0; vaciar_cadena (auxiliar,MAX_WORD_STMT); } else if ( (stmtsqlncmp (auxiliar,"group",5)==0) ) { strcat (order_stmt," n"); strcat (order_stmt,auxiliar); strcat (order_stmt," n"); posicion3=0; vaciar_cadena (auxiliar,MAX_WORD_STMT); } else if ( (stmtsqlncmp (auxiliar,"order",5)==0) ) { strcat (order_stmt," n"); strcat (order_stmt,auxiliar); strcat (order_stmt," n"); posicion3=0; vaciar_cadena (auxiliar,MAX_WORD_STMT); } strcat (order_stmt,auxiliar); strcat (order_stmt," "); posicion3=0; vaciar_cadena (auxiliar,MAX_WORD_STMT); } } return (order_stmt); } Página 2