[Groonga-commit] groonga/grngo at 17c22a0 [master] Disable GetValue().

Back to archive index

susumu.yata null+****@clear*****
Wed Jul 22 11:41:16 JST 2015


susumu.yata	2015-07-22 11:41:16 +0900 (Wed, 22 Jul 2015)

  New Revision: 17c22a0a1368d5a4d0949dc94522734ef2f8521c
  https://github.com/groonga/grngo/commit/17c22a0a1368d5a4d0949dc94522734ef2f8521c

  Message:
    Disable GetValue().

  Modified files:
    grngo.go
    grngo_test.go

  Modified: grngo.go (+223 -223)
===================================================================
--- grngo.go    2015-07-21 17:35:11 +0900 (9998114)
+++ grngo.go    2015-07-22 11:41:16 +0900 (f9ad84c)
@@ -839,14 +839,14 @@ func (db *DB) SetValue(tableName, columnName string, id uint32, value interface{
 	return table.SetValue(columnName, id, value)
 }
 
-// GetValue gets a value.
-func (db *DB) GetValue(tableName, columnName string, id uint32) (interface{}, error) {
-	table, err := db.FindTable(tableName)
-	if err != nil {
-		return nil, err
-	}
-	return table.GetValue(columnName, id)
-}
+//// GetValue gets a value.
+//func (db *DB) GetValue(tableName, columnName string, id uint32) (interface{}, error) {
+//	table, err := db.FindTable(tableName)
+//	if err != nil {
+//		return nil, err
+//	}
+//	return table.GetValue(columnName, id)
+//}
 
 // -- Table --
 
@@ -942,14 +942,14 @@ func (table *Table) SetValue(columnName string, id uint32, value interface{}) er
 	return column.SetValue(id, value)
 }
 
-// GetValue gets a value.
-func (table *Table) GetValue(columnName string, id uint32) (interface{}, error) {
-	column, err := table.FindColumn(columnName)
-	if err != nil {
-		return nil, err
-	}
-	return column.GetValue(id)
-}
+//// GetValue gets a value.
+//func (table *Table) GetValue(columnName string, id uint32) (interface{}, error) {
+//	column, err := table.FindColumn(columnName)
+//	if err != nil {
+//		return nil, err
+//	}
+//	return column.GetValue(id)
+//}
 
 // createColumnOptionsMap creates an options map for column_create.
 //
@@ -1432,210 +1432,210 @@ func (column *Column) SetValue(id uint32, value interface{}) error {
 	}
 }
 
