[Groonga-commit] groonga/grnxx at defa680 [master] Enable ref_table of ColumnImpl<Vector<Int>>. (#48)

Back to archive index

susumu.yata null+****@clear*****
Fri Sep 12 15:44:44 JST 2014


susumu.yata	2014-09-12 15:44:44 +0900 (Fri, 12 Sep 2014)

  New Revision: defa6800399c6ae7859fa296dace2b38c66b3d9d
  https://github.com/groonga/grnxx/commit/defa6800399c6ae7859fa296dace2b38c66b3d9d

  Message:
    Enable ref_table of ColumnImpl<Vector<Int>>. (#48)

  Modified files:
    lib/grnxx/column.cpp

  Modified: lib/grnxx/column.cpp (+8 -1)
===================================================================
--- lib/grnxx/column.cpp    2014-09-11 16:53:23 +0900 (c2dfd37)
+++ lib/grnxx/column.cpp    2014-09-12 15:44:44 +0900 (fc2f5f9)
@@ -183,7 +183,7 @@ bool Column::initialize_base(Error *error,
     return false;
   }
   data_type_ = data_type;
-  if (data_type == INT_DATA) {
+  if ((data_type == INT_DATA) || (data_type == INT_VECTOR_DATA)) {
     if (options.ref_table_name.size() != 0) {
       auto ref_table = table->db()->find_table(error, options.ref_table_name);
       if (!ref_table) {
@@ -487,6 +487,13 @@ bool ColumnImpl<Vector<Int>>::set(Error *error, Int row_id,
     headers_[row_id] = 0;
     return true;
   }
+  if (ref_table_) {
+    for (Int i = 0; i < value.size(); ++i) {
+      if (!ref_table_->test_row(error, value[i])) {
+        return false;
+      }
+    }
+  }
   Int offset = bodies_.size();
   if (value.size() < 0xFFFF) {
     if (!bodies_.resize(error, offset + value.size())) {
-------------- next part --------------
HTML����������������������������...
Download 



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