Created
October 4, 2014 19:26
-
-
Save CleitonDeLima/fe157de9d94ee03a7ff4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int insertValorTabela(table *tabela, column *c){ | |
int i = 0, erro = 0; char str[20]; | |
//Carrega dados da tabela para a variavel objetoTabela | |
struct fs_objects objetoTabela = leObjeto(tabela->nome);; | |
//Carrega dados dos atributos da tabela para a variavel campoTabela | |
struct tp_table *campoTabela = tabela->esquema; | |
//percorre os campos | |
while(objetoTabela.qtdCampos > i){ | |
if(campoTabela->tipo == 'S'){ | |
//scanf("%20[a-zA-Z0-9 ]%*[^\n]%*c", str); | |
printf("Atributo %s: ",campoTabela->nome); | |
scanf("%s", str); | |
c = insereValor(c, campoTabela->nome, str); | |
} | |
else if(campoTabela->tipo == 'I'){ | |
printf("Atributo %s: ",campoTabela->nome); | |
scanf("%s", str); | |
c = insereValor(c, campoTabela->nome, str); | |
} | |
else if(campoTabela->tipo == 'D'){ | |
printf("Atributo %s: ",campoTabela->nome); | |
scanf("%s", str); | |
c = insereValor(c, campoTabela->nome, str); | |
} | |
campoTabela = campoTabela->next; | |
i++; | |
} | |
erro = finalizaInsert(tabela->nome, c); | |
if(erro != SUCCESS){ | |
printf("Erro %d: na função finalizaInsert()\n", erro); | |
return 0; | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment