Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Criar várias tabelas, melhor método

Peço apenas que... busquem conhecimento (em java).

--
Atenciosamente,

Lucas Xavier


2013/7/25 Frederico Brigatte <frederico.brigatte@gmail.com>

Como seria esse array String?

 

 

Att,

Frederico Brigatte

frederico.brigatte@gmail.com

 

De: androidbrasil-dev@googlegroups.com [mailto:androidbrasil-dev@googlegroups.com] Em nome de Felipe Aron
Enviada em: quinta-feira, 25 de julho de 2013 14:51
Para: androidbrasil-dev@googlegroups.com
Assunto: Re: [androidbrasil-dev] Criar várias tabelas, melhor método

 

Depois das SQLs prontas (String) crie um array String[] e jogue as SQLs dentro.

 

Depois só fazer um for (String sql : seuArrayString) { db.execSQL(sql); }

 

2013/7/25 Frederico Brigatte <frederico.brigatte@gmail.com>

Meus amigos, tenho o seguinte script para montar as tabelas:

 

//  CRIA A TABELA CLIENTES

private static final String DATABASE_CREATE_CLIENTES = "create table clientes (id_Cliente integer primary key autoincrement, nome text, data text, telefone text, celular text, email text);";

   

 

//  CRIA A TABELA CARROS   

private static final String DATABASE_CREATE_CARROS = "create table veiculos (id_Veiculo integer primary key autoincrement,     

idCliente integer,  idTipoVeiculo integer, modelo text, placa text, FOREIGN KEY (idCliente) REFERENCES clientes(idCliente), FOREIGN KEY (id_TipoVeiculo) REFERENCES tipo_veiculo (id_TipoVeiculo));";

   

//  CRIA A TABELA TIPO_VEÍCULO

private static final String DATABASE_CREATE_TIPO_VEICULO = "create table tipo_veiculo (id_TipoVeiculo integer primary key autoincrement, descricao_tipo text));";

 

//  CRIA A TABELA SERVICOS

private static final String DATABASE_CREATE_SERVICOS = "create table servicos (id_Servico integer primary key autoincrement,  id_TipoVeiculo integer, descricao_ser text, valor text, FOREIGN KEY (id_TipoVeiculo) REFERENCES tipo_veiculo (id_TipoVeiculo));";

   

//  CRIA A TABELA HORARIOS

private static final String DATABASE_CREATE_HORARIOS = "create table horarios (id_Horario integer primary key autoincrement,  horario text);";

 

//  CRIA A TABELA OS

private static final String DATABASE_CREATE_OS = "create table os (id_Os integer primary key autoincrement, id_Cliente integer,     

id_Servico integer, id_Horario integer , modelo text, placa text, mecanico text, data text, FOREIGN KEY (id_Cliente) REFERENCES clientes (id_Cliente), FOREIGN KEY (id_Servico) REFERENCES servicos (id_Servico), FOREIGN KEY (id_Horario) REFERENCES horarios (id_Horario));";

 

 

db.execSQL(sqlClientes);

db.execSQL(sqlOutraTabela);

 

 

Qual o melhor método para criar as tabelas e o banco usando esse script ou StringBuilder?

 

 

 

Att,

Frederico Brigatte

frederico.brigatte@gmail.com

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



 

--

Analista-Programador

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário