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

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Dernier (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

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