recently trying to use Fastdb for development, C + + version under test basic OK , since the project team adopted C # development, so the switch C # Development Fastdb , the results found C # version of a variety of castration, if the definition of variable self-increment, then a type definition error occurs, a trace down found in Fastdb not defined when value is taken cli_autoincrement caused by.
because Fastdb the cli_autoincrement is handled in a manner similar to Int4 , so it's a similar Int4 Type conversions for types
Modify the code as follows:
Protected unsafe virtual Object getValue (Type t) {
Switch (CLI. FieldType) ((CLI. unmanagedbuffer*) buffer. ToPointer ())->type) {
Case CLI. Fieldtype.cli_bool:
Case CLI. FieldType.cli_int1:return Convert.changetype (* (sbyte*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer (), t);
Case CLI. FieldType.cli_int2:return Convert.changetype (* (short*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer (), t);
Case CLI. FieldType.cli_oid:return Convert.changetype (* (uint*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer (), t);
Case CLI. FieldType.cli_autoincrement:return Convert.changetype (* (int*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer (), t);
Case CLI. FieldType.cli_int4:return Convert.changetype (* (int*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer (), t);
Case CLI. FieldType.cli_int8:return Convert.changetype (* (int64*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer (), t);
Case CLI. FieldType.cli_real4:return Convert.changetype (* (single*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer (), t);
Case CLI. Fieldtype.cli_datetime:
Case CLI. FieldType.cli_real8:return Convert.changetype (* (double*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer (), t);
Case CLI. Fieldtype.cli_asciiz:
Case CLI. FieldType.cli_pasciiz:return Convert.changetype (Marshal.ptrtostringansi ((CLI. unmanagedbuffer*) buffer. ToPointer ())->data), T);
Case CLI. Fieldtype.cli_array_of_int1:
if (t = = typeof (byte[])) {
int len = Size;
byte[] arr = new Byte[len];
byte* src = (byte*) (CLI. unmanagedbuffer*) buffer. ToPointer ())->data. ToPointer ();
for (int i = 0; i < len; i++) {
Arr[i] = *src++;
}
return arr;
} else {
throw new Clierror ("Getvalue:unsupported conversion type!" +enum.getname (typeof (CLI. FieldType), ((CLI. unmanagedbuffer*) buffer. ToPointer ()) (->type));
}
Default:throw new Clierror ("Getvalue:unsupported type!" +enum.getname (typeof (CLI. FieldType), ((CLI. unmanagedbuffer*) buffer. ToPointer ()) (->type));
}
}
run again, OK , run through
Personal feeling
Fastdb The literature is too small, the community is not active, welcome everyone to contribute actively.
Fastdb query speed is at the forefront of similar databases.
Fastdb of the C # version is C + + version of the package, but also belongs to the unfinished version, for commercial development please use caution.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Fastdb definition cli_autoincrement self-increment variable error