[Groonga-commit] groonga/grnxx at 4001f1c [master] Disable remove_row() for a table referred to from a key column. (#71)

Back to archive index

susumu.yata null+****@clear*****
Fri Oct 3 10:49:48 JST 2014


susumu.yata	2014-10-03 10:49:48 +0900 (Fri, 03 Oct 2014)

  New Revision: 4001f1ce57689d718126a051e4e7f28167637b05
  https://github.com/groonga/grnxx/commit/4001f1ce57689d718126a051e4e7f28167637b05

  Message:
    Disable remove_row() for a table referred to from a key column. (#71)

  Modified files:
    lib/grnxx/table.cpp

  Modified: lib/grnxx/table.cpp (+7 -1)
===================================================================
--- lib/grnxx/table.cpp    2014-10-03 10:45:39 +0900 (726d135)
+++ lib/grnxx/table.cpp    2014-10-03 10:49:48 +0900 (6777e8d)
@@ -418,7 +418,13 @@ bool Table::remove_row(Error *error, Int row_id) {
     return false;
   }
   // TODO: Check removability.
-
+  for (Int i = 0; i < referrer_columns_.size(); ++i) {
+    if (referrer_columns_[i]->has_key_attribute()) {
+      GRNXX_ERROR_SET(error, INVALID_OPERATION,
+                      "This table is referred to from a key column");
+      return false;
+    }
+  }
   // Unset column values.
   for (Int column_id = 0; column_id < num_columns(); ++column_id) {
     columns_[column_id]->unset(row_id);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index