[Stacomir-commits] r549 - in pkg/stacomir: R inst/config inst/examples man tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Apr 6 07:56:58 CEST 2019


Author: briand
Date: 2019-04-06 07:56:57 +0200 (Sat, 06 Apr 2019)
New Revision: 549

Modified:
   pkg/stacomir/R/fun_write_monthly.R
   pkg/stacomir/R/ref_coe.R
   pkg/stacomir/R/ref_dc.R
   pkg/stacomir/R/ref_df.R
   pkg/stacomir/R/ref_env.R
   pkg/stacomir/R/ref_par.R
   pkg/stacomir/R/ref_parqual.R
   pkg/stacomir/R/ref_parquan.R
   pkg/stacomir/R/ref_stage.R
   pkg/stacomir/R/ref_taxa.R
   pkg/stacomir/R/ref_year.R
   pkg/stacomir/R/report_annual.R
   pkg/stacomir/R/report_dc.R
   pkg/stacomir/R/report_df.R
   pkg/stacomir/R/report_env.R
   pkg/stacomir/R/report_ge_weight.R
   pkg/stacomir/R/report_mig.R
   pkg/stacomir/R/report_mig_char.R
   pkg/stacomir/R/report_mig_interannual.R
   pkg/stacomir/R/report_mig_mult.R
   pkg/stacomir/R/report_ope.R
   pkg/stacomir/R/report_sample_char.R
   pkg/stacomir/R/report_sea_age.R
   pkg/stacomir/R/report_silver_eel.R
   pkg/stacomir/R/report_species.R
   pkg/stacomir/R/stacomi.R
   pkg/stacomir/R/utilities.R
   pkg/stacomir/inst/config/generate_data.R
   pkg/stacomir/inst/examples/report_annual-example.R
   pkg/stacomir/inst/examples/report_ge_weight-example.R
   pkg/stacomir/inst/examples/report_mig_char-example.R
   pkg/stacomir/inst/examples/report_mig_interannual-example.R
   pkg/stacomir/inst/examples/report_sea_age-example.R
   pkg/stacomir/inst/examples/report_silver_eel-example.R
   pkg/stacomir/man/report_annual-class.Rd
   pkg/stacomir/man/report_ge_weight-class.Rd
   pkg/stacomir/man/report_mig_char-class.Rd
   pkg/stacomir/man/report_mig_interannual-class.Rd
   pkg/stacomir/man/report_sea_age-class.Rd
   pkg/stacomir/man/report_silver_eel-class.Rd
   pkg/stacomir/tests/testthat/test-00-stacomir.R
   pkg/stacomir/tests/testthat/test-01-report_mig_mult.R
   pkg/stacomir/tests/testthat/test-02-report_mig.R
   pkg/stacomir/tests/testthat/test-03-report_df.R
   pkg/stacomir/tests/testthat/test-04-report_dc.R
   pkg/stacomir/tests/testthat/test-05-report_sample_char.R
   pkg/stacomir/tests/testthat/test-06-report_mig_interannual.R
   pkg/stacomir/tests/testthat/test-07-report_sea_age.R
   pkg/stacomir/tests/testthat/test-08-report_silver_eel.R
   pkg/stacomir/tests/testthat/test-09-report_annual.R
   pkg/stacomir/tests/testthat/test-10-report_env.R
   pkg/stacomir/tests/testthat/test-11-report_mig_env.R
   pkg/stacomir/tests/testthat/test-12-report_mig_char.R
   pkg/stacomir/tests/testthat/test-13-report_species.R
Log:
get("sch",envir_stacomi) fails and is now replaced by
rlang::env_get(envir_stacomi, "sch")
This is done in all functions accessing the database

Modified: pkg/stacomir/R/fun_write_monthly.R
===================================================================
--- pkg/stacomir/R/fun_write_monthly.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/fun_write_monthly.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -12,7 +12,10 @@
   # voir essai_table_reportmensuel.sql pour le format du tableau
   # below not the most elegant way to do it but efficient
   
