-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 01facbf
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE TABLE student ( | ||
id_student INT(11) KEY AUTO_INCREMENT, | ||
identification_number VARCHAR(11) NOT NULL, | ||
name varchar(50) NOT NULL, | ||
age INT(2) NULL, | ||
preferences TEXT | ||
); | ||
|
||
CREATE TABLE teacher ( | ||
id_teacher INT(11) KEY AUTO_INCREMENT, | ||
professorship_number VARCHAR(11) NOT NULL, | ||
name varchar(50) NOT NULL, | ||
experience_time INT(2) NULL, | ||
marital_status TINYINT(1), | ||
last_university_payment_date DATE | ||
); | ||
|
||
CREATE TABLE relation_student_teacher ( | ||
id_relation_student_teacher INT(11) KEY AUTO_INCREMENT, | ||
id_student INT(11), | ||
id_teacher INT(11) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
class student extends ODBObject{ | ||
public $identification_number; | ||
public $name; | ||
public $age; | ||
public $preferences; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
// constants for marital status | ||
define("SINGLE", 0x01, true); | ||
define("MARRIED", 0x02, true); | ||
define("DIVORCED", 0x03, true); | ||
define("WIDOWED", 0x04, true); | ||
|
||
class teacher extends ODBObject{ | ||
public $professorship_number; | ||
public $name; | ||
public $experience_time; | ||
public $marital_status; // constants | ||
public $contract_date; // date | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
require_once "../objectDB/objectDB-mysql-v3.0.php"; // this will include first | ||
require_once "student.php"; | ||
require_once "teacher.php"; | ||
|
||
// create, set values and save a new student | ||
$student = new student(); | ||
$student->setDataFromParamsList(3025,'Salvi Pascual',24,'color=orange,grossery=pie,serie=futurama'); | ||
$student->save(); | ||
|
||
// create, set values and save a new teacher | ||
$teacher = new teacher(); | ||
$teacher->setDataFromParamsList('math201','Stephen W. Hawking',37,MARRIED,date("Y-m-d")); | ||
$teacher->save(); | ||
|
||
// create relation between | ||
$student->addRelation($teacher); // same than: $teacher->addRelation($student); | ||
?> |