function Literatur($nr) { global $db_config, $sqldb; // Suche Literatur mit Literatur_Nr = $nr heraus $sql = "SELECT Literatur_Nr, Art, Titel, Jahr, Verlag, ISBN, Beschreibung, Ort, Stichworte\n\t\t\t\t\tFROM " . $db_config['prefix'] . "Bibliothek\n\t\t\t\t\tWHERE Literatur_Nr='{$nr}'\n\t\t\t\t\tLIMIT 1"; $sqldb->Query($sql); // Lese gefundene Daten aus if ($cur = $sqldb->Fetch()) { $this->Nr = $cur->Literatur_Nr; $this->Art = new LiteraturArt($cur->Art); $this->Titel = $cur->Titel; $this->Jahr = $cur->Jahr; $this->Verlag = $cur->Verlag; $this->ISBN = $cur->ISBN; $this->Beschreibung = $cur->Beschreibung; $this->Ort = $cur->Ort; $this->Stichworte = $cur->Stichworte; $this->Autoren = Autor::GetAll($nr); $this->Kommentare = Kommentar::GetAll($nr); } }
function GetAll() { global $sqldb; $testData = array(); $testData[] = $this->CreateKommentarData(1, "Das ist ein Kommentar", 1, "Max", "Mustermann"); $testData[] = $this->CreateKommentarData(2, "Noch ein Kommentar", 2, "Fritz", "Fischer"); $sqldb->ExpectQuery('SELECT.*FROM.*Kommentare', $testData); $result = Kommentar::GetAll(1); $dbResult = $sqldb->Verify(); if ($dbResult !== true) { $dbResult->Unit = 'Kommentar'; $dbResult->Test = 'GetAll'; return $dbResult; } if (count($testData) != count($result)) { return new ErrorMessage('Kommentar', 'GetAll', 'Anzahl Kommentare', count($testData), count($result)); } return true; }