-// getBool gets a Bool value.
-func (column *Column) getBool(id uint32) (interface{}, error) {
-	var grnValue C.grn_bool
-	if ok := C.grngo_column_get_bool(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_bool() failed")
-	}
-	return grnValue == C.GRN_TRUE, nil
-}
-
-// getInt gets an Int value.
-func (column *Column) getInt(id uint32) (interface{}, error) {
-	var grnValue C.int64_t
-	if ok := C.grngo_column_get_int(column.table.db.ctx, column.obj,
-		C.grn_builtin_type(column.valueType),
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_int() failed")
-	}
-	return int64(grnValue), nil
-}
-
-// getFloat gets a Float value.
-func (column *Column) getFloat(id uint32) (interface{}, error) {
-	var grnValue C.double
-	if ok := C.grngo_column_get_float(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_float() failed")
-	}
-	return float64(grnValue), nil
-}
-
-// getText gets a Text value.
-func (column *Column) getText(id uint32) (interface{}, error) {
-	var grnValue C.grngo_text
-	if ok := C.grngo_column_get_text(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_text() failed")
-	}
-	if grnValue.size == 0 {
-		return make([]byte, 0), nil
-	}
-	value := make([]byte, int(grnValue.size))
-	grnValue.ptr = (*C.char)(unsafe.Pointer(&value[0]))
-	if ok := C.grngo_column_get_text(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_text() failed")
-	}
-	return value, nil
-}
-
-// getGeoPoint gets a GeoPoint value.
-func (column *Column) getGeoPoint(id uint32) (interface{}, error) {
-	var grnValue C.grn_geo_point
-	if ok := C.grngo_column_get_geo_point(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_geo_point() failed")
-	}
-	return GeoPoint{int32(grnValue.latitude), int32(grnValue.longitude)}, nil
-}
-
-// getBoolVector gets a BoolVector.
-func (column *Column) getBoolVector(id uint32) (interface{}, error) {
-	var grnVector C.grngo_vector
-	if ok := C.grngo_column_get_bool_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_bool_vector() failed")
-	}
-	if grnVector.size == 0 {
-		return make([]bool, 0), nil
-	}
-	grnValue := make([]C.grn_bool, int(grnVector.size))
-	grnVector.ptr = unsafe.Pointer(&grnValue[0])
-	if ok := C.grngo_column_get_bool_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_bool_vector() failed")
-	}
-	value := make([]bool, int(grnVector.size))
-	for i, v := range grnValue {
-		value[i] = (v == C.GRN_TRUE)
-	}
-	return value, nil
-}
-
-// getIntVector gets a IntVector.
-func (column *Column) getIntVector(id uint32) (interface{}, error) {
-	var grnValue C.grngo_vector
-	if ok := C.grngo_column_get_int_vector(column.table.db.ctx, column.obj,
-		C.grn_builtin_type(column.valueType),
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_int_vector() failed")
-	}
-	if grnValue.size == 0 {
-		return make([]int64, 0), nil
-	}
-	value := make([]int64, int(grnValue.size))
-	grnValue.ptr = unsafe.Pointer(&value[0])
-	if ok := C.grngo_column_get_int_vector(column.table.db.ctx, column.obj,
-		C.grn_builtin_type(column.valueType),
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_int_vector() failed")
-	}
-	return value, nil
-}
-
-// getFloatVector gets a FloatVector.
-func (column *Column) getFloatVector(id uint32) (interface{}, error) {
-	var grnValue C.grngo_vector
-	if ok := C.grngo_column_get_float_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_float_vector() failed")
-	}
-	if grnValue.size == 0 {
-		return make([]float64, 0), nil
-	}
-	value := make([]float64, int(grnValue.size))
-	grnValue.ptr = unsafe.Pointer(&value[0])
-	if ok := C.grngo_column_get_float_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_float_vector() failed")
-	}
-	return value, nil
-}
-
-// getTextVector gets a TextVector.
-func (column *Column) getTextVector(id uint32) (interface{}, error) {
-	var grnVector C.grngo_vector
-	if ok := C.grngo_column_get_text_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_text_vector() failed")
-	}
-	if grnVector.size == 0 {
-		return make([][]byte, 0), nil
-	}
-	grnValues := make([]C.grngo_text, int(grnVector.size))
-	grnVector.ptr = unsafe.Pointer(&grnValues[0])
-	if ok := C.grngo_column_get_text_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_text_vector() failed")
-	}
-	value := make([][]byte, int(grnVector.size))
-	for i, grnValue := range grnValues {
-		if grnValue.size != 0 {
-			value[i] = make([]byte, int(grnValue.size))
-			grnValues[i].ptr = (*C.char)(unsafe.Pointer(&value[i][0]))
-		}
-	}
-	if ok := C.grngo_column_get_text_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_text_vector() failed")
-	}
-	return value, nil
-}
-
-// getGeoPointVector gets a GeoPointVector.
-func (column *Column) getGeoPointVector(id uint32) (interface{}, error) {
-	var grnValue C.grngo_vector
-	if ok := C.grngo_column_get_geo_point_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_geo_point_vector() failed")
-	}
-	if grnValue.size == 0 {
-		return make([]GeoPoint, 0), nil
-	}
-	value := make([]GeoPoint, int(grnValue.size))
-	grnValue.ptr = unsafe.Pointer(&value[0])
-	if ok := C.grngo_column_get_geo_point_vector(column.table.db.ctx, column.obj,
-		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
-		return nil, fmt.Errorf("grngo_column_get_geo_point_vector() failed")
-	}
-	return value, nil
-}
-
-// GetValue gets a value.
-func (column *Column) GetValue(id uint32) (interface{}, error) {
-	if !column.isVector {
-		switch column.valueType {
-		case Bool:
-			return column.getBool(id)
-		case Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64:
-			return column.getInt(id)
-		case Float:
-			return column.getFloat(id)
-		case Time:
-			return column.getInt(id)
-		case ShortText, Text, LongText:
-			return column.getText(id)
-		case TokyoGeoPoint, WGS84GeoPoint:
-			return column.getGeoPoint(id)
-		}
-	} else {
-		switch column.valueType {
-		case Bool:
-			return column.getBoolVector(id)
-		case Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64:
-			return column.getIntVector(id)
-		case Float:
-			return column.getFloatVector(id)
-		case Time:
-			return column.getIntVector(id)
-		case ShortText, Text, LongText:
-			return column.getTextVector(id)
-		case TokyoGeoPoint, WGS84GeoPoint:
-			return column.getGeoPointVector(id)
-		}
-	}
-	return nil, fmt.Errorf("undefined value type: valueType = %d", column.valueType)
-}
+//// getBool gets a Bool value.
+//func (column *Column) getBool(id uint32) (interface{}, error) {
+//	var grnValue C.grn_bool
+//	if ok := C.grngo_column_get_bool(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_bool() failed")
+//	}
+//	return grnValue == C.GRN_TRUE, nil
+//}
+
+//// getInt gets an Int value.
+//func (column *Column) getInt(id uint32) (interface{}, error) {
+//	var grnValue C.int64_t
+//	if ok := C.grngo_column_get_int(column.table.db.ctx, column.obj,
+//		C.grn_builtin_type(column.valueType),
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_int() failed")
+//	}
+//	return int64(grnValue), nil
+//}
+
+//// getFloat gets a Float value.
+//func (column *Column) getFloat(id uint32) (interface{}, error) {
+//	var grnValue C.double
+//	if ok := C.grngo_column_get_float(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_float() failed")
+//	}
+//	return float64(grnValue), nil
+//}
+
+//// getText gets a Text value.
+//func (column *Column) getText(id uint32) (interface{}, error) {
+//	var grnValue C.grngo_text
+//	if ok := C.grngo_column_get_text(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_text() failed")
+//	}
+//	if grnValue.size == 0 {
+//		return make([]byte, 0), nil
+//	}
+//	value := make([]byte, int(grnValue.size))
+//	grnValue.ptr = (*C.char)(unsafe.Pointer(&value[0]))
+//	if ok := C.grngo_column_get_text(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_text() failed")
+//	}
+//	return value, nil
+//}
+
+//// getGeoPoint gets a GeoPoint value.
+//func (column *Column) getGeoPoint(id uint32) (interface{}, error) {
+//	var grnValue C.grn_geo_point
+//	if ok := C.grngo_column_get_geo_point(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_geo_point() failed")
+//	}
+//	return GeoPoint{int32(grnValue.latitude), int32(grnValue.longitude)}, nil
+//}
+
+//// getBoolVector gets a BoolVector.
+//func (column *Column) getBoolVector(id uint32) (interface{}, error) {
+//	var grnVector C.grngo_vector
+//	if ok := C.grngo_column_get_bool_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_bool_vector() failed")
+//	}
+//	if grnVector.size == 0 {
+//		return make([]bool, 0), nil
+//	}
+//	grnValue := make([]C.grn_bool, int(grnVector.size))
+//	grnVector.ptr = unsafe.Pointer(&grnValue[0])
+//	if ok := C.grngo_column_get_bool_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_bool_vector() failed")
+//	}
+//	value := make([]bool, int(grnVector.size))
+//	for i, v := range grnValue {
+//		value[i] = (v == C.GRN_TRUE)
+//	}
+//	return value, nil
+//}
+
+//// getIntVector gets a IntVector.
+//func (column *Column) getIntVector(id uint32) (interface{}, error) {
+//	var grnValue C.grngo_vector
+//	if ok := C.grngo_column_get_int_vector(column.table.db.ctx, column.obj,
+//		C.grn_builtin_type(column.valueType),
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_int_vector() failed")
+//	}
+//	if grnValue.size == 0 {
+//		return make([]int64, 0), nil
+//	}
+//	value := make([]int64, int(grnValue.size))
+//	grnValue.ptr = unsafe.Pointer(&value[0])
+//	if ok := C.grngo_column_get_int_vector(column.table.db.ctx, column.obj,
+//		C.grn_builtin_type(column.valueType),
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_int_vector() failed")
+//	}
+//	return value, nil
+//}
+
+//// getFloatVector gets a FloatVector.
+//func (column *Column) getFloatVector(id uint32) (interface{}, error) {
+//	var grnValue C.grngo_vector
+//	if ok := C.grngo_column_get_float_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_float_vector() failed")
+//	}
+//	if grnValue.size == 0 {
+//		return make([]float64, 0), nil
+//	}
+//	value := make([]float64, int(grnValue.size))
+//	grnValue.ptr = unsafe.Pointer(&value[0])
+//	if ok := C.grngo_column_get_float_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_float_vector() failed")
+//	}
+//	return value, nil
+//}
+
+//// getTextVector gets a TextVector.
+//func (column *Column) getTextVector(id uint32) (interface{}, error) {
+//	var grnVector C.grngo_vector
+//	if ok := C.grngo_column_get_text_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_text_vector() failed")
+//	}
+//	if grnVector.size == 0 {
+//		return make([][]byte, 0), nil
+//	}
+//	grnValues := make([]C.grngo_text, int(grnVector.size))
+//	grnVector.ptr = unsafe.Pointer(&grnValues[0])
+//	if ok := C.grngo_column_get_text_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_text_vector() failed")
+//	}
+//	value := make([][]byte, int(grnVector.size))
+//	for i, grnValue := range grnValues {
+//		if grnValue.size != 0 {
+//			value[i] = make([]byte, int(grnValue.size))
+//			grnValues[i].ptr = (*C.char)(unsafe.Pointer(&value[i][0]))
+//		}
+//	}
+//	if ok := C.grngo_column_get_text_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnVector); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_text_vector() failed")
+//	}
+//	return value, nil
+//}
+
+//// getGeoPointVector gets a GeoPointVector.
+//func (column *Column) getGeoPointVector(id uint32) (interface{}, error) {
+//	var grnValue C.grngo_vector
+//	if ok := C.grngo_column_get_geo_point_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_geo_point_vector() failed")
+//	}
+//	if grnValue.size == 0 {
+//		return make([]GeoPoint, 0), nil
+//	}
+//	value := make([]GeoPoint, int(grnValue.size))
+//	grnValue.ptr = unsafe.Pointer(&value[0])
+//	if ok := C.grngo_column_get_geo_point_vector(column.table.db.ctx, column.obj,
+//		C.grn_id(id), &grnValue); ok != C.GRN_TRUE {
+//		return nil, fmt.Errorf("grngo_column_get_geo_point_vector() failed")
+//	}
+//	return value, nil
+//}
+
+//// GetValue gets a value.
+//func (column *Column) GetValue(id uint32) (interface{}, error) {
+//	if !column.isVector {
+//		switch column.valueType {
+//		case Bool:
+//			return column.getBool(id)
+//		case Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64:
+//			return column.getInt(id)
+//		case Float:
+//			return column.getFloat(id)
+//		case Time:
+//			return column.getInt(id)
+//		case ShortText, Text, LongText:
+//			return column.getText(id)
+//		case TokyoGeoPoint, WGS84GeoPoint:
+//			return column.getGeoPoint(id)
+//		}
+//	} else {
+//		switch column.valueType {
+//		case Bool:
+//			return column.getBoolVector(id)
+//		case Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64:
+//			return column.getIntVector(id)
+//		case Float:
+//			return column.getFloatVector(id)
+//		case Time:
+//			return column.getIntVector(id)
+//		case ShortText, Text, LongText:
+//			return column.getTextVector(id)
+//		case TokyoGeoPoint, WGS84GeoPoint:
+//			return column.getGeoPointVector(id)
+//		}
+//	}
+//	return nil, fmt.Errorf("undefined value type: valueType = %d", column.valueType)
+//}

  Modified: grngo_test.go (+289 -289)
