public DTO.clsRespuesta Generar(DTO.clsParametros parametros) { DTO.clsRespuesta resp = new DTO.clsRespuesta(); BLL.bllGenerator bll = new BLL.bllGenerator(); DTO.clsResultado resultado = null; resp.Datos = bll.fnGenerar(parametros, out resultado); resp.Resultado = resultado; return(resp); }
public DTO.clsRespuesta ConsultarTablas(DTO.clsParametros parametros) { DTO.clsRespuesta resp = new DTO.clsRespuesta(); BLL.bllGenerator bll = new BLL.bllGenerator(); DTO.clsResultado resultado = null; resp.Datos = bll.fnConsultarTablas(parametros.BaseDeDatos, out resultado); resp.Resultado = resultado; return(resp); }
public List <DTO.clsCampo> fnConsultarCampos(DTO.clsParametros parametros, out DTO.clsResultado resultado) { List <DTO.clsCampo> ListaCampos = new List <DTO.clsCampo>(); resultado = new DTO.clsResultado(); try { using (MySqlConnection con = new MySqlConnection(strConexion)) { con.Open(); using (MySqlCommand cmd = new MySqlCommand( "SELECT COLUMN_NAME, ORDINAL_POSITION, IS_NULLABLE, " + "DATA_TYPE, " + "CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE, " + "DATETIME_PRECISION, COLUMN_KEY " + "FROM INFORMATION_SCHEMA.COLUMNS " + "WHERE table_name = '" + parametros.Tabla + "' " + "AND table_schema = '" + parametros.BaseDeDatos + "' " + "ORDER BY ORDINAL_POSITION", con)) { cmd.CommandType = System.Data.CommandType.Text; using (MySqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { DTO.clsCampo campo = new DTO.clsCampo(); campo.column_name = dr[0] as string; campo.ordinal_position = dr[1] as uint?; campo.is_nullable = (dr[2] as string).ToUpper().Equals("YES") ? true: false; campo.data_type = dr[3] as string; campo.character_maximum_length = dr[4] as long?; campo.numeric_precision = dr[5] as long?; campo.numeric_scale = dr[6] as long?; campo.datetime_precision = dr[7] as long?; campo.constraint_type = dr[8] as string; ListaCampos.Add(campo); } } } con.Close(); } } catch (Exception error) { resultado.Resultado = -1; resultado.Mensaje = "Se ha producido un error al consultar los campos de : " + parametros.Tabla + ": " + error.Message + "Stack: " + error.StackTrace; } return(ListaCampos); }