-
Path: news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!newsfeed2.atman.pl!newsfeed.
atman.pl!news.task.gda.pl!not-for-mail
From: "AK" <n...@n...com>
Newsgroups: pl.comp.programming
Subject: Re: Wypalenie - czy ktoś z Was się z nim zetknął?
Date: Thu, 27 Sep 2012 12:24:07 +0200
Organization: CI TASK http://www.task.gda.pl/
Lines: 132
Message-ID: <k419ga$3no$1@news.task.gda.pl>
References: <f...@d...googlegroups.com>
<k3t757$hju$1@node2.news.atman.pl> <k3t85a$cjg$1@news.task.gda.pl>
<k3vmgt$s5m$1@node2.news.atman.pl> <k4157b$p6p$1@news.task.gda.pl>
<s...@j...net>
NNTP-Posting-Host: ppp142003.ostnet.pl
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-2"; reply-type=original
Content-Transfer-Encoding: 8bit
X-Trace: news.task.gda.pl 1348741450 3832 62.133.142.3 (27 Sep 2012 10:24:10 GMT)
X-Complaints-To: a...@n...task.gda.pl
NNTP-Posting-Date: Thu, 27 Sep 2012 10:24:10 +0000 (UTC)
In-Reply-To: <s...@j...net>
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6002.18197
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18463
Xref: news-archive.icm.edu.pl pl.comp.programming:199656
[ ukryj nagłówki ]Użytkownik "Stachu 'Dozzie' K." <d...@g...eat.some.screws.spammer.invalid> napisał:
>>> Może za mało SQLa ;)
>>
>> Tak ? No to zaprogramuj drzewo w zwyklym klasycznym SQL-lu ;)
>
> http://www.slideshare.net/billkarwin/sql-antipattern
s-strike-back
> Slajdy 48 i późniejsze.
No popatrz popatrz... (przejrzalem tylko poczatkowe chyba 20)
Grzebales mi po kodzie sprzed prawie 10 lat ? (sprzed wypalenia ?:).
import Attr
from Query import *
TYPEID_CONTAINER = -1
TYPEID_OBJECT = 0
TYPEID_INTEGER = 1
TYPEID_REAL = 2
TYPEID_LOGICAL = 3
TYPEID_DATE = 4
TYPEID_TEXT = 5
TYPEID_PARAGRAPH = 6
TYPEID_BINARY = 7
def createBase(server, database, user=None, password=None):
structure = [
'''
CREATE TABLE AttributeTypes
(
ID INTEGER NOT NULL UNIQUE,
CODE VARCHAR(16) NOT NULL UNIQUE,
Name VARCHAR(40) NOT NULL UNIQUE,
Description VARCHAR(40),
FUN_ToValue VARCHAR(40),
FUN_FromValue VARCHAR(40),
CONSTRAINT AttributeTypesPrimKey PRIMARY KEY (ID)
)
''',
'''
CREATE TABLE AttributeDefinitions
(
ID INTEGER NOT NULL UNIQUE,
CODE VARCHAR(16) NOT NULL UNIQUE,
Name VARCHAR(40) NOT NULL UNIQUE,
Description VARCHAR(40),
TypeID INTEGER NOT NULL,
CONSTRAINT AttributeDefinitionsPrimKey PRIMARY KEY (ID),
CONSTRAINT AttributeDefinitionsForiKey FOREIGN KEY (TypeID) REFERENCES
AttributeTypes (ID)
)
''',
'''
CREATE TABLE AttributeValues
(
ID INTEGER NOT NULL UNIQUE,
Value VARCHAR(80),
BinaryID INTEGER,
DefID INTEGER NOT NULL,
CONSTRAINT AttributeValuesPrimKey PRIMARY KEY (ID),
CONSTRAINT AttributeValuesForiKey FOREIGN KEY (DefID) REFERENCES
AttributeDefinitions (ID)
)
''',
'''
CREATE INDEX AttributeValuesIdx_Value ON AttributeValues (Value)
''',
'''
CREATE TABLE AttributeTrees
(
ID INTEGER NOT NULL UNIQUE,
Tree INTEGER NOT NULL,
Lft FLOAT NOT NULL UNIQUE,
Rgt FLOAT NOT NULL UNIQUE,
ValueID INTEGER NOT NULL,
CONSTRAINT AttributeTreesOrderOk CHECK (Lft < Rgt),
CONSTRAINT AttributeTreesPrimKey PRIMARY KEY (ID),
CONSTRAINT AttributeTreesForiKey FOREIGN KEY (ValueID) REFERENCES AttributeValues
(ID)
)
''',
'''
CREATE INDEX AttributeTreesIdx_Tree ON AttributeTrees (Tree)
''',
'''
CREATE VIEW Attributes AS
SELECT
NodeTrees.ID AS ID,
NodeTrees.Lft AS Lft,
NodeTrees.Rgt AS Rgt,
NodeValues.ID AS ValueID,
NodeValues.Value AS Value,
NodeValues.BinaryID AS BinaryID,
NodeDefinitions.ID AS DefID,
NodeDefinitions.CODE AS DefCODE,
NodeDefinitions.Name AS DefName,
NodeTypes.ID AS TypeID,
NodeTypes.CODE AS TypeCODE,
NodeTypes.Name AS TypeName,
ParentTrees.ID AS ParentID,
ParentTrees.Lft AS ParentLft,
ParentTrees.Rgt AS ParentRgt,
ParentValues.ID AS ParentValueID,
ParentValues.Value AS ParentValue,
ParentValues.BinaryID AS ParentBinaryID,
ParentDefinitions.ID AS ParentDefID,
ParentDefinitions.CODE AS ParentDefCODE,
ParentDefinitions.Name AS ParentDefName,
ParentTypes.ID AS ParentTypeID,
ParentTypes.CODE AS ParentTypeCODE,
ParentTypes.Name AS ParentTypeName,
NodeTrees.Tree AS Tree
FROM (AttributeTrees AS NodeTrees
LEFT JOIN AttributeTrees AS ParentTrees
ON (SELECT MAX(Lft) FROM AttributeTrees
WHERE Lft < NodeTrees.Lft AND Rgt > NodeTrees.Lft) = ParentTrees.Lft)
LEFT JOIN (AttributeValues AS NodeValues
JOIN (AttributeDefinitions AS NodeDefinitions
JOIN AttributeTypes AS NodeTypes
ON NodeDefinitions.TypeID = NodeTypes.ID)
ON NodeValues.DefID = NodeDefinitions.ID)
ON (NodeTrees.ValueID = NodeValues.ID)
LEFT JOIN (AttributeValues AS ParentValues
JOIN (AttributeDefinitions AS ParentDefinitions
JOIN AttributeTypes AS ParentTypes
ON ParentDefinitions.TypeID = ParentTypes.ID)
ON ParentValues.DefID = ParentDefinitions.ID)
ON ParentTrees.ValueID = ParentValues.ID
[...]
AK
Następne wpisy z tego wątku
- 27.09.12 19:04 Sebastian Biały
- 27.09.12 23:54 Jordan Szubert
- 30.09.12 22:48 barkoasdaswiak
- 30.09.12 22:56 t.o.
- 30.09.12 23:03 Roman W
- 30.09.12 23:59 Karol Y
- 01.10.12 10:40 barkoasdaswiak
- 01.10.12 11:08 Adam Przybyla
- 01.10.12 11:39 Roman W
- 01.10.12 11:43 Roman W
- 01.10.12 13:05 barkoasdaswiak
- 01.10.12 13:07 barkoasdaswiak
- 01.10.12 13:15 barkoasdaswiak
- 02.10.12 18:38 M.M.
- 03.10.12 12:58 kenobi
Najnowsze wątki z tej grupy
- 7. Raport Totaliztyczny: Sprawa Qt Group wer. 424
- TCL - problem z escape ostatniego \ w nawiasach {}
- Nauka i Praca Programisty C++ w III Rzeczy (pospolitej)
- testy-wyd-sort - Podsumowanie
- Tworzenie Programów Nieuprzywilejowanych Opartych Na Wtyczkach
- Do czego nadaje się QDockWidget z bibl. Qt?
- Bibl. Qt jest sztucznie ograniczona - jest nieprzydatna do celów komercyjnych
- Co sciaga kretynow
- AEiC 2024 - Ada-Europe conference - Deadlines Approaching
- Jakie są dobre zasady programowania programów opartych na wtyczkach?
- sprawdzanie słów kluczowych dot. zła
- Re: W czym sie teraz pisze programy??
- Re: (PDF) Surgical Pathology of Non-neoplastic Gastrointestinal Diseases by Lizhi Zhang
- CfC 28th Ada-Europe Int. Conf. Reliable Software Technologies
- Młodzi programiści i tajna policja
Najnowsze wątki
- 2024-12-01 "Chciałem zamówić kurs tym"
- 2024-11-30 Windykatorzy ścigają spadkobierców z mandat nieboszczyka za przekroczenie prędkości???
- 2024-11-30 Łódź => Technical Artist <=
- 2024-11-30 Lublin => Inżynier Serwisu Sprzętu Medycznego <=
- 2024-11-30 Warszawa => Microsoft Dynamics 365 Business Central Developer <=
- 2024-11-30 Bieruń => Team Lead / Tribe Lead FrontEnd <=
- 2024-11-30 Zielona Góra => Senior PHP Symfony Developer <=
- 2024-11-30 Gdańsk => Specjalista ds. Sprzedaży <=
- 2024-11-30 Lublin => Spedytor międzynarodowy <=
- 2024-11-30 Warszawa => Mid IT Recruiter <=
- 2024-11-30 Warszawa => Fullstack Developer <=
- 2024-11-30 Żerniki => Dyspozytor Międzynarodowy <=
- 2024-11-30 Warszawa => System Architect (background deweloperski w Java) <=
- 2024-11-30 Katowice => Key Account Manager (ERP) <=
- 2024-11-30 Immatrykulacja...