قاعدة البيانات كخط الدفاع الأخير
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
explain why the database must enforce rules, not just the application.
الموضوعات المخطط لها
- Many applications and tools can write to one database: services, scripts, admins.
- Application checks can be skipped, buggy, or out of date.
- Concurrency: two requests pass the same application check at the same time ("check then insert"), then both insert.
- Constraints are enforced by the database for every writer, atomically.
- Keep application validation for friendly messages; keep constraints for guarantees.
تفاصيل المخطط المبدئي
عرض عملي
a timeline of two requests: both exists(sku) = false, both insert, two rows; with a unique constraint the second insert fails.
اختبر فهمك
Why does "check then insert" fail?
أظهر الإجابة
Two requests can both check before either inserts.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.