static function addCrlChave(CrlChave $ch) { TTransaction::open('my_config'); if ($conn = TTransaction::get()) { $sql = "INSERT INTO ctrl_chaves\r\n (professor_id,\r\n laboratorio_id,\r\n observacao_controle,\r\n dt_inicial_controle) VALUES\r\n (?,?,?,?)"; $sth = $conn->prepare($sql); $sth->execute(array($ch->getProfessorId(), $ch->getLaboratorioId(), $ch->getObservacaoControle(), $ch->getDtInicialControle())); $sql = "UPDATE laboratorios SET chave_laboratorio=1\r\n WHERE id_laboratorio = ?"; $sth = $conn->prepare($sql); $sth->execute(array($ch->getLaboratorioId())); TTransaction::close(); } else { echo 'Sem conexão com banco!'; } }