===================================================================
--- grngo_test.go    2015-07-21 17:35:11 +0900 (11d0435)
+++ grngo_test.go    2015-07-22 11:41:16 +0900 (9887521)
@@ -5,7 +5,7 @@ import (
 	"io/ioutil"
 	"math/rand"
 	"os"
-	"reflect"
+//	"reflect"
 	"strconv"
 	"strings"
 	"testing"
@@ -1051,156 +1051,156 @@ func TestColumnSetValueForWGS84GeoPointVector(t *testing.T) {
 	testColumnSetValue(t, "[]WGS84GeoPoint")
 }
 
-func testColumnGetValue(t *testing.T, valueType string) {
-	dirPath, _, db, table, column :=
-		createTempColumn(t, "Table", nil, "Value", valueType, nil)
-	defer removeTempDB(t, dirPath, db)
-
-	for i := 0; i < 100; i++ {
-		_, id, err := table.InsertRow(nil)
-		if err != nil {
-			t.Fatalf("Table.InsertRow() failed: %v", err)
-		}
-		value := generateRandomValue(valueType)
-		if err := column.SetValue(id, value); err != nil {
-			t.Fatalf("Column.SetValue() failed: %v", err)
-		}
-		if storedValue, err := column.GetValue(id); err != nil {
-			t.Fatalf("Column.GetValue() failed: %v", err)
-		} else if !reflect.DeepEqual(value, storedValue) {
-			t.Fatalf("Column.GetValue() failed: value = %v, storedValue = %v",
-				value, storedValue)
-		}
-	}
-}
-
-func TestColumnGetValueForBool(t *testing.T) {
-	testColumnGetValue(t, "Bool")
-}
-
-func TestColumnGetValueForInt8(t *testing.T) {
-	testColumnGetValue(t, "Int8")
-}
-
-func TestColumnGetValueForInt16(t *testing.T) {
-	testColumnGetValue(t, "Int16")
-}
-
-func TestColumnGetValueForInt32(t *testing.T) {
-	testColumnGetValue(t, "Int32")
-}
-
-func TestColumnGetValueForInt64(t *testing.T) {
-	testColumnGetValue(t, "Int64")
-}
-
-func TestColumnGetValueForUInt8(t *testing.T) {
-	testColumnGetValue(t, "UInt8")
-}
-
-func TestColumnGetValueForUInt16(t *testing.T) {
-	testColumnGetValue(t, "UInt16")
-}
-
-func TestColumnGetValueForUInt32(t *testing.T) {
-	testColumnGetValue(t, "UInt32")
-}
-
-func TestColumnGetValueForUInt64(t *testing.T) {
-	testColumnGetValue(t, "UInt64")
-}
-
-func TestColumnGetValueForFloat(t *testing.T) {
-	testColumnGetValue(t, "Float")
-}
-
-func TestColumnGetValueForTime(t *testing.T) {
-	testColumnGetValue(t, "Time")
-}
-
-func TestColumnGetValueForShortText(t *testing.T) {
-	testColumnGetValue(t, "ShortText")
-}
+//func testColumnGetValue(t *testing.T, valueType string) {
+//	dirPath, _, db, table, column :=
+//		createTempColumn(t, "Table", nil, "Value", valueType, nil)
+//	defer removeTempDB(t, dirPath, db)
+
+//	for i := 0; i < 100; i++ {
+//		_, id, err := table.InsertRow(nil)
+//		if err != nil {
+//			t.Fatalf("Table.InsertRow() failed: %v", err)
+//		}
+//		value := generateRandomValue(valueType)
+//		if err := column.SetValue(id, value); err != nil {
+//			t.Fatalf("Column.SetValue() failed: %v", err)
+//		}
+//		if storedValue, err := column.GetValue(id); err != nil {
+//			t.Fatalf("Column.GetValue() failed: %v", err)
+//		} else if !reflect.DeepEqual(value, storedValue) {
+//			t.Fatalf("Column.GetValue() failed: value = %v, storedValue = %v",
+//				value, storedValue)
+//		}
+//	}
+//}
+
+//func TestColumnGetValueForBool(t *testing.T) {
+//	testColumnGetValue(t, "Bool")
+//}
+
+//func TestColumnGetValueForInt8(t *testing.T) {
+//	testColumnGetValue(t, "Int8")
+//}
+
+//func TestColumnGetValueForInt16(t *testing.T) {
+//	testColumnGetValue(t, "Int16")
+//}
+
+//func TestColumnGetValueForInt32(t *testing.T) {
+//	testColumnGetValue(t, "Int32")
+//}
+
+//func TestColumnGetValueForInt64(t *testing.T) {
+//	testColumnGetValue(t, "Int64")
+//}
+
+//func TestColumnGetValueForUInt8(t *testing.T) {
+//	testColumnGetValue(t, "UInt8")
+//}
+
+//func TestColumnGetValueForUInt16(t *testing.T) {
+//	testColumnGetValue(t, "UInt16")
+//}
+
+//func TestColumnGetValueForUInt32(t *testing.T) {
+//	testColumnGetValue(t, "UInt32")
+//}
+
+//func TestColumnGetValueForUInt64(t *testing.T) {
+//	testColumnGetValue(t, "UInt64")
+//}
+
+//func TestColumnGetValueForFloat(t *testing.T) {
+//	testColumnGetValue(t, "Float")
+//}
+
+//func TestColumnGetValueForTime(t *testing.T) {
+//	testColumnGetValue(t, "Time")
+//}
+
+//func TestColumnGetValueForShortText(t *testing.T) {
+//	testColumnGetValue(t, "ShortText")
+//}
+
+//func TestColumnGetValueForText(t *testing.T) {
+//	testColumnGetValue(t, "Text")
+//}
+
+//func TestColumnGetValueForLongText(t *testing.T) {
+//	testColumnGetValue(t, "LongText")
+//}
+
+//func TestColumnGetValueForTokyoGeoPoint(t *testing.T) {
+//	testColumnGetValue(t, "TokyoGeoPoint")
+//}
+
+//func TestColumnGetValueForWGS84GeoPoint(t *testing.T) {
+//	testColumnGetValue(t, "WGS84GeoPoint")
+//}
+
+//func TestColumnGetValueForBoolVector(t *testing.T) {
+//	testColumnGetValue(t, "[]Bool")
+//}
+
+//func TestColumnGetValueForInt8Vector(t *testing.T) {
+//	testColumnGetValue(t, "[]Int8")
+//}
+
+//func TestColumnGetValueForInt16Vector(t *testing.T) {
+//	testColumnGetValue(t, "[]Int16")
+//}
+
+//func TestColumnGetValueForInt32Vector(t *testing.T) {
+//	testColumnGetValue(t, "[]Int32")
+//}
+
+//func TestColumnGetValueForInt64Vector(t *testing.T) {
+//	testColumnGetValue(t, "[]Int64")
+//}
+
+//func TestColumnGetValueForUInt8Vector(t *testing.T) {
+//	testColumnGetValue(t, "[]UInt8")
+//}
+
+//func TestColumnGetValueForUInt16Vector(t *testing.T) {
+//	testColumnGetValue(t, "[]UInt16")
+//}
+
+//func TestColumnGetValueForUInt32Vector(t *testing.T) {
+//	testColumnGetValue(t, "[]UInt32")
+//}
 
-func TestColumnGetValueForText(t *testing.T) {
-	testColumnGetValue(t, "Text")
-}
+//func TestColumnGetValueForUInt64Vector(t *testing.T) {
+//	testColumnGetValue(t, "[]UInt64")
+//}
 
-func TestColumnGetValueForLongText(t *testing.T) {
-	testColumnGetValue(t, "LongText")
-}
-
-func TestColumnGetValueForTokyoGeoPoint(t *testing.T) {
-	testColumnGetValue(t, "TokyoGeoPoint")
-}
+//func TestColumnGetValueForFloatVector(t *testing.T) {
+//	testColumnGetValue(t, "[]Float")
+//}
 
-func TestColumnGetValueForWGS84GeoPoint(t *testing.T) {
-	testColumnGetValue(t, "WGS84GeoPoint")
-}
+//func TestColumnGetValueForTimeVector(t *testing.T) {
+//	testColumnGetValue(t, "[]Time")
+//}
 
-func TestColumnGetValueForBoolVector(t *testing.T) {
-	testColumnGetValue(t, "[]Bool")
-}
+//func TestColumnGetValueForShortTextVector(t *testing.T) {
+//	testColumnGetValue(t, "[]ShortText")
+//}
 
-func TestColumnGetValueForInt8Vector(t *testing.T) {
-	testColumnGetValue(t, "[]Int8")
-}
+//func TestColumnGetValueForTextVector(t *testing.T) {
+//	testColumnGetValue(t, "[]Text")
+//}
 
-func TestColumnGetValueForInt16Vector(t *testing.T) {
-	testColumnGetValue(t, "[]Int16")
-}
+//func TestColumnGetValueForLongTextVector(t *testing.T) {
+//	testColumnGetValue(t, "[]LongText")
+//}
 
-func TestColumnGetValueForInt32Vector(t *testing.T) {
-	testColumnGetValue(t, "[]Int32")
-}
+//func TestColumnGetValueForTokyoGeoPointVector(t *testing.T) {
+//	testColumnGetValue(t, "[]TokyoGeoPoint")
+//}
 
-func TestColumnGetValueForInt64Vector(t *testing.T) {
-	testColumnGetValue(t, "[]Int64")
-}
-
-func TestColumnGetValueForUInt8Vector(t *testing.T) {
-	testColumnGetValue(t, "[]UInt8")
-}
-
-func TestColumnGetValueForUInt16Vector(t *testing.T) {
-	testColumnGetValue(t, "[]UInt16")
-}
-
-func TestColumnGetValueForUInt32Vector(t *testing.T) {
-	testColumnGetValue(t, "[]UInt32")
-}
-
-func TestColumnGetValueForUInt64Vector(t *testing.T) {
-	testColumnGetValue(t, "[]UInt64")
-}
-
-func TestColumnGetValueForFloatVector(t *testing.T) {
-	testColumnGetValue(t, "[]Float")
-}
-
-func TestColumnGetValueForTimeVector(t *testing.T) {
-	testColumnGetValue(t, "[]Time")
-}
-
-func TestColumnGetValueForShortTextVector(t *testing.T) {
-	testColumnGetValue(t, "[]ShortText")
-}
-
-func TestColumnGetValueForTextVector(t *testing.T) {
-	testColumnGetValue(t, "[]Text")
-}
-
-func TestColumnGetValueForLongTextVector(t *testing.T) {
-	testColumnGetValue(t, "[]LongText")
-}
-
-func TestColumnGetValueForTokyoGeoPointVector(t *testing.T) {
-	testColumnGetValue(t, "[]TokyoGeoPoint")
-}
-
-func TestColumnGetValueForWGS84GeoPointVector(t *testing.T) {
-	testColumnGetValue(t, "[]WGS84GeoPoint")
-}
+//func TestColumnGetValueForWGS84GeoPointVector(t *testing.T) {
+//	testColumnGetValue(t, "[]WGS84GeoPoint")
+//}
 
 // Benchmarks.
 
@@ -1366,159 +1366,159 @@ func BenchmarkColumnSetValueForWGS84GeoPointVector(b *testing.B) {
 	benchmarkColumnSetValue(b, "[]WGS84GeoPoint")
 }
 
-func benchmarkColumnGetValue(b *testing.B, valueType string) {
-	dirPath, _, db, table, column :=
-		createTempColumn(b, "Table", nil, "Value", valueType, nil)
-	defer removeTempDB(b, dirPath, db)
-	ids := make([]uint32, numTestRows)
-	for i, _ := range ids {
-		_, id, err := table.InsertRow(nil)
-		if err != nil {
-			b.Fatalf("Table.InsertRow() failed: %s", err)
-		}
-		if err := column.SetValue(id, generateRandomValue(valueType)); err != nil {
-			b.Fatalf("Column.SetValue() failed: %s", err)
-		}
-		ids[i] = id
-	}
-
-	b.ResetTimer()
-	for i := 0; i < b.N; i++ {
-		for _, id := range ids {
-			if _, err := column.GetValue(id); err != nil {
-				b.Fatalf("Column.GetValue() failed: %s", err)
-			}
-		}
-	}
-}
-
-func BenchmarkColumnGetValueForBool(b *testing.B) {
-	benchmarkColumnGetValue(b, "Bool")
-}
-
-func BenchmarkColumnGetValueForInt8(b *testing.B) {
-	benchmarkColumnGetValue(b, "Int8")
-}
-
-func BenchmarkColumnGetValueForInt16(b *testing.B) {
-	benchmarkColumnGetValue(b, "Int16")
-}
-
-func BenchmarkColumnGetValueForInt32(b *testing.B) {
-	benchmarkColumnGetValue(b, "Int32")
-}
-
-func BenchmarkColumnGetValueForInt64(b *testing.B) {
-	benchmarkColumnGetValue(b, "Int64")
-}
-
-func BenchmarkColumnGetValueForUInt8(b *testing.B) {
-	benchmarkColumnGetValue(b, "UInt8")
-}
-
-func BenchmarkColumnGetValueForUInt16(b *testing.B) {
-	benchmarkColumnGetValue(b, "UInt16")
-}
-
-func BenchmarkColumnGetValueForUInt32(b *testing.B) {
-	benchmarkColumnGetValue(b, "UInt32")
-}
-
-func BenchmarkColumnGetValueForUInt64(b *testing.B) {
-	benchmarkColumnGetValue(b, "UInt64")
-}
-
-func BenchmarkColumnGetValueForFloat(b *testing.B) {
-	benchmarkColumnGetValue(b, "Float")
-}
-
-func BenchmarkColumnGetValueForTime(b *testing.B) {
-	benchmarkColumnGetValue(b, "Time")
-}
+//func benchmarkColumnGetValue(b *testing.B, valueType string) {
+//	dirPath, _, db, table, column :=
+//		createTempColumn(b, "Table", nil, "Value", valueType, nil)
+//	defer removeTempDB(b, dirPath, db)
+//	ids := make([]uint32, numTestRows)
+//	for i, _ := range ids {
+//		_, id, err := table.InsertRow(nil)
+//		if err != nil {
+//			b.Fatalf("Table.InsertRow() failed: %s", err)
+//		}
+//		if err := column.SetValue(id, generateRandomValue(valueType)); err != nil {
+//			b.Fatalf("Column.SetValue() failed: %s", err)
+//		}
+//		ids[i] = id
+//	}
+
+//	b.ResetTimer()
+//	for i := 0; i < b.N; i++ {
+//		for _, id := range ids {
+//			if _, err := column.GetValue(id); err != nil {
+//				b.Fatalf("Column.GetValue() failed: %s", err)
+//			}
+//		}
+//	}
+//}
+
+//func BenchmarkColumnGetValueForBool(b *testing.B) {
+//	benchmarkColumnGetValue(b, "Bool")
+//}
+
+//func BenchmarkColumnGetValueForInt8(b *testing.B) {
+//	benchmarkColumnGetValue(b, "Int8")
+//}
+
+//func BenchmarkColumnGetValueForInt16(b *testing.B) {
+//	benchmarkColumnGetValue(b, "Int16")
+//}
+
+//func BenchmarkColumnGetValueForInt32(b *testing.B) {
+//	benchmarkColumnGetValue(b, "Int32")
+//}
+
+//func BenchmarkColumnGetValueForInt64(b *testing.B) {
+//	benchmarkColumnGetValue(b, "Int64")
+//}
+
+//func BenchmarkColumnGetValueForUInt8(b *testing.B) {
+//	benchmarkColumnGetValue(b, "UInt8")
+//}
+
+//func BenchmarkColumnGetValueForUInt16(b *testing.B) {
+//	benchmarkColumnGetValue(b, "UInt16")
+//}
+
+//func BenchmarkColumnGetValueForUInt32(b *testing.B) {
+//	benchmarkColumnGetValue(b, "UInt32")
+//}
+
+//func BenchmarkColumnGetValueForUInt64(b *testing.B) {
+//	benchmarkColumnGetValue(b, "UInt64")
+//}
+
+//func BenchmarkColumnGetValueForFloat(b *testing.B) {
+//	benchmarkColumnGetValue(b, "Float")
+//}
+
+//func BenchmarkColumnGetValueForTime(b *testing.B) {
+//	benchmarkColumnGetValue(b, "Time")
+//}
+
+//func BenchmarkColumnGetValueForShortText(b *testing.B) {
+//	benchmarkColumnGetValue(b, "ShortText")
+//}
+
+//func BenchmarkColumnGetValueForText(b *testing.B) {
+//	benchmarkColumnGetValue(b, "Text")
+//}
+
+//func BenchmarkColumnGetValueForLongText(b *testing.B) {
+//	benchmarkColumnGetValue(b, "LongText")
+//}
+
+//func BenchmarkColumnGetValueForTokyoGeoPoint(b *testing.B) {
+//	benchmarkColumnGetValue(b, "TokyoGeoPoint")
+//}
+
+//func BenchmarkColumnGetValueForWGS84GeoPoint(b *testing.B) {
+//	benchmarkColumnGetValue(b, "WGS84GeoPoint")
+//}
+
+//func BenchmarkColumnGetValueForBoolVector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]Bool")
+//}
+
+//func BenchmarkColumnGetValueForInt8Vector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]Int8")
+//}
+
+//func BenchmarkColumnGetValueForInt16Vector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]Int16")
+//}
+
+//func BenchmarkColumnGetValueForInt32Vector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]Int32")
+//}
+
+//func BenchmarkColumnGetValueForInt64Vector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]Int64")
+//}
+
+//func BenchmarkColumnGetValueForUInt8Vector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]UInt8")
+//}
+
+//func BenchmarkColumnGetValueForUInt16Vector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]UInt16")
+//}
+
+//func BenchmarkColumnGetValueForUInt32Vector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]UInt32")
+//}
+
+//func BenchmarkColumnGetValueForUInt64Vector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]UInt64")
+//}
 
-func BenchmarkColumnGetValueForShortText(b *testing.B) {
-	benchmarkColumnGetValue(b, "ShortText")
-}
-
-func BenchmarkColumnGetValueForText(b *testing.B) {
-	benchmarkColumnGetValue(b, "Text")
-}
+//func BenchmarkColumnGetValueForFloatVector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]Float")
+//}
 
-func BenchmarkColumnGetValueForLongText(b *testing.B) {
-	benchmarkColumnGetValue(b, "LongText")
-}
+//func BenchmarkColumnGetValueForTimeVector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]Time")
+//}
 
-func BenchmarkColumnGetValueForTokyoGeoPoint(b *testing.B) {
-	benchmarkColumnGetValue(b, "TokyoGeoPoint")
-}
+//func BenchmarkColumnGetValueForShortTextVector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]ShortText")
+//}
 
-func BenchmarkColumnGetValueForWGS84GeoPoint(b *testing.B) {
-	benchmarkColumnGetValue(b, "WGS84GeoPoint")
-}
+//func BenchmarkColumnGetValueForTextVector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]Text")
+//}
 
-func BenchmarkColumnGetValueForBoolVector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]Bool")
-}
+//func BenchmarkColumnGetValueForLongTextVector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]LongText")
+//}
 
