From 3b26666f2c16e17ba0d16c6d04bd365eceb07b86 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 17 May 2026 18:43:43 -0300 Subject: [PATCH 1/2] corrigido o bug do select * e select com mais de 7 colunas --- Fonte/sqlcommands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Fonte/sqlcommands.c b/Fonte/sqlcommands.c index 247d260..4f378da 100644 --- a/Fonte/sqlcommands.c +++ b/Fonte/sqlcommands.c @@ -642,7 +642,7 @@ int validaProj(Lista *proj, tp_table *colunas, int qtdColunas, int *indiceProj){ rmvNodoPtr(proj, proj->prim); proj->prim = proj->ult = NULL; for(int j = 0; j < qtdColunas; j++){ - indiceProj[j] = (char) j; + indiceProj[j] = j; //corrigido o (char) char *str = uffslloc(sizeof(char) * strlen(colunas[j].nome)); strcpy(str, colunas[j].nome); adcNodo(proj, proj->ult, str); @@ -1082,7 +1082,7 @@ Lista *handleTableOperation(inf_query *query, char tipo) { int *indiceProj = NULL, qtdCamposProj = 0; if(tipo == 's') { - indiceProj = (int *)uffslloc(sizeof(int) * query->proj->tam); + indiceProj = (int *)uffslloc(sizeof(int) * objeto.qtdCampos); //corigido o parametro if(!validaProj(query->proj, esquema, objeto.qtdCampos, indiceProj)){ return NULL; } From a40350251c436ed0a512d4534228c8ac41ddf95e Mon Sep 17 00:00:00 2001 From: JonatanMesne Date: Sun, 17 May 2026 19:16:08 -0300 Subject: [PATCH 2/2] =?UTF-8?q?corrigindo=20segmentation=20fault=20por=20t?= =?UTF-8?q?entar=20inserir=20em=20tabela=20que=20n=C3=A3o=20existe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Fonte/sqlcommands.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Fonte/sqlcommands.c b/Fonte/sqlcommands.c index 4f378da..d08d94a 100644 --- a/Fonte/sqlcommands.c +++ b/Fonte/sqlcommands.c @@ -581,6 +581,11 @@ void insert(rc_insert *s_insert) { memset(&objeto, 0, sizeof(struct fs_objects)); char flag=0; + if (!verificaNomeTabela(s_insert->objName)) { + printf("ERROR: table \"%s\" does not exist.\n", s_insert->objName); + return; + } + abreTabela(s_insert->objName, &objeto, &tabela->esquema); //retorna o esquema para a insere valor strcpylower(tabela->nome, s_insert->objName);