Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CommuVélo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INF3710-H23
CommuVélo
Commits
254b229f
Commit
254b229f
authored
2 years ago
by
Justine Ouellette
Browse files
Options
Downloads
Patches
Plain Diff
trigger done but not tested
parent
0e890aa5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
trigger.sql
+32
-0
32 additions, 0 deletions
trigger.sql
with
32 additions
and
0 deletions
trigger.sql
0 → 100644
+
32
−
0
View file @
254b229f
CREATE
TRIGGER
max_odometre_atteint
AFTER
UPDATE
OF
odometre
ON
vehicule
REFERENCING
OLD
TABLE
AS
voiture
WHEN
(
NEW
.
odometre
>=
caracteristiques_vehicule
.
odometre_max
FROM
vehicule
JOIN
caracteristiques_vehicule
ON
vehicule
.
type
=
caracteristiques_vehicule
.
type
)
EXECUTE
FUNCTION
vendre_vehicule
();
CREATE
FUNCTION
vendre_vehicule
()
RETURNS
trigger
AS
$
test
$
BEGIN
CREATE
TABLE
avendre
(
immatriculation
TypeImmatriculation
,
marque
TypeTexteCourt
,
modele
TypeTexteCourt
,
odometre
INT
NOT
NULL
,
date_mise_en_service
DATE
NOT
NULL
,
consommation
FLOAT
NOT
NULL
,
"type"
TypeVehicule
NOT
NULL
,
kw_recharge
FLOAT
,
);
INSERT
INTO
avendre
(
SELECT
voiture
.
immatriculation
,
voiture
.
marque
,
voiture
.
modele
,
voiture
.
odometre
,
voiture
.
date_mise_en_service
,
voiture
.
consommation
,
voiture
.
type
,
voiture
.
kw_recharge
FROM
voiture
);
END
;
$
test
$
LANGUAGE
plpgsql
;
\ No newline at end of file
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