diff --git a/lib/db/arrienda.vala b/lib/db/arrienda.vala index c0d6875..f229b45 100644 --- a/lib/db/arrienda.vala +++ b/lib/db/arrienda.vala @@ -55,9 +55,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Arrienda + * @return Returns a list of Arrienda */ - public static Arrienda[]? get_all_arriendas(Database conn) { + public static List get_all_arriendas(Database conn) { var res = conn.exec (" SELECT A.precio, A.fecha_devolucion, V.patente, V.ano_vehiculo, V.marca, V.capacidad, @@ -71,12 +71,12 @@ JOIN empresa E ON (A.rut_empresa = E.rut_empresa) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Arrienda[] arriendas = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -93,7 +93,7 @@ JOIN empresa E ON (A.rut_empresa = E.rut_empresa) wra.get_int_n (i, "telefono") ) ); - arriendas += arrienda; + list.append (arrienda); } catch (Error e) { #if DEBUG @@ -103,7 +103,7 @@ JOIN empresa E ON (A.rut_empresa = E.rut_empresa) #endif } } - return arriendas; + return list; } } } diff --git a/lib/db/asociado.vala b/lib/db/asociado.vala index 43dfd01..1d084f8 100644 --- a/lib/db/asociado.vala +++ b/lib/db/asociado.vala @@ -49,9 +49,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Asociado + * @return Returns a list of Asociado */ - public static Asociado[]? get_all_asociados(Database conn) { + public static List get_all_asociados(Database conn) { var res = conn.exec (" SELECT A.fecha_llegada, A.hora_llegada, A.fecha_salida, A.hora_salida T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas, @@ -73,12 +73,12 @@ JOIN region R2 ON (C2.id_region = R2.id_region) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Asociado[] asociados = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -110,7 +110,7 @@ JOIN region R2 ON (C2.id_region = R2.id_region) ) ) ); - asociados += asociado; + list.append (asociado); } catch (Error e) { #if DEBUG @@ -120,7 +120,7 @@ JOIN region R2 ON (C2.id_region = R2.id_region) #endif } } - return asociados; + return list; } } } diff --git a/lib/db/categoria.vala b/lib/db/categoria.vala index 51918bf..9ddc4dc 100644 --- a/lib/db/categoria.vala +++ b/lib/db/categoria.vala @@ -43,9 +43,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Categoria + * @return Returns a list of Categoria */ - public static Categoria[]? get_all_categorias(Database conn) { + public static List get_all_categorias(Database conn) { var res = conn.exec (" SELECT id_categoria, descripcion_categoria FROM categoria "); @@ -54,19 +54,19 @@ SELECT id_categoria, descripcion_categoria FROM categoria error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Categoria[] categorias = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { var categoria = new Categoria (wra.get_int_n (i, "id_categoria"), wra.get_string_n (i, "descripcion_categoria") ); - categorias += categoria; + list.append (categoria); } catch (Error e) { #if DEBUG @@ -76,7 +76,7 @@ SELECT id_categoria, descripcion_categoria FROM categoria #endif } } - return categorias; + return list; } } } diff --git a/lib/db/ciudad.vala b/lib/db/ciudad.vala index 7cf6a9d..fad8ffb 100644 --- a/lib/db/ciudad.vala +++ b/lib/db/ciudad.vala @@ -49,9 +49,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Ciudad + * @return Returns a list of Ciudad */ - public static Ciudad[]? get_all_ciudades(Database conn) { + public static List get_all_ciudades(Database conn) { var res = conn.exec (" SELECT C.id_ciudad, C.nombre_ciudad, R.id_region, R.nombre_region @@ -63,12 +63,12 @@ JOIN region R ON (C.id_region = R.id_region) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Ciudad[] ciudades = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -78,7 +78,7 @@ JOIN region R ON (C.id_region = R.id_region) wra.get_string_n (i, "nombre_region") ) ); - ciudades += ciudad; + list.append (ciudad); } catch (Error e) { #if DEBUG @@ -88,7 +88,7 @@ JOIN region R ON (C.id_region = R.id_region) #endif } } - return ciudades; + return list; } } } diff --git a/lib/db/contacto_emergencia.vala b/lib/db/contacto_emergencia.vala index 544a544..74b3156 100644 --- a/lib/db/contacto_emergencia.vala +++ b/lib/db/contacto_emergencia.vala @@ -49,21 +49,21 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of ContactoEmergencia + * @return Returns a list of ContactoEmergencia */ - public static ContactoEmergencia[]? get_all_contactos(Database conn) { + public static List get_all_contactos(Database conn) { var res = conn.exec ("SELECT id_contacto, telefono_emergencia, nombre_emergencia FROM contacto_emergencia"); if (res.get_status () != ExecStatus.TUPLES_OK) { #if DEBUG error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - ContactoEmergencia[] contactos = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -71,7 +71,7 @@ namespace LibSernatur { wra.get_int_n (i, "telefono_emergencia"), wra.get_string_n (i, "nombre_emergencia") ); - contactos += contacto; + list.append (contacto); } catch (Error e) { #if DEBUG @@ -81,7 +81,7 @@ namespace LibSernatur { #endif } } - return contactos; + return list; } } } diff --git a/lib/db/descuento.vala b/lib/db/descuento.vala index bcaf9eb..eb83539 100644 --- a/lib/db/descuento.vala +++ b/lib/db/descuento.vala @@ -49,9 +49,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Descuento + * @return Returns a list of Descuento */ - public static Descuento[]? get_all_descuentos(Database conn) { + public static List get_all_descuentos(Database conn) { var res = conn.exec (" SELECT id_descuento, descripcion_descuento, porcentaje FROM descuento "); @@ -60,12 +60,12 @@ SELECT id_descuento, descripcion_descuento, porcentaje FROM descuento error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Descuento[] descuentos = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -73,7 +73,7 @@ SELECT id_descuento, descripcion_descuento, porcentaje FROM descuento wra.get_string_n (i, "descripcion_descuento"), wra.get_float_n (i, "porcentaje") ); - descuentos += descuento; + list.append (descuento); } catch (Error e) { #if DEBUG @@ -83,7 +83,7 @@ SELECT id_descuento, descripcion_descuento, porcentaje FROM descuento #endif } } - return descuentos; + return list; } } } diff --git a/lib/db/empresa.vala b/lib/db/empresa.vala index e19faa4..4dc3f6c 100644 --- a/lib/db/empresa.vala +++ b/lib/db/empresa.vala @@ -55,9 +55,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Empresa + * @return Returns a list of Empresa */ - public static Empresa[]? get_all_empresas(Database conn) { + public static List get_all_empresas(Database conn) { var res = conn.exec (" SELECT rut_empresa, nombre_empresa, contacto, telefono FROM empresa "); @@ -66,12 +66,12 @@ SELECT rut_empresa, nombre_empresa, contacto, telefono FROM empresa error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Empresa[] empresas = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -80,7 +80,7 @@ SELECT rut_empresa, nombre_empresa, contacto, telefono FROM empresa wra.get_string_n (i, "contacto"), wra.get_int_n (i, "telefono") ); - empresas += empresa; + list.append (empresa); } catch (Error e) { #if DEBUG @@ -90,7 +90,7 @@ SELECT rut_empresa, nombre_empresa, contacto, telefono FROM empresa #endif } } - return empresas; + return list; } } } diff --git a/lib/db/enfermedad.vala b/lib/db/enfermedad.vala index c5c738b..a8640ed 100644 --- a/lib/db/enfermedad.vala +++ b/lib/db/enfermedad.vala @@ -43,9 +43,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Enfermedad + * @return Returns a list of Enfermedad */ - public static Enfermedad[]? get_all_enfermedades(Database conn) { + public static List get_all_enfermedades(Database conn) { var res = conn.exec (" SELECT id_enfermedad, descripcion_enfermedad FROM enfermedad "); @@ -54,19 +54,19 @@ SELECT id_enfermedad, descripcion_enfermedad FROM enfermedad error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Enfermedad[] enfermedades = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { var enfermedad = new Enfermedad (wra.get_int_n (i, "id_enfermedad"), wra.get_string_n (i, "descripcion_enfermedad") ); - enfermedades += enfermedad; + list.append (enfermedad); } catch (Error e) { #if DEBUG @@ -76,7 +76,7 @@ SELECT id_enfermedad, descripcion_enfermedad FROM enfermedad #endif } } - return enfermedades; + return list; } } } diff --git a/lib/db/especialidad.vala b/lib/db/especialidad.vala index 7773f89..99915d8 100644 --- a/lib/db/especialidad.vala +++ b/lib/db/especialidad.vala @@ -43,9 +43,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Especialidad + * @return Returns a list of Especialidad */ - public static Especialidad[]? get_all_especialidades(Database conn) { + public static List get_all_especialidades(Database conn) { var res = conn.exec (" SELECT id_especialidad, descripcion_especialidad FROM especialidad "); @@ -54,19 +54,19 @@ SELECT id_especialidad, descripcion_especialidad FROM especialidad error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Especialidad[] especialidades = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { var especialidad = new Especialidad (wra.get_int_n (i, "id_especialidad"), wra.get_string_n (i, "descripcion_especialidad") ); - especialidades += especialidad; + list.append (especialidad); } catch (Error e) { #if DEBUG @@ -76,7 +76,7 @@ SELECT id_especialidad, descripcion_especialidad FROM especialidad #endif } } - return especialidades; + return list; } } } diff --git a/lib/db/guia.vala b/lib/db/guia.vala index ef6cada..b93e139 100644 --- a/lib/db/guia.vala +++ b/lib/db/guia.vala @@ -61,9 +61,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Guia + * @return Returns a list of Guia */ - public static Guia[]? get_all_guias(Database conn) { + public static List get_all_guias(Database conn) { var res = conn.exec (" SELECT G.rut_guia, G.nombre_guia, G.calle, G.numero, C.id_ciudad, C.nombre_ciudad, @@ -77,12 +77,12 @@ JOIN region R ON (C.id_region = R.id_region) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Guia[] guias = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -97,7 +97,7 @@ JOIN region R ON (C.id_region = R.id_region) ) ) ); - guias += guia; + list.append (guia); } catch (Error e) { #if DEBUG @@ -107,7 +107,7 @@ JOIN region R ON (C.id_region = R.id_region) #endif } } - return guias; + return list; } } } diff --git a/lib/db/lugar.vala b/lib/db/lugar.vala index 8098978..93288df 100644 --- a/lib/db/lugar.vala +++ b/lib/db/lugar.vala @@ -61,9 +61,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Lugar + * @return Returns a list of Lugar */ - public static Lugar[]? get_all_lugares(Database conn) { + public static List get_all_lugares(Database conn) { var res = conn.exec (" SELECT L.id_lugar, L.nombre_lugar, L.valor_entrada, L.nivel, C.id_ciudad, C.nombre_ciudad, @@ -77,12 +77,12 @@ JOIN region R ON (C.id_region = R.id_region) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Lugar[] lugares = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -97,7 +97,7 @@ JOIN region R ON (C.id_region = R.id_region) ) ) ); - lugares += lugar; + list.append (lugar); } catch (Error e) { #if DEBUG @@ -107,7 +107,7 @@ JOIN region R ON (C.id_region = R.id_region) #endif } } - return lugares; + return list; } } } diff --git a/lib/db/participa.vala b/lib/db/participa.vala index 0ef4c99..8ca6671 100644 --- a/lib/db/participa.vala +++ b/lib/db/participa.vala @@ -49,9 +49,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Participa + * @return Returns a list of Participa */ - public static Participa[]? get_all_participas(Database conn) { + public static List get_all_participas(Database conn) { var res = conn.exec (" SELECT T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas, C.id_ciudad, C.nombre_ciudad, @@ -74,12 +74,12 @@ JOIN categoria C3 ON (P.id_categoria = C3.id_categoria) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper(res); - Participa[] participas = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -110,7 +110,7 @@ JOIN categoria C3 ON (P.id_categoria = C3.id_categoria) wra.get_string_n (i, "descripcion_categoria") ) ); - participas += participa; + list.append (participa); } catch (Error e) { #if DEBUG @@ -120,7 +120,7 @@ JOIN categoria C3 ON (P.id_categoria = C3.id_categoria) #endif } } - return participas; + return list; } } } diff --git a/lib/db/posee.vala b/lib/db/posee.vala index 59e0e6f..d55e194 100644 --- a/lib/db/posee.vala +++ b/lib/db/posee.vala @@ -49,9 +49,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Posee + * @return Returns a list of Posee */ - public static Posee[]? get_all_posees(Database conn) { + public static List get_all_posees(Database conn) { var res = conn.exec (" SELECT P.nivel_especialidad, G.rut_guia, G.nombre_guia, G.calle, G.numero, @@ -69,12 +69,12 @@ JOIN especialidad E ON (P.id_especialidad = E.id_especialidad) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Posee[] posees = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -94,7 +94,7 @@ JOIN especialidad E ON (P.id_especialidad = E.id_especialidad) wra.get_string_n (i, "descripcion_especialidad") ) ); - posees += posee; + list.append (posee); } catch (Error e) { #if DEBUG @@ -104,7 +104,7 @@ JOIN especialidad E ON (P.id_especialidad = E.id_especialidad) #endif } } - return posees; + return list; } } } diff --git a/lib/db/realiza.vala b/lib/db/realiza.vala index 89c2ada..c189e8d 100644 --- a/lib/db/realiza.vala +++ b/lib/db/realiza.vala @@ -49,9 +49,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Realiza + * @return Returns a list of Realiza */ - public static Realiza[]? get_all_realizas(Database conn) { + public static List get_all_realizas(Database conn) { var res = conn.exec (" SELECT T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas, C.id_ciudad, C.nombre_ciudad, @@ -72,12 +72,12 @@ JOIN descuento D ON (RE.id_descuento = D.id_descuento) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Realiza[] realizas = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -107,7 +107,7 @@ JOIN descuento D ON (RE.id_descuento = D.id_descuento) wra.get_float_n (i, "porcentaje") ) ); - realizas += realiza; + list.append (realiza); } catch (Error e) { #if DEBUG @@ -117,7 +117,7 @@ JOIN descuento D ON (RE.id_descuento = D.id_descuento) #endif } } - return realizas; + return list; } } } diff --git a/lib/db/region.vala b/lib/db/region.vala index 097e682..297880e 100644 --- a/lib/db/region.vala +++ b/lib/db/region.vala @@ -43,9 +43,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Region + * @return Returns a list of Region */ - public static Region[]? get_all_regiones(Database conn) { + public static List get_all_regiones(Database conn) { var res = conn.exec (" SELECT id_region, nombre_region FROM region "); @@ -54,19 +54,19 @@ SELECT id_region, nombre_region FROM region error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Region[] regiones = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { var region = new Region (wra.get_int_n (i, "id_region"), wra.get_string_n (i, "nombre_region") ); - regiones += region; + list.append (region); } catch (Error e) { #if DEBUG @@ -76,7 +76,7 @@ SELECT id_region, nombre_region FROM region #endif } } - return regiones; + return list; } } } diff --git a/lib/db/requerir_auto.vala b/lib/db/requerir_auto.vala index c738681..f3e49e5 100644 --- a/lib/db/requerir_auto.vala +++ b/lib/db/requerir_auto.vala @@ -49,9 +49,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of RequerirAuto + * @return Returns a list of RequerirAuto */ - public static RequerirAuto[]? get_all_requerir_autos(Database conn) { + public static List get_all_requerir_autos(Database conn) { var res = conn.exec (" SELECT R.chofer, T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas, @@ -69,12 +69,12 @@ Join vehiculo V ON (R.patente = V.patente) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper(res); - RequerirAuto[] requerir_autos = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -97,7 +97,7 @@ Join vehiculo V ON (R.patente = V.patente) wra.get_int_n (i, "capacidad") ) ); - requerir_autos += requerir_auto; + list.append (requerir_auto); } catch (Error e) { #if DEBUG @@ -107,7 +107,7 @@ Join vehiculo V ON (R.patente = V.patente) #endif } } - return requerir_autos; + return list; } } } diff --git a/lib/db/tiene_enfermedad.vala b/lib/db/tiene_enfermedad.vala index 42b5ea4..dd3e495 100644 --- a/lib/db/tiene_enfermedad.vala +++ b/lib/db/tiene_enfermedad.vala @@ -43,9 +43,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of TieneEnfermedad + * @return Returns a list of TieneEnfermedad */ - public static TieneEnfermedad[]? get_all_tiene_enfermedades(Database conn) { + public static List get_all_tiene_enfermedades(Database conn) { var res = conn.exec (" SELECT T.rut_turista, T.nombre_turista, T.fecha_nacimento, C.id_contacto, C.telefono_emergencia, C.nombre_emergencia, @@ -60,12 +60,12 @@ JOIN enfermedad E ON (TE.id_enfermedad = E.id_enfermedad) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - TieneEnfermedad[] tiene_enfermedades = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -82,7 +82,7 @@ JOIN enfermedad E ON (TE.id_enfermedad = E.id_enfermedad) wra.get_string_n (i, "descripcion_enfermedad") ) ); - tiene_enfermedades += tiene_enfermedad; + list.append (tiene_enfermedad); } catch (Error e) { #if DEBUG @@ -92,7 +92,7 @@ JOIN enfermedad E ON (TE.id_enfermedad = E.id_enfermedad) #endif } } - return tiene_enfermedades; + return list; } } } diff --git a/lib/db/tour.vala b/lib/db/tour.vala index 3d5444d..e7e6849 100644 --- a/lib/db/tour.vala +++ b/lib/db/tour.vala @@ -67,9 +67,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Tour + * @return Returns a list of Tour */ - public static Tour[]? get_all_tours(Database conn) { + public static List get_all_tours(Database conn) { var res = conn.exec (" SELECT T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas, C.id_ciudad, C.nombre_ciudad, @@ -83,12 +83,12 @@ JOIN region R ON (C.id_region = R.id_region) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Tour[] tours = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -104,7 +104,7 @@ JOIN region R ON (C.id_region = R.id_region) ) ) ); - tours += tour; + list.append (tour); } catch (Error e) { #if DEBUG @@ -114,7 +114,7 @@ JOIN region R ON (C.id_region = R.id_region) #endif } } - return tours; + return list; } } } diff --git a/lib/db/turista.vala b/lib/db/turista.vala index 86f032b..b4b0a78 100644 --- a/lib/db/turista.vala +++ b/lib/db/turista.vala @@ -56,9 +56,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Turista + * @return Returns a list of Turista */ - public static Turista[]? get_all_turistas(Database conn) { + public static List get_all_turistas(Database conn) { var res = conn.exec (" SELECT T.rut_turista, T.nombre_turista, T.fecha_nacimento, C.id_contacto, C.telefono_emergencia, C.nombre_emergencia @@ -70,12 +70,12 @@ JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto) error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Turista[] turistas = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -87,7 +87,7 @@ JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto) wra.get_string_n (i, "nombre_emergencia") ) ); - turistas += turista; + list.append (turista); } catch (Error e) { #if DEBUG @@ -97,7 +97,7 @@ JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto) #endif } } - return turistas; + return list; } } } diff --git a/lib/db/vehiculo.vala b/lib/db/vehiculo.vala index 7da334a..6d98151 100644 --- a/lib/db/vehiculo.vala +++ b/lib/db/vehiculo.vala @@ -55,9 +55,9 @@ namespace LibSernatur { /** * Get all tuples and fields from database * @param conn The database connection to use - * @return Returns an array of Vehiculo + * @return Returns a list of Vehiculo */ - public static Vehiculo[]? get_all_vehiculos(Database conn) { + public static List get_all_vehiculos(Database conn) { var res = conn.exec (" SELECT patente, ano_vehiculo, marca, capacidad FROM vehiculo "); @@ -66,12 +66,12 @@ SELECT patente, ano_vehiculo, marca, capacidad FROM vehiculo error (conn.get_error_message ()); #else warning (conn.get_error_message ()); - return null; + return new List (); #endif } var wra = new ResultWrapper (res); - Vehiculo[] vehiculos = {}; + List list = new List (); int n = res.get_n_tuples (); for (int i = 0; i < n; i++) { try { @@ -80,7 +80,7 @@ SELECT patente, ano_vehiculo, marca, capacidad FROM vehiculo wra.get_string_n (i, "marca"), wra.get_int_n (i, "capacidad") ); - vehiculos += vehiculo; + list.append (vehiculo); } catch (Error e) { #if DEBUG @@ -90,7 +90,7 @@ SELECT patente, ano_vehiculo, marca, capacidad FROM vehiculo #endif } } - return vehiculos; + return list; } } }