wartości pól formularza a baza danych
jivanmuktaWYTNIJTO@poczta.onet.pl - 28-02-2010 15:58
wartości pól formularza a baza danych
Dzień dobry,
Mam pytanie do osób tworzących formularzowe alikacje bazodanowe.
W takich aplikacjach występują pola (np. drop down listy <select>) zawierające
wartości, które możnaby przechowywać w tabelach słownikowych bazy danych albo
bezpośrednio w HTMLu. Od czego to zależy na co się zdecydować?
Np. w mojej aplikacji mam pole "Rodzaj nieruchomości" z
wartościami "lokal", "mieszkanie", "pokój", "kawalerka" itp.
Jeśli wartości się zmieniają w aplikacji to chyba lepiej użyć tabeli bazy
danych, np. tabeli MyISAM w MySQLu. Jeśli natomiast wartosci są statyczne to
chyba lepiej zahardcodować je w HTMLu. Co o tym sądzicie?
Byłbym wdzięczny za odpowiedź.
--
Wysłano z serwisu OnetNiusy: http://niusy.onet.pl
=?ISO-8859-2?Q?Artur_Muszy=F1ski?= - 28-02-2010 15:58
W dniu 2010-02-28 14:40, jivanmuktaWYTNIJTO@poczta.onet.pl pisze:
> Jeśli wartości się zmieniają w aplikacji to chyba lepiej użyć tabeli bazy
> danych, np. tabeli MyISAM w MySQLu. Jeśli natomiast wartosci są statyczne to
> chyba lepiej zahardcodować je w HTMLu. Co o tym sądzicie?
> Byłbym wdzięczny za odpowiedź.
Niektórzy uważają, że wszystkie wartości słownikowe powinny być w bazie
włącznie z tak/nie, ale to przesada. Moim kryterium jest nie tyle
niezmienność danych, co statyczna zależność algorytmu od wartości danej,
na przykład będziemy mieli jakieś wartości stanu lub typu obiektów w
bazie i w zależności od typu osobna klasa wykonawcza. Tabela typów w
bazie nie ma większego sensu, chyba że dodamy w bazie jeszcze jakiś
identyfikator przypisujący klasę (w każdym razie to nie dla
początkujących). Twój przykład - rodzaj nieruchomości - aż krzyczy, że
chce być w bazie - chyba nie chcesz wymyślać za agencję, jakimi
obiektami będzie handlować?
PS: Określenie "zahardkodowany" traktuję jako skrót myślowy i nie będę
się rozwodził nad podstawami.
artur
Ghost - 02-03-2010 16:53
=?iso-8859-2?Q?Re:_warto=B6ci_p=F3l_formularza_a_baza_danych? =
Użytkownik <jivanmuktaWYTNIJTO@poczta.onet.pl> napisał w wiadomości
news:3461.000000ee.4b8a724f@newsgate.onet.pl...
> Dzień dobry,
> Mam pytanie do osób tworzących formularzowe alikacje bazodanowe.
> W takich aplikacjach występują pola (np. drop down listy <select>)
> zawierające
> wartości, które możnaby przechowywać w tabelach słownikowych bazy danych
> albo
> bezpośrednio w HTMLu. Od czego to zależy na co się zdecydować?
> Np. w mojej aplikacji mam pole "Rodzaj nieruchomości" z
> wartościami "lokal", "mieszkanie", "pokój", "kawalerka" itp.
> Jeśli wartości się zmieniają w aplikacji to chyba lepiej użyć tabeli bazy
> danych, np. tabeli MyISAM w MySQLu. Jeśli natomiast wartosci są statyczne
> to
> chyba lepiej zahardcodować je w HTMLu. Co o tym sądzicie?
> Byłbym wdzięczny za odpowiedź.
Trzymanie wszystkiego w bazie jest o tyle poreczne, ze robiac rozne selecty
z samej bazy bez zagladania do HTMLa widzisz co jest czym.
Ghost - 02-03-2010 16:53
=?iso-8859-2?Q?Re:_warto=B6ci_p=F3l_formularza_a_baza_danych? =
Użytkownik "Artur Muszyński" <arturm@union.wytnijto.com.pl> napisał w
wiadomości news:hmdss4$v4a$1@mx1.internetia.pl...
>W dniu 2010-02-28 14:40, jivanmuktaWYTNIJTO@poczta.onet.pl pisze:
> Twój przykład - rodzaj nieruchomości - aż krzyczy, że chce być w bazie -
> chyba nie chcesz wymyślać za agencję, jakimi obiektami będzie handlować?
Z doswiadczenia wiem, ze akurat lista podanych kategorii potrafi byc
arcystatyczna.