Show / Hide Table of Contents

Class Tuple

Wrap a Leanxcale's Tuple Handle providing access to the row fields

This class represent the data stored in Kivi

Besides cloning, there are two ways to obtain a Tuple: One is building it with TupleBuilder. The other is by retrieving it from the database by a scan or a get. Hence, it is not possible to modify it once it has been obtained.

The Tuple class provide the functions to obtain its field values

There are three kind of tuples:

  • Table tuplesThey are the kind of tuple that represent a regular table row in Leanxcale. They are created by build(Table). They are aldo the ones retrived from scans and gets
  • Key tuplesThey are tuples where all tuple's fields belongs to the primary or secondary key. Note that the fields should be arranged following the same order as the table's primary key and there is no need to include all the key fields. They are created by buildKey(Table).
  • Index tuplesThey are the kind of tuple that represent a regular index row in Leanxcale. They are created by build(Index).
  • Delta tuplesUsed to upsert a row of a Table with delta fields. They are created by buildDelta(Table).
Scan scan = table.scan();

scan.begin(); lxapi.Tuple tableTuple = scan.next(); while (tableTuple != null) { tableTuple = scan.next(); for (int inx = 0; inx < table.info.numOfFields(); inx++) { if (!tableTuple.isNull(inx) && !tableTuple.isIgnore(inx)) { Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getString(inx)); } } } scan.end();

Inheritance
System.Object
Tuple
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: lxapi
Assembly: lxapi.dll
Syntax
public class Tuple : IDisposable

Constructors

Tuple(IntPtr, Boolean)

Create a Tuple from tuple Handle. Do not use this directly.

Use TupleBuilder to create a new one TupleBuilder.

Use Table or Scan to read an existing one Table and Scan.

Declaration
public Tuple(IntPtr kvTpl_, bool owntpl_ = true)
Parameters
Type Name Description
System.IntPtr kvTpl_

Tuple pointer

System.Boolean owntpl_

true when building, false when reading

Fields

kvTpl

Tuple Handle

Declaration
public readonly IntPtr kvTpl
Field Value
Type Description
System.IntPtr

owntpl

True when created with TupleBuilder. False when retrieved from a scan or a get

Declaration
public readonly bool owntpl
Field Value
Type Description
System.Boolean

Methods

clone()

Clone tuple

Declaration
public Tuple clone()
Returns
Type Description
Tuple
Examples
lxapi.Tuple tableTuple = scan.next();
lxapi.Tuple table2Tuple = tableTuple.clone();

columnType(Int32)

Column type

Declaration
public LxTypes columnType(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
LxTypes

LxTypes

Dispose()

Dispose

Declaration
public void Dispose()

Dispose(Boolean)

Release Tuple Handle

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Finalize()

Destructor

Declaration
protected void Finalize()

getBytes(Int32)

Get byte array value from column

Declaration
public byte[] getBytes(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.Byte[]

getDouble(Int32)

Get double value from column

Declaration
public double getDouble(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.Double
Examples
lxapi.Tuple tableTuple = scan.next();
Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getDouble(inx));

getFloat(Int32)

Get float value from column

Declaration
public float getFloat(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.Single
Examples
lxapi.Tuple tableTuple = scan.next();
Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getFloat(inx));

getInt(Int32)

Get integer value from column

Declaration
public int getInt(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.Int32
Examples
lxapi.Tuple tableTuple = scan.next();
Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getInt(inx));

getLong(Int32)

Get long value from column

Declaration
public long getLong(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.Int64
Examples
lxapi.Tuple tableTuple = scan.next();
Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getLong(inx));

getShort(Int32)

Get short value from column

Declaration
public short getShort(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.Int16
Examples
lxapi.Tuple tableTuple = scan.next();
Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getShort(inx));

getString(Int32)

Get string value from column

Declaration
public string getString(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.String
Examples
lxapi.Tuple tableTuple = scan.next();
Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getString(inx));

isIgnore(Int32)

Check if column is to be ignore

Declaration
public bool isIgnore(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.Boolean

true when ignore

Examples
lxapi.Tuple tableTuple = scan.next();
if (!tableTuple.isNull(inx)  &&  !tableTuple.isIgnore(inx))
{
       Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getString(inx));
}
scan.end();

isNull(Int32)

Check if column is numm

Declaration
public bool isNull(int fno)
Parameters
Type Name Description
System.Int32 fno

column position

Returns
Type Description
System.Boolean

true when null

Examples
lxapi.Tuple tableTuple = scan.next();
if (!tableTuple.isNull(inx)  &&  !tableTuple.isIgnore(inx))
{
       Console.WriteLine("Field #{0} -> {1}", inx, tableTuple.getString(inx));
}
scan.end();

numOfColumns()

Number of Tuple's columns

Declaration
public int numOfColumns()
Returns
Type Description
System.Int32

number of columns

Implements

System.IDisposable
Back to top Generated by DocFX