-  t_reportmigrationmensuel_bme=stacomirtools::killfactor(
+  # bug 2019 the function does not work if only one month is reported
+  # for this reason we only launch the fun_write_month with col >3
+  # TODO manage this bug
+ t_reportmigrationmensuel_bme=stacomirtools::killfactor(
 	  cbind(report_mig at dc@dc_selectionne,
 		  report_mig at taxa@data$tax_code,
 		  report_mig at stage@data$std_code,
@@ -20,7 +23,7 @@
 		  rep(rownames(resum),(ncol(resum)-2)), # nb of month except columns report and label
 		  stack(resum,select=c(2:(ncol(resum)-1))),# stack re-ordonne les tab de donnees !  
 		  format(Sys.time(), "%Y-%m-%d %H:%M:%S"),
-		  substr(toupper(get("sch",envir=envir_stacomi)),1,nchar(toupper(get("sch",envir=envir_stacomi)))-1)
+		  substr(toupper(rlang::env_get(envir_stacomi, "sch")),1,nchar(toupper(rlang::env_get(envir_stacomi, "sch")))-1)
 	  )
   )
   
@@ -33,11 +36,12 @@
   for (i in 1:nrow(t_reportmigrationmensuel_bme)) {
 	requete=new("RequeteODBC")
 	requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
-	requete at sql=paste("INSERT INTO ",get("sch",envir=envir_stacomi),"t_report_migMensuel_bme (",			
+	requete at sql=paste("INSERT INTO ",rlang::env_get(envir_stacomi, "sch"),"t_report_migMensuel_bme (",			
 		"bme_dis_identifiant,bme_tax_code,bme_std_code,bme_annee,bme_labelquantite,bme_valeur,bme_mois,bme_horodateexport,bme_org_code)",
 		" VALUES ('",paste(t_reportmigrationmensuel_bme[i,],collapse="','"),"');",sep="")
 	invisible(utils::capture.output(stacomirtools::connect(requete)))
   } # end for
   if (!silent) funout(gettext("Writing monthly summary in the database\n",domain="R-stacomiR"))
+
 } # end function
 

Modified: pkg/stacomir/R/ref_coe.R
===================================================================
--- pkg/stacomir/R/ref_coe.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_coe.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -44,7 +44,7 @@
 	  requete at colonnefin="coe_date_fin"
 	  requete at datefin=as.POSIXlt(object at datefin)		
 	  requete at select=stringr::str_c("select * from ",
-		  get("sch",envir=envir_stacomi),
+		  rlang::env_get(envir_stacomi, "sch"),
 		  "tj_coefficientconversion_coe")
 	  requete at and=" and  coe_tax_code='2038' and coe_std_code='CIV' and coe_qte_code='1'"
 	  requete<-connect(requete)  
@@ -76,7 +76,7 @@
 	  requete at datefin<-object at datefin
 	  requete at colonnedebut<-"coe_date_debut"
 	  requete at colonnefin<-"coe_date_fin"
-	  requete at select=stringr::str_c("DELETE from ",get("sch",envir=envir_stacomi),"tj_coefficientconversion_coe ")
+	  requete at select=stringr::str_c("DELETE from ",rlang::env_get(envir_stacomi, "sch"),"tj_coefficientconversion_coe ")
 	  requete at and=str_c(" and  coe_tax_code='",tax,"' and coe_std_code='",std,"' and coe_qte_code='1'")
 	  requete<-stacomirtools::connect(requete)
 	  if (!silent) funout(gettextf("%s rows deleted from table tj_coefficientconversion_coe",nrow(object at data),domain="R-stacomiR"))

Modified: pkg/stacomir/R/ref_dc.R
===================================================================
--- pkg/stacomir/R/ref_dc.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_dc.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -61,12 +61,12 @@
 		  " tdf_libelle as type_DF,",
 		  " tdc_libelle as type_DC,",
 		  "sta_code",
-		  " FROM ",get("sch",envir=envir_stacomi),"tg_dispositif_dis",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_dispositifcomptage_dic ON dic_dis_identifiant =dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_dispositiffranchissement_dif ON dif_dis_identifiant=dic_dif_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"tj_dfesttype_dft ON dif_dis_identifiant=dft_df_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_ouvrage_ouv on dif_ouv_identifiant=ouv_identifiant", 
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_station_sta on ouv_sta_code=sta_code", 
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"tg_dispositif_dis",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_dispositifcomptage_dic ON dic_dis_identifiant =dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_dispositiffranchissement_dif ON dif_dis_identifiant=dic_dif_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"tj_dfesttype_dft ON dif_dis_identifiant=dft_df_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_ouvrage_ouv on dif_ouv_identifiant=ouv_identifiant", 
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_station_sta on ouv_sta_code=sta_code", 
 		  " JOIN ref.tr_typedf_tdf ON tdf_code=dft_tdf_code",
 		  " JOIN ref.tr_typedc_tdc ON dic_tdc_code=tdc_code",
 		  " WHERE  dft_rang=1",

Modified: pkg/stacomir/R/ref_df.R
===================================================================
--- pkg/stacomir/R/ref_df.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_df.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -56,10 +56,10 @@
 		  " dif_localisation,",
 		  " dif_orientation,",
 		  " tdf_libelle as type_DF",
-		  " from ",get("sch",envir=envir_stacomi),"tg_dispositif_dis",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_dispositiffranchissement_dif ON dif_dis_identifiant=dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"tj_dfesttype_dft ON dif_dis_identifiant=dft_df_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_ouvrage_ouv on dif_ouv_identifiant=ouv_identifiant",   
+		  " from ",rlang::env_get(envir_stacomi, "sch"),"tg_dispositif_dis",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_dispositiffranchissement_dif ON dif_dis_identifiant=dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"tj_dfesttype_dft ON dif_dis_identifiant=dft_df_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_ouvrage_ouv on dif_ouv_identifiant=ouv_identifiant",   
 		  " JOIN ref.tr_typedf_tdf ON tdf_code=dft_tdf_code",
 		  " ORDER BY dis_identifiant;",sep="")
 	  requete<-stacomirtools::connect(requete) 

