store tree in database

أرسل من قبل malek في الأربعاء, 2007/09/12 - 2:42pm.
عضو فعال

تاريخ التسجيل: 2004-06-03
مشاركات: 88

الجامعة: البعث
الكلية: الهندسة المعلوماتية
المرحلة: متخرج
الاختصاص: هندسة برمجيات

أرجو ممن لديه أفكار عن طريقة تخزين الـ TreeView في الـ Database

حاولت بطريقة الـ recursion, عن طريق جدول يحتوي رقم الـ Node و رقم الـ Parent

لكن هذه الطريقة كلفت وقت كلما كبر حجم الـ Tree و تتطلب مرور كبير على الـ database

أرجو المساعدة

 
دخول أو تسجيل لإرسال التعليقات | قراءة: 215

خيارات عرض التعليقات

اختر طريقتك المفضلة لعرض التعليقات و اضغط "حفظ الإعدادات" لتفعيل تغييراتك.
الأربعاء, 2007/09/12 - 5:15pm
صورة as_els

تاريخ التسجيل: 2005-02-20
مشاركات: 258

الجامعة: غير ذلك
الكلية: الهندسة المعلوماتية
المرحلة: ماجستير
الاختصاص: هندسة شبكات

try by storing the full path for every node like this
(node_id,node_name,node_path)
for example see this
(1,grand,1)
(2,father,1-2)
(3,uncle,1-3)
(4,son,1-2-4)
(5,cuisine,1-3-5)
..... and so on
this will decrease database hits but needs more processing

 
دخول أو تسجيل لإرسال التعليقات
الأربعاء, 2007/09/12 - 5:18pm
صورة youstec

تاريخ التسجيل: 2004-03-16
مشاركات: 90

الجامعة: دمشق
الكلية: الهندسة المعلوماتية
المرحلة: متخرج
الاختصاص: هندسة برمجيات

You can store the data in the databse, but after making a trigger that palancing the data as a tree and referring for each node(row) to its parent and if it's on the right or left branch. there is such implementation free on internet. anyway it's a common way to extract fast reports in some financial systems, and if your databse had been built on this scheme then it's perfect for partioning on non-periodical factor, but you must be carefull because this implementation will slow down your transaction.

“You must be the change you wish to see in the world

 
دخول أو تسجيل لإرسال التعليقات
الأربعاء, 2007/09/12 - 6:28pm
عضو فعال

تاريخ التسجيل: 2004-06-03
مشاركات: 88

الجامعة: البعث
الكلية: الهندسة المعلوماتية
المرحلة: متخرج
الاختصاص: هندسة برمجيات

thank you all
I found many idea that speak like (as_els)

I will try to implement a trigger that manipulate the path on every insert

thanks

 
دخول أو تسجيل لإرسال التعليقات
السبت, 2007/09/22 - 12:54am

تاريخ التسجيل: 2004-10-29
مشاركات: 85

الجامعة: البعث
الكلية: الهندسة المعلوماتية
المرحلة: السنة الثالثة

I advise you to try ORDBMSs like Oracle , i.e. to try the object-orientation in Oracle for example. Or to try an OODBMS (ODBMS) fully relying on the OOP theory, like O2, db4objects or Versant.
I mean : try some thing different from the traditional "Relational" model(which most popular DBMSs rely on) like Access, MySQL.... Oracle.

النور يشع وسط الظلام والظلام لا يستطيع أن يمحوه

 
دخول أو تسجيل لإرسال التعليقات