Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Fonte/sqlcommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -642,7 +647,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);
Expand Down Expand Up @@ -1082,7 +1087,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;
}
Expand Down