Modified: pkg/stacomir/R/ref_env.R
===================================================================
--- pkg/stacomir/R/ref_env.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_env.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -32,7 +32,7 @@
 	  requete=new("RequeteODBC")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  requete at sql= paste("SELECT stm_identifiant, stm_libelle, stm_sta_code, stm_par_code, stm_description",
-		  " FROM ",get("sch",envir=envir_stacomi),"tj_stationmesure_stm", 
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"tj_stationmesure_stm", 
 		  " ORDER BY stm_identifiant;",sep="")
 	  requete at silent = TRUE;
 	  requete<-stacomirtools::connect(requete)    

Modified: pkg/stacomir/R/ref_par.R
===================================================================
--- pkg/stacomir/R/ref_par.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_par.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -70,11 +70,11 @@
 	  requete=new("RequeteODBCwhere")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  requete at select=paste("SELECT DISTINCT ON (par_code) par_code, par_nom", 
-		  " FROM ",get("sch",envir=envir_stacomi),"tg_dispositif_dis",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"tj_caracteristiquelot_car on car_lot_identifiant=lot_identifiant",
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"tg_dispositif_dis",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"tj_caracteristiquelot_car on car_lot_identifiant=lot_identifiant",
 		  " JOIN ref.tg_parametre_par on par_code=car_par_code",sep="")
 	  requete at where=paste("where dis_identifiant in ",vector_to_listsql(dc_selectionne))
 	  requete at and=paste("and lot_tax_code in",vector_to_listsql(taxa_selectionne),

Modified: pkg/stacomir/R/ref_parqual.R
===================================================================
--- pkg/stacomir/R/ref_parqual.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_parqual.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -47,11 +47,11 @@
 	  requete=new("RequeteODBCwhere")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  requete at select=paste("SELECT DISTINCT ON (par_code) par_code, par_nom", 
-		  " FROM ",get("sch",envir=envir_stacomi),"tg_dispositif_dis",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"tj_caracteristiquelot_car on car_lot_identifiant=lot_identifiant",
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"tg_dispositif_dis",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"tj_caracteristiquelot_car on car_lot_identifiant=lot_identifiant",
 		  " JOIN ref.tg_parametre_par on par_code=car_par_code",
 		  " JOIN ref.tr_parametrequalitatif_qal ON tr_parametrequalitatif_qal.qal_par_code::text = tg_parametre_par.par_code::text",sep="")
 	  requete at where=paste("where dis_identifiant in ",vector_to_listsql(dc_selectionne))

Modified: pkg/stacomir/R/ref_parquan.R
===================================================================
--- pkg/stacomir/R/ref_parquan.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_parquan.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -48,11 +48,11 @@
 	  requete=new("RequeteODBCwhere")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  requete at select=paste("SELECT DISTINCT ON (par_code) par_code, par_nom", 
-		  " FROM ",get("sch",envir=envir_stacomi),"tg_dispositif_dis",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"tj_caracteristiquelot_car on car_lot_identifiant=lot_identifiant",
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"tg_dispositif_dis",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"tj_caracteristiquelot_car on car_lot_identifiant=lot_identifiant",
 		  " JOIN ref.tg_parametre_par on par_code=car_par_code",
 		  " JOIN ref.tr_parametrequantitatif_qan ON qan_par_code=par_code",sep="")
 	  requete at where=paste("where dis_identifiant in ",vector_to_listsql(dc_selectionne))

Modified: pkg/stacomir/R/ref_stage.R
===================================================================
--- pkg/stacomir/R/ref_stage.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_stage.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -49,10 +49,10 @@
 	  requete=new("RequeteODBCwhere")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  requete at select=paste("SELECT DISTINCT ON (std_code) std_code, std_libelle", 
-		  " FROM ",get("sch",envir=envir_stacomi),"tg_dispositif_dis",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"tg_dispositif_dis",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
 		  " JOIN ref.tr_stadedeveloppement_std on lot_std_code=std_code",sep="")
 	  requete at where=paste("where dis_identifiant in ",vector_to_listsql(dc_selectionne),sep="")
 	  requete at and=paste("and lot_tax_code in ",vector_to_listsql(taxa_selectionne),sep="")

Modified: pkg/stacomir/R/ref_taxa.R
===================================================================
--- pkg/stacomir/R/ref_taxa.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_taxa.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -42,10 +42,10 @@
 	  requete=new("RequeteODBCwhere")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  requete at select=paste("SELECT DISTINCT ON (tax_rang) tax_code, tax_nom_latin, tax_nom_commun, tax_ntx_code, tax_tax_code", 
-		  " FROM ",get("sch",envir=envir_stacomi),"tg_dispositif_dis",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
-		  " JOIN ",get("sch",envir=envir_stacomi),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"tg_dispositif_dis",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_dispositifcomptage_dic on dis_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_operation_ope on ope_dic_identifiant=dic_dis_identifiant",
+		  " JOIN ",rlang::env_get(envir_stacomi, "sch"),"t_lot_lot on lot_ope_identifiant=ope_identifiant",
 		  " JOIN ref.tr_taxon_tax on lot_tax_code=tax_code",sep="")
 	  requete at where=paste("where dis_identifiant in",vector_to_listsql(dc_selectionne))
 	  requete at order_by="ORDER BY tax_rang ASC"  

Modified: pkg/stacomir/R/ref_year.R
===================================================================
--- pkg/stacomir/R/ref_year.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/ref_year.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -70,14 +70,14 @@
 		  and3=""
 		}
 		requete at sql=paste("select  DISTINCT ON (bjo_annee) bjo_annee from ",
-			get("sch",envir=envir_stacomi),
+			rlang::env_get(envir_stacomi, "sch"),
 			"t_bilanmigrationjournalier_bjo where bjo_identifiant>0 ",
 			# I want and statements to not have to choose the order
 			# the where statement is always verified
 			and1,and2,and3, sep="")	
 	  } else if (objectreport=="report_ge_weight") {
 		requete at sql=paste("select  DISTINCT ON (year) year from( select date_part('year', ope_date_debut) as year from ",
-			get("sch",envir=envir_stacomi),
+			rlang::env_get(envir_stacomi, "sch"),
 			"t_operation_ope) as tabletemp",sep="")
 	  } else if (objectreport=="report_annual"|objectreport=="report_species") {
 		if (exists("ref_dc",envir_stacomi)) {
@@ -100,9 +100,9 @@
 		  and3=""
 		}
 		requete at sql=paste("select  DISTINCT ON (year) year from (select date_part('year', ope_date_debut) as year from ",
-			get("sch",envir=envir_stacomi),
+			rlang::env_get(envir_stacomi, "sch"),
 			"t_operation_ope JOIN ",
-			get("sch",envir=envir_stacomi),
+			rlang::env_get(envir_stacomi, "sch"),
 			"t_lot_lot on lot_ope_identifiant=ope_identifiant",
 			" WHERE lot_lot_identifiant is null",
 			and1,and2,and3, ") as tabletemp", sep="")					

Modified: pkg/stacomir/R/report_annual.R
===================================================================
--- pkg/stacomir/R/report_annual.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_annual.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -109,11 +109,11 @@
 	  reqdiff=new("RequeteODBC")
 	  reqdiff at baseODBC<-get("baseODBC", envir=envir_stacomi)
 	  #For Marion
-	  #sch<-get("sch",envir=envir_stacomi) # "iav."
+	  #sch<-rlang::env_get(envir_stacomi, "sch") # "iav."
 	  #assign("sch","iav.",envir_stacomi)
 	  
 	  reqdiff at sql= paste("select *, extract(year  from ope_date_debut) as annee_debut, extract(year  from ope_date_fin) as annee_fin 
-			  FROM ",get("sch",envir=envir_stacomi),"t_operation_ope  join ", get("sch",envir=envir_stacomi),"t_lot_lot on lot_ope_identifiant=ope_identifiant 
+			  FROM ",rlang::env_get(envir_stacomi, "sch"),"t_operation_ope  join ", rlang::env_get(envir_stacomi, "sch"),"t_lot_lot on lot_ope_identifiant=ope_identifiant 
 			  where ope_dic_identifiant in ",dc, 
 		  " and extract(year from ope_date_debut)>=",anneedebut,
 		  " and	 extract(year from ope_date_debut)<=", anneefin, 
@@ -163,8 +163,8 @@
 		
 		
 		req at sql = paste(" select sum(lot_effectif) as effectif, annee, ope_dic_identifiant,lot_tax_code, lot_std_code  from 
-				(select *, extract(year  from ope_date_debut) as annee FROM ",get("sch",envir=envir_stacomi),"t_operation_ope ",
-			" join ",get("sch",envir=envir_stacomi),"t_lot_lot on lot_ope_identifiant=ope_identifiant where ope_dic_identifiant in",dc,
+				(select *, extract(year  from ope_date_debut) as annee FROM ",rlang::env_get(envir_stacomi, "sch"),"t_operation_ope ",
+			" join ",rlang::env_get(envir_stacomi, "sch"),"t_lot_lot on lot_ope_identifiant=ope_identifiant where ope_dic_identifiant in",dc,
 			" and extract(year from ope_date_debut)>=", anneedebut,
 			" and extract(year from ope_date_fin)<=", anneefin,	
 			" and ope_dic_identifiant in ", dc,

Modified: pkg/stacomir/R/report_dc.R
===================================================================
--- pkg/stacomir/R/report_dc.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_dc.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -50,7 +50,7 @@
 		  " per_etat_fonctionnement,",
 		  " per_tar_code,",
 		  " tar_libelle AS libelle",
-		  " FROM  ",get("sch",envir=envir_stacomi),"t_periodefonctdispositif_per per",
+		  " FROM  ",rlang::env_get(envir_stacomi, "sch"),"t_periodefonctdispositif_per per",
 		  " INNER JOIN ref.tr_typearretdisp_tar tar ON tar.tar_code=per.per_tar_code",sep="")
 	  req at colonnedebut<-"per_date_debut"
 	  req at colonnefin<-"per_date_fin"

Modified: pkg/stacomir/R/report_df.R
===================================================================
--- pkg/stacomir/R/report_df.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_df.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -59,7 +59,7 @@
 		  " per_etat_fonctionnement,",
 		  " per_tar_code,",
 		  " tar_libelle AS libelle",
-		  " FROM  ",get("sch",envir=envir_stacomi),"t_periodefonctdispositif_per per",
+		  " FROM  ",rlang::env_get(envir_stacomi, "sch"),"t_periodefonctdispositif_per per",
 		  " INNER JOIN ref.tr_typearretdisp_tar tar ON tar.tar_code=per.per_tar_code",sep="")
 	  req at colonnedebut="per_date_debut"
 	  req at colonnefin="per_date_fin"

Modified: pkg/stacomir/R/report_env.R
===================================================================
--- pkg/stacomir/R/report_env.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_env.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -56,7 +56,7 @@
 		  " val_libelle as env_val_identifiant,",
 		  " env_valeur_quantitatif,",
 		  " env_stm_identifiant",
-		  " FROM ",get("sch",envir=envir_stacomi),"tj_conditionenvironnementale_env",
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"tj_conditionenvironnementale_env",
 		  " LEFT JOIN ref.tr_valeurparametrequalitatif_val on env_val_identifiant=val_identifiant",sep="")
 	  requete at order_by<-"ORDER BY env_stm_identifiant, env_date_debut"			
 	  tmp<-vector_to_listsql(object at stationMesure@data$stm_identifiant)

Modified: pkg/stacomir/R/report_ge_weight.R
===================================================================
--- pkg/stacomir/R/report_ge_weight.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_ge_weight.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -74,7 +74,7 @@
 		  " ope_date_debut+(ope_date_fin-ope_date_debut)/2 as datemoy,",
 		  " date_part('year', ope_date_debut) as annee,",
 		  " date_part('month',ope_date_debut) as mois",
-		  " FROM ",get("sch",envir=envir_stacomi),"vue_lot_ope_car_qan",sep="")
+		  " FROM ",rlang::env_get(envir_stacomi, "sch"),"vue_lot_ope_car_qan",sep="")
 	  requete at and=paste(" AND ope_dic_identifiant=",object at dc@dc_selectionne,
 		  " AND std_libelle='civelle'",
 		  ifelse(object at liste@selectedvalue=="tous", "",paste(" AND  lot_effectif", object at liste@selectedvalue)),
@@ -585,7 +585,7 @@
 	  import_coe<-r_gew at calcdata$import_coe
 	  import_coe$coe_org_code<-toupper(gsub("\\.","",get("sch",envir_stacomi)))
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
-	  sql<-stringr::str_c("INSERT INTO ",get("sch",envir=envir_stacomi),"tj_coefficientconversion_coe (",			
+	  sql<-stringr::str_c("INSERT INTO ",rlang::env_get(envir_stacomi, "sch"),"tj_coefficientconversion_coe (",			
 		  "coe_tax_code,coe_std_code,coe_qte_code,coe_date_debut,coe_date_fin,coe_valeur_coefficient,
 			  coe_commentaires,coe_org_code)",
 		  " SELECT coe_tax_code,coe_std_code,coe_qte_code,coe_date_debut,coe_date_fin,coe_valeur_coefficient::real,

Modified: pkg/stacomir/R/report_mig.R
===================================================================
--- pkg/stacomir/R/report_mig.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_mig.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -651,7 +651,7 @@
 			rep(jour_dans_lannee_non_nuls,ncol(data[,c("MESURE","CALCULE","EXPERT","PONCTUEL","Effectif_total","Effectif_total.p","Effectif_total.e","poids_depuis_effectifs","Poids_total","taux_d_echappement","coe_valeur_coefficient")])),
 			utils::stack(data[,c("MESURE","CALCULE","EXPERT","PONCTUEL","Effectif_total","Effectif_total.p","Effectif_total.e","poids_depuis_effectifs","Poids_total","taux_d_echappement","coe_valeur_coefficient")]),  
 			Sys.time(),
-			substr(toupper(get("sch",envir=envir_stacomi)),1,nchar(toupper(get("sch",envir=envir_stacomi)))-1)
+			substr(toupper(rlang::env_get(envir_stacomi, "sch")),1,nchar(toupper(rlang::env_get(envir_stacomi, "sch")))-1)
 		)	
 	  } else{
 		aat_reportmigrationjournalier_bjo=cbind(
@@ -662,7 +662,7 @@
 			rep(jour_dans_lannee_non_nuls,ncol(data[,c("MESURE","CALCULE","EXPERT","PONCTUEL","Effectif_total","taux_d_echappement","coe_valeur_coefficient")])),
 			utils::stack(data[,c("MESURE","CALCULE","EXPERT","PONCTUEL","Effectif_total","taux_d_echappement","coe_valeur_coefficient")]),  
 			Sys.time(),
-			substr(toupper(get("sch",envir=envir_stacomi)),1,nchar(toupper(get("sch",envir=envir_stacomi)))-1)
+			substr(toupper(rlang::env_get(envir_stacomi, "sch")),1,nchar(toupper(rlang::env_get(envir_stacomi, "sch")))-1)
 		)	
 	  }
 	  aat_reportmigrationjournalier_bjo= stacomirtools::killfactor(aat_reportmigrationjournalier_bjo[!is.na(aat_reportmigrationjournalier_bjo$values),])
