Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
collectr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DREAL Pays de la Loire
Centre de Services de la Donnée
ADL
collectr
Commits
9cf1b588
Commit
9cf1b588
authored
4 months ago
by
ronan.vignard
Browse files
Options
Downloads
Patches
Plain Diff
Ajout de la fermeture de la connexion à la base de données
parent
03194079
No related branches found
No related tags found
1 merge request
!55
Création des tests pour import_shapefile()
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/modify_column_type.R
+3
-4
3 additions, 4 deletions
R/modify_column_type.R
R/schema_exists.R
+4
-0
4 additions, 0 deletions
R/schema_exists.R
R/table_exists.R
+4
-0
4 additions, 0 deletions
R/table_exists.R
with
11 additions
and
4 deletions
R/modify_column_type.R
+
3
−
4
View file @
9cf1b588
...
...
@@ -16,8 +16,7 @@
#' @return Retourne TRUE si la modification a été effectuée avec succès.
#'
#' @importFrom datalibaba connect_to_db
#' @importFrom RPostgreSQL dbConnect dbDisconnect
#' @importFrom DBI dbExecute
#' @importFrom DBI dbExecute dbDisconnect
#'
#' @export
#' @examples
...
...
@@ -61,10 +60,10 @@ modify_column_type <- function(host, database, schema, table, column_name,
" USING "
,
column_name
,
"::"
,
column_type
)
# Exécuter la requête ALTER TABLE
dbExecute
(
connexion
,
alter_query
)
DBI
::
dbExecute
(
connexion
,
alter_query
)
# Fermer la connexion à la base de données
dbDisconnect
(
connexion
)
DBI
::
dbDisconnect
(
connexion
)
return
(
TRUE
)
}
This diff is collapsed.
Click to expand it.
R/schema_exists.R
+
4
−
0
View file @
9cf1b588
...
...
@@ -12,6 +12,7 @@
#' @return TRUE si le schéma existe, sinon FALSE
#'
#' @importFrom datalibaba list_schemas
#' @importFrom DBI dbDisconnect
#'
#' @export
#' @examples
...
...
@@ -35,5 +36,8 @@ schema_exists <- function(host, database, schema, role) {
schemas
<-
datalibaba
::
list_schemas
(
connexion
)
schema_exists
<-
schema
%in%
schemas
# Fermer la connexion à la base de données
DBI
::
dbDisconnect
(
connexion
)
return
(
schema_exists
)
}
This diff is collapsed.
Click to expand it.
R/table_exists.R
+
4
−
0
View file @
9cf1b588
...
...
@@ -13,6 +13,7 @@
#' @return TRUE si la table existe, sinon FALSE
#'
#' @importFrom datalibaba list_tables
#' @importFrom DBI dbDisconnect
#'
#' @export
#' @examples
...
...
@@ -37,5 +38,8 @@ table_exists <- function(host, database, schema, table, role) {
tables
<-
datalibaba
::
list_tables
(
connexion
,
schema
=
schema
,
db
=
database
)
table_exists
<-
table
%in%
tables
# Fermer la connexion à la base de données
DBI
::
dbDisconnect
(
connexion
)
return
(
table_exists
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment