I'm creating a system in PHP and it has a Script that selects the module data requested by the user. Script creates the form to display and edit the data as per the field information of the tables. The problem I'm facing is that when the request is a record addition, I still need a Select in the table so that the form fields are displayed correctly, which is not happening. I need the query to return an empty record so that the Script can read the field information.
Select is as follows:
select ID, DATA, DESCRICAO from FERIADOS where (ID = 0)
I've tried it in many ways, but when it does not return any, it returns all:
select null, ID, DATA, DESCRICAO from FERIADOS where (ID = 0) //Não retorna nada
select ID, DATA, DESCRICAO from FERIADOS where (ID = 0) or (1=1) //Retorna todos os registros
select ID, DATA, DESCRICAO from FERIADOS where (ID = 0) and (1=1) //Não retorna nada
select coalesce(ID,''), coalesce(DATA,''), coalesce(DESCRICAO,'') from FERIADOS where (ID = 0) //Não retorna nada
select first 1 ID, DATA, DESCRICAO from FERIADOS //Eu poderia utilizar esse, mas há casos de tabelas vazias e ainda terei que zerar os valores dos campos
I thought about creating Stored Procedure to empty each field if the query was empty, but it is not possible to maintain the code, since I would have to create a SP for each table and the project idea is to use only Script for each type of request.
What function could I add in Select so that the query shows the fields even though no records return?