aboutsummaryrefslogtreecommitdiff
path: root/view/employee.hxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-11-17 11:44:45 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-11-17 11:44:45 +0200
commit9616e3e84946c23f64448978d9459d2a25202833 (patch)
tree209fe102c7d73b57ff3d2a4cdf68ad2df705704f /view/employee.hxx
parent508512b8db199c5bcc1affc237d6eac4e0a4818d (diff)
Add examples for Oracle
Diffstat (limited to 'view/employee.hxx')
-rw-r--r--view/employee.hxx34
1 files changed, 26 insertions, 8 deletions
diff --git a/view/employee.hxx b/view/employee.hxx
index 110cb9e..848a30c 100644
--- a/view/employee.hxx
+++ b/view/employee.hxx
@@ -236,8 +236,13 @@ struct employee_country
// on an ad-hoc table. This view allows us to load the employee vacation
// information from the legacy employee_extra table.
//
-#pragma db view query("SELECT employee_id, vacation_days " \
- "FROM view_employee_extra")
+#ifndef ODB_DATABASE_ORACLE
+ #pragma db view query("SELECT employee_id, vacation_days " \
+ "FROM view_employee_extra")
+#else
+ #pragma db view query("SELECT \"employee_id\", \"vacation_days\" " \
+ "FROM \"view_employee_extra\"")
+#endif
struct employee_vacation
{
#pragma db type("INTEGER")
@@ -265,8 +270,14 @@ struct employee_vacation1
// add the employee object to this view and use a custom join condition
// to tie it up with our legacy table.
//
-#pragma db view table("view_employee_extra") \
- object(employee: "view_employee_extra.employee_id = " + employee::id_)
+#ifndef ODB_DATABASE_ORACLE
+ #pragma db view table("view_employee_extra") \
+ object(employee: "view_employee_extra.employee_id = " + employee::id_)
+#else
+ #pragma db view table("view_employee_extra") \
+ object(employee: "\"view_employee_extra\".\"employee_id\" = " + \
+ employee::id_)
+#endif
struct employee_vacation2
{
std::string first;
@@ -279,10 +290,17 @@ struct employee_vacation2
// A mixed view that associates two objects and a legacy table. It returns
// the previous employer information for each employee.
//
-#pragma db view object(employee) \
- table("view_employee_extra" = "extra": \
- "extra.employee_id = " + employee::id_) \
- object(employer: "extra.previous_employer_id = " + employer::id_)
+#ifndef ODB_DATABASE_ORACLE
+ #pragma db view object(employee) \
+ table("view_employee_extra" = "extra": \
+ "extra.employee_id = " + employee::id_) \
+ object(employer: "extra.previous_employer_id = " + employer::id_)
+#else
+ #pragma db view object(employee) \
+ table("view_employee_extra" = "extra": \
+ "\"extra\".\"employee_id\" = " + employee::id_) \
+ object(employer: "\"extra\".\"previous_employer_id\" = " + employer::id_)
+#endif
struct employee_prev_employer
{
std::string first;