-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from stdmedoth/funcionalidade_checar_tabelas
funcionalidade adicionada - checar se tabelas estão instaladas
- Loading branch information
Showing
14 changed files
with
234 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
IcmsInterestadual | ||
PessoasDistribuicao | ||
Produto_Orcamento | ||
agencia | ||
baixas_titulos | ||
bancos | ||
caixas | ||
cartao | ||
cartoes_checklists | ||
cfops | ||
cheque | ||
cheque_finan | ||
cidade | ||
compras | ||
confs | ||
contatos | ||
contratos | ||
cotacoes | ||
cotacoes_participantes | ||
credenciadoras | ||
criador_relat | ||
criticas | ||
cst_cson | ||
dados | ||
datas_livres_tab | ||
distribuicoes | ||
emails_body | ||
emails_footer | ||
emails_header | ||
emails_model | ||
empresa | ||
estados | ||
estoques | ||
eventos_caixa | ||
faturamento | ||
forma_pagamento | ||
frete_vlrs | ||
grupos | ||
historico | ||
itens_compras | ||
itens_cotacoes | ||
itens_ordens_compra | ||
logradouro | ||
logs | ||
maquinas | ||
meios_pagamento | ||
movimento_estoque | ||
movimentos_caixa | ||
ncm | ||
niveis_gerenciais | ||
operadores | ||
orc_datas_livres | ||
orc_param | ||
orcamentos | ||
orcs_cheques | ||
ordens_compra | ||
pag_cond | ||
parcelas_tab | ||
pedidos | ||
perfil_desktop | ||
pis_cofins | ||
preco_cliente | ||
precos | ||
prod_origem | ||
prod_requisicoes | ||
produtos | ||
relat_tab_campos | ||
relat_tabelas_id | ||
saldo_max | ||
saldo_min | ||
servico_transporte | ||
setores | ||
suporte_posts | ||
suporte_status | ||
suporte_tipos | ||
tecn_pers_elem | ||
terceiros | ||
tipo_movimentos | ||
tipo_terceiros | ||
titulos | ||
unidades | ||
wnd_logger |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
int check_tables(){ | ||
MYSQL_RES *res; | ||
MYSQL_ROW row; | ||
char query[MAX_QUERY_LEN]; | ||
FILE *fp = fopen(DB_TABLES_LIST_FILE, "r"); | ||
if(!fp){ | ||
popup(NULL,"Não foi possível verificar tabelas"); | ||
return 1; | ||
} | ||
int pos_line = 0; | ||
size_t line_buf_size = 0; | ||
pedidos_db_tables = malloc(MAX_TABLE_LEN * MAX_TABLE_QNT); | ||
pedidos_db_tables[pos_line] = malloc(MAX_TABLE_LEN); | ||
sprintf(query, "SHOW TABLES"); | ||
if(!(res = consultar(query))){ | ||
popup(NULL,"Não foi possível verificar tabelas"); | ||
return 1; | ||
} | ||
|
||
while((getline(&pedidos_db_tables[pos_line], &line_buf_size, fp))>0){ | ||
remover_barra_n(pedidos_db_tables[pos_line]); | ||
int table_exists = 0; | ||
|
||
while((row = mysql_fetch_row(res))){ | ||
if( !strcmp(row[0], pedidos_db_tables[pos_line]) ){ | ||
table_exists = 1; | ||
} | ||
} | ||
mysql_data_seek(res, 0); | ||
if(!table_exists){ | ||
char msg[27 + strlen(pedidos_db_tables[pos_line])]; | ||
sprintf(msg, "Tabela %s ausente no sistema!", pedidos_db_tables[pos_line]); | ||
popup(NULL,msg); | ||
return 1; | ||
} | ||
pos_line++; | ||
pedidos_db_tables[pos_line] = malloc(MAX_TABLE_LEN); | ||
} | ||
|
||
return 0; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
int check_tables(); | ||
|
||
char **pedidos_db_tables=NULL; |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
Tables_in_contas; | ||
IcmsInterestadual; | ||
PessoasDistribuicao; | ||
Produto_Orcamento; | ||
agencia; | ||
baixas_titulos; | ||
bancos; | ||
caixas; | ||
cartao; | ||
cartoes_checklists; | ||
cfops; | ||
cheque; | ||
cheque_finan; | ||
cidade; | ||
compras; | ||
confs; | ||
contatos; | ||
contratos; | ||
cotacoes; | ||
cotacoes_participantes; | ||
credenciadoras; | ||
criador_relat; | ||
criticas; | ||
cst_cson; | ||
dados; | ||
datas_livres_tab; | ||
distribuicoes; | ||
emails_body; | ||
emails_footer; | ||
emails_header; | ||
emails_model; | ||
empresa; | ||
estados; | ||
estoques; | ||
eventos_caixa; | ||
faturamento; | ||
forma_pagamento; | ||
frete_vlrs; | ||
grupos; | ||
historico; | ||
itens_compras; | ||
itens_cotacoes; | ||
itens_ordens_compra; | ||
logradouro; | ||
logs; | ||
maquinas; | ||
meios_pagamento; | ||
migrate; | ||
movimento_estoque; | ||
movimentos_caixa; | ||
ncm; | ||
niveis_gerenciais; | ||
operadores; | ||
orc_datas_livres; | ||
orc_param; | ||
orcamentos; | ||
orcs_cheques; | ||
ordens_compra; | ||
pag_cond; | ||
parcelas_tab; | ||
pedidos; | ||
perfil_desktop; | ||
pis_cofins; | ||
preco_cliente; | ||
precos; | ||
prod_origem; | ||
prod_requisicoes; | ||
produtos; | ||
relat_tab_campos; | ||
relat_tabelas_id; | ||
saldo_max; | ||
saldo_min; | ||
servico_transporte; | ||
setores; | ||
suporte_posts; | ||
suporte_status; | ||
suporte_tipos; | ||
tecn_pers_elem; | ||
terceiros; | ||
tipo_movimentos; | ||
tipo_terceiros; | ||
titulos; | ||
unidades; | ||
versao; | ||
wnd_logger; |