Class TupleBuilder
This class manages the creation of a Tuple Tuple
An instance of this class does not belong to a session so it is advise to reuse it for massive data management to gain a better perfomance. It keeps the values and its types in internal arrays. Hence, it can be reused for other tables, keys ar indexes as long as they have the same array of types.
To create an instance of this class, either a Table, an Index or a list of types must be provided.
This class allows the creation of all kinds of Tuples. These are Table tuplesbuild(Table), Index tuplesbuild(Index), key tuples buildKey(Table) and delta tuples buildDelta(Table).
This class provides the neccesary methods to set the columns values
Inheritance
Implements
Inherited Members
Namespace: lxapi
Assembly: lxapi.dll
Syntax
public class TupleBuilder : IDisposable
Examples
Table Tuple creation
TupleBuilder builder = table.tupleBuilder();
builder.add(0, "my location").add(1, 555).add(2, "aname").add(3, 555);
lxapi.Tuple tuple = builder.build(table);
builder.addIgnore(0).add(1, 666).add(2, "aname").addNull(3);
tuple = builder.build(table);
Key Tuple creation
TupleBuilder keybuilder = table.keyBuilder();
keybuilder.add(0, 666);
lxapi.Tuple key = keybuilder.buildKey(table);
Delta tuple creation
table = new Table(session, "delta table");
builder.add(1, -100);
table.upsert(builder.buildDelta(table));
builder.add(1, 50);
Index Tuple creation
lxapi.Index index = new lxapi.Index(table, "dniidx");
lxapi.Tuple min = index.tupleBuilder().add(0, "111111111Q").build(index);
Constructors
TupleBuilder(LxTypes[])
Creates a tuple Builder according to the list of types given LxTypes
Declaration
public TupleBuilder(LxTypes[] types)
Parameters
Type | Name | Description |
---|---|---|
LxTypes[] | types | list of types LxTypes |
Fields
kvTplBuilder
Tuple Builder Handle
Declaration
public IntPtr kvTplBuilder
Field Value
Type | Description |
---|---|
System.IntPtr |
Methods
add(Tuple)
Add the tuple's columns values
Declaration
public TupleBuilder add(Tuple tuple)
Parameters
Type | Name | Description |
---|---|---|
Tuple | tuple | tuple |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Int32, Decimal)
Add decimal value to column
Declaration
public TupleBuilder add(int userposition, Decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
Decimal | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Int32, Byte[])
Add byte array to column
Declaration
public TupleBuilder add(int userposition, byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
System.Byte[] | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Int32, Double, Int32)
Add double value to column
Declaration
public TupleBuilder add(int userposition, double value, int ndec = 2)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
System.Double | value | value |
System.Int32 | ndec | number of decimals when decimal column |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Int32, Int16)
Add short value to column
Declaration
public TupleBuilder add(int userposition, short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
System.Int16 | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Int32, Int32)
Add integer value to column
Declaration
public TupleBuilder add(int userposition, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
System.Int32 | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Int32, Int64)
Add long value to column
Declaration
public TupleBuilder add(int userposition, long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
System.Int64 | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Int32, Single, Int32)
Add float value to column
Declaration
public TupleBuilder add(int userposition, float value, int ndec = 2)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
System.Single | value | value |
System.Int32 | ndec | number of decimals when decimal column |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Int32, String, Int32)
Add double value to column
Declaration
public TupleBuilder add(int userposition, string value, int ndec = 2)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
System.String | value | value |
System.Int32 | ndec | number of decimals when decimal column |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(Object[])
Add an array of values
Declaration
public TupleBuilder add(object[] arr)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | arr | values |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(String, Byte[])
Add byte array to column
Declaration
public TupleBuilder add(string fieldname, byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
System.Byte[] | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(String, Double, Int32)
Add double value to column
Declaration
public TupleBuilder add(string fieldname, double value, int ndec = 2)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
System.Double | value | value |
System.Int32 | ndec | number of decimals when decimal column |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(String, Int16)
Add short value to column
Declaration
public TupleBuilder add(string fieldname, short value)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
System.Int16 | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(String, Int32)
Add integer value to column by column name
Declaration
public TupleBuilder add(string fieldname, int value)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
System.Int32 | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(String, Int64)
Add long value to column
Declaration
public TupleBuilder add(string fieldname, long value)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
System.Int64 | value | value |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(String, Single, Int32)
Add float value to column
Declaration
public TupleBuilder add(string fieldname, float value, int ndec = 2)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
System.Single | value | value |
System.Int32 | ndec | number of decimals when decimal column |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
add(String, String, Int32)
Add double value to column
Declaration
public TupleBuilder add(string fieldname, string value, int ndec = 2)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
System.String | value | value |
System.Int32 | ndec | number of decimals when decimal column |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
addIgnore(Int32)
Add ignore value to column
Declaration
public TupleBuilder addIgnore(int userposition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
addIgnore(String)
Add ignore value to column
Declaration
public TupleBuilder addIgnore(string fieldname)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
addNull(Int32)
Add null value to column
Declaration
public TupleBuilder addNull(int userposition)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userposition | column position |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
addNull(String)
Add null value to column
Declaration
public TupleBuilder addNull(string fieldname)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldname | column name |
Returns
Type | Description |
---|---|
TupleBuilder | modified TupleBuilder |
build(Index)
Build tuple for index
Declaration
public Tuple build(Index index)
Parameters
Type | Name | Description |
---|---|---|
Index | index |
Returns
Type | Description |
---|---|
Tuple |
build(Table)
Build tuple for table
Declaration
public Tuple build(Table table)
Parameters
Type | Name | Description |
---|---|---|
Table | table |
Returns
Type | Description |
---|---|
Tuple |
buildDelta(Table)
Build delta tuple for table
Declaration
public Tuple buildDelta(Table table)
Parameters
Type | Name | Description |
---|---|---|
Table | table |
Returns
Type | Description |
---|---|
Tuple |
buildKey(Table)
Build key tuple for table
Declaration
public Tuple buildKey(Table table)
Parameters
Type | Name | Description |
---|---|---|
Table | table |
Returns
Type | Description |
---|---|
Tuple |
Dispose()
Dispose
Declaration
public void Dispose()
Dispose(Boolean)
Release builder Handle
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
fieldType(Int32)
Column type
Declaration
public LxTypes fieldType(int fno)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | fno | column position |
Returns
Type | Description |
---|---|
LxTypes |
Finalize()
Destructor
Declaration
protected void Finalize()
reset()
Resets the column values
Mainly used to ensure it is not reusing column values from previous tuples
Declaration
public void reset()