-func BenchmarkColumnGetValueForInt8Vector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]Int8")
-}
+//func BenchmarkColumnGetValueForTokyoGeoPointVector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]TokyoGeoPoint")
+//}
 
-func BenchmarkColumnGetValueForInt16Vector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]Int16")
-}
-
-func BenchmarkColumnGetValueForInt32Vector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]Int32")
-}
-
-func BenchmarkColumnGetValueForInt64Vector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]Int64")
-}
-
-func BenchmarkColumnGetValueForUInt8Vector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]UInt8")
-}
-
-func BenchmarkColumnGetValueForUInt16Vector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]UInt16")
-}
-
-func BenchmarkColumnGetValueForUInt32Vector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]UInt32")
-}
-
-func BenchmarkColumnGetValueForUInt64Vector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]UInt64")
-}
-
-func BenchmarkColumnGetValueForFloatVector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]Float")
-}
-
-func BenchmarkColumnGetValueForTimeVector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]Time")
-}
-
-func BenchmarkColumnGetValueForShortTextVector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]ShortText")
-}
-
-func BenchmarkColumnGetValueForTextVector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]Text")
-}
-
-func BenchmarkColumnGetValueForLongTextVector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]LongText")
-}
-
-func BenchmarkColumnGetValueForTokyoGeoPointVector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]TokyoGeoPoint")
-}
-
-func BenchmarkColumnGetValueForWGS84GeoPointVector(b *testing.B) {
-	benchmarkColumnGetValue(b, "[]WGS84GeoPoint")
-}
+//func BenchmarkColumnGetValueForWGS84GeoPointVector(b *testing.B) {
+//	benchmarkColumnGetValue(b, "[]WGS84GeoPoint")
+//}
 
 func benchmarkDBSelect(b *testing.B, valueType string) {
 	dirPath, _, db, table, column :=
-------------- next part --------------
HTML����������������������������...
Download 



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