@@ -682,7 +682,7 @@
 	  hconfirm=function(h,...){			
 		if (check_for_bjo) supprime(bil)			
 		baseODBC<-get("baseODBC",envir=envir_stacomi)
-		sql<-stringr::str_c("INSERT INTO ",get("sch",envir=envir_stacomi),"t_bilanmigrationjournalier_bjo (",			
+		sql<-stringr::str_c("INSERT INTO ",rlang::env_get(envir_stacomi, "sch"),"t_bilanmigrationjournalier_bjo (",			
 			"bjo_dis_identifiant,bjo_tax_code,bjo_std_code,bjo_annee,bjo_jour,bjo_valeur,bjo_labelquantite,bjo_horodateexport,bjo_org_code)",
 			" SELECT * FROM  aat_reportmigrationjournalier_bjo;")
 		invisible(utils::capture.output(
@@ -725,7 +725,7 @@
 	  {
 		
 		baseODBC<-get("baseODBC",envir=envir_stacomi)
-		sql<-stringr::str_c("INSERT INTO ",get("sch",envir=envir_stacomi),"t_bilanmigrationjournalier_bjo (",			
+		sql<-stringr::str_c("INSERT INTO ",rlang::env_get(envir_stacomi, "sch"),"t_bilanmigrationjournalier_bjo (",			
 			"bjo_dis_identifiant,bjo_tax_code,bjo_std_code,bjo_annee,bjo_jour,bjo_valeur,bjo_labelquantite,bjo_horodateexport,bjo_org_code)",
 			" SELECT * FROM  aat_reportmigrationjournalier_bjo;")
 		

Modified: pkg/stacomir/R/report_mig_char.R
===================================================================
--- pkg/stacomir/R/report_mig_char.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_mig_char.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -234,7 +234,7 @@
 			  " lot_tax_code,", 
 			  " lot_std_code,",
 			  " car_par_code",
-			  " FROM ",get("sch",envir=envir_stacomi),"vue_ope_lot_ech_parqual", 
+			  " FROM ",rlang::env_get(envir_stacomi, "sch"),"vue_ope_lot_ech_parqual", 
 			  " WHERE ope_dic_identifiant in ",vector_to_listsql(r_mig_char at dc@dc_selectionne),
 			  echantillons,
 			  " AND lot_tax_code in ",vector_to_listsql(r_mig_char at taxa@data$tax_code),
@@ -262,7 +262,7 @@
 			  " lot_tax_code,", 
 			  " lot_std_code,",
 			  " car_par_code",
-			  " FROM ",get("sch",envir=envir_stacomi),"vue_ope_lot_ech_parquan", 
+			  " FROM ",rlang::env_get(envir_stacomi, "sch"),"vue_ope_lot_ech_parquan", 
 			  " WHERE ope_dic_identifiant in ",vector_to_listsql(r_mig_char at dc@dc_selectionne),
 			  echantillons,
 			  " AND lot_tax_code in ",vector_to_listsql(r_mig_char at taxa@data$tax_code),

Modified: pkg/stacomir/R/report_mig_interannual.R
===================================================================
--- pkg/stacomir/R/report_mig_interannual.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_mig_interannual.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -95,7 +95,7 @@
 		requete=new("RequeteODBCwhere")
 		requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
 		requete at where=paste("WHERE bjo_annee IN ",vector_to_listsql(les_annees)," AND bjo_tax_code='",tax,"' AND bjo_std_code='",std,"' AND bjo_dis_identifiant in",vector_to_listsql(dic),sep="")
-		requete at select=paste("SELECT * FROM ",get("sch",envir=envir_stacomi),"t_bilanmigrationjournalier_bjo",sep="")
+		requete at select=paste("SELECT * FROM ",rlang::env_get(envir_stacomi, "sch"),"t_bilanmigrationjournalier_bjo",sep="")
 		requete at order_by=" ORDER BY bjo_jour "
 		requete<-stacomirtools::connect(requete)
 		data<- stacomirtools::killfactor(requete at query)
@@ -276,13 +276,13 @@
 	  dic= object at dc@dc_selectionne
 	  requete=new("RequeteODBCwhere")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
-	  requete at select=stringr::str_c("DELETE from ",get("sch",envir=envir_stacomi),"t_bilanmigrationjournalier_bjo ")
+	  requete at select=stringr::str_c("DELETE from ",rlang::env_get(envir_stacomi, "sch"),"t_bilanmigrationjournalier_bjo ")
 	  requete at where=paste("WHERE bjo_annee IN (",paste(les_annees,collapse=","),") AND bjo_tax_code='",tax,"' AND bjo_std_code='",std,"' AND bjo_dis_identifiant=",dic,sep="")
 	  invisible(utils::capture.output(requete<-stacomirtools::connect(requete)))
 	  
 	  requete=new("RequeteODBCwhere")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
-	  requete at select=stringr::str_c("DELETE from ",get("sch",envir=envir_stacomi),"t_reportmigrationmensuel_bme ")
+	  requete at select=stringr::str_c("DELETE from ",rlang::env_get(envir_stacomi, "sch"),"t_reportmigrationmensuel_bme ")
 	  requete at where=paste("WHERE bme_annee IN (",paste(les_annees,collapse=","),") AND bme_tax_code='",tax,"' AND bme_std_code='",std,"' AND bme_dis_identifiant=",dic,sep="")
 	  invisible(utils::capture.output(requete<-stacomirtools::connect(requete)))
 	  

Modified: pkg/stacomir/R/report_mig_mult.R
===================================================================
--- pkg/stacomir/R/report_mig_mult.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_mig_mult.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -308,7 +308,7 @@
 	  tax=vector_to_listsql(report_mig_mult at taxa@data$tax_code)
 	  if (length(report_mig_mult at stage@data$std_code)==0) stop("Stage has length zero, are you connected to the right schema, do you use the right stage ?")
 	  std=vector_to_listsql(report_mig_mult at stage@data$std_code)
-	  sch=get("sch",envir=envir_stacomi)
+	  sch=rlang::env_get(envir_stacomi, "sch")
 	  req at select = stringr::str_c("SELECT 
 			  ope_identifiant,
 			  lot_identifiant,

Modified: pkg/stacomir/R/report_ope.R
===================================================================
--- pkg/stacomir/R/report_ope.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_ope.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -43,7 +43,7 @@
 	  req at datedebut<-object at horodatedebut@horodate
 	  #below to be consistet with BIlanMigrationMult
 	  req at datefin<-as.POSIXlt(object at horodatefin@horodate+as.difftime("23:59:59"))
-	  req at select<-paste("SELECT * FROM  ",get("sch",envir=envir_stacomi),"t_operation_ope ")		
+	  req at select<-paste("SELECT * FROM  ",rlang::env_get(envir_stacomi, "sch"),"t_operation_ope ")		
 	  req at and=paste("AND ope_dic_identifiant in",stringr::str_c("(",stringr::str_c(lesdc,collapse=","),")"))
 	  req<-stacomirtools::connect(req) # appel de la methode connect de l'object ODBCWHEREDATE
 	  object at data<-req at query	

Modified: pkg/stacomir/R/report_sample_char.R
===================================================================
--- pkg/stacomir/R/report_sample_char.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_sample_char.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -51,7 +51,7 @@
 setMethod("connect",signature=signature("report_sample_char"),definition=function(object,silent=FALSE) {
 	  requete<-new("RequeteODBCwheredate")
 	  requete at baseODBC=get("baseODBC",envir=envir_stacomi)
-	  requete at select= paste("SELECT * FROM ",get("sch",envir=envir_stacomi),"vue_lot_ope_car",sep="")
+	  requete at select= paste("SELECT * FROM ",rlang::env_get(envir_stacomi, "sch"),"vue_lot_ope_car",sep="")
 	  requete at colonnedebut="ope_date_debut"
 	  requete at colonnefin="ope_date_fin"
 	  requete at datedebut<-object at horodatedebut@horodate

Modified: pkg/stacomir/R/report_sea_age.R
===================================================================
--- pkg/stacomir/R/report_sea_age.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_sea_age.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -77,7 +77,7 @@
 setMethod("connect",signature=signature("report_sea_age"),definition=function(object,silent=FALSE) {
 	  requete<-new("RequeteODBCwheredate")
 	  requete at baseODBC=get("baseODBC",envir=envir_stacomi)
-	  requete at select= paste("SELECT * FROM ",get("sch",envir=envir_stacomi),"vue_lot_ope_car",sep="")
+	  requete at select= paste("SELECT * FROM ",rlang::env_get(envir_stacomi, "sch"),"vue_lot_ope_car",sep="")
 	  requete at colonnedebut="ope_date_debut"
 	  requete at colonnefin="ope_date_fin"
 	  requete at datedebut<-object at horodatedebut@horodate
@@ -394,13 +394,13 @@
 		  r_seaa at calcdata$data$age,
 		  as.integer(NA),
 		  comment,
-		  substr(toupper(get("sch",envir=envir_stacomi)),1,nchar(toupper(get("sch",envir=envir_stacomi)))-1)
+		  substr(toupper(rlang::env_get(envir_stacomi, "sch")),1,nchar(toupper(rlang::env_get(envir_stacomi, "sch")))-1)
 	  )
 	  #--------------
 	  # writing the table in the database
 	  #--------------
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
-	  sql<-stringr::str_c("INSERT INTO ",get("sch",envir=envir_stacomi),
+	  sql<-stringr::str_c("INSERT INTO ",rlang::env_get(envir_stacomi, "sch"),
 		  "tj_caracteristiquelot_car 	SELECT * FROM  bam;")
 	  invisible(utils::capture.output(
 			  sqldf::sqldf(x=sql,
@@ -493,7 +493,7 @@
 	  }
 	  requete=new("RequeteODBCwhere")
 	  requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
-	  requete at select=stringr::str_c("DELETE from ",get("sch",envir=envir_stacomi),"tj_caracteristiquelot_car ")
+	  requete at select=stringr::str_c("DELETE from ",rlang::env_get(envir_stacomi, "sch"),"tj_caracteristiquelot_car ")
 	  requete at where=paste("WHERE car_lot_identifiant IN ",
 		  vector_to_listsql(data_in_base$lot_identifiant),
 		  " AND car_par_code='A124';",

Modified: pkg/stacomir/R/report_silver_eel.R
===================================================================
--- pkg/stacomir/R/report_silver_eel.R	2019-02-12 09:08:05 UTC (rev 548)
+++ pkg/stacomir/R/report_silver_eel.R	2019-04-06 05:56:57 UTC (rev 549)
@@ -74,7 +74,7 @@
 setMethod("connect",signature=signature("report_silver_eel"),definition=function(object,silent=FALSE) {
 	  requete<-new("RequeteODBCwheredate")
 	  requete at baseODBC=get("baseODBC",envir=envir_stacomi)
-	  requete at select= paste("SELECT * FROM ",get("sch",envir=envir_stacomi),"vue_lot_ope_car",sep="")
+	  requete at select= paste("SELECT * FROM ",rlang::env_get(envir_stacomi, "sch"),"vue_lot_ope_car",sep="")
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/stacomir -r 549


More information about the Stacomir-commits mailing list