2 using System.Threading.Tasks;
12 [Trait(
"Category",
"Integration")]
13 [Trait(
"Category",
"Async")]
19 using var ctx =
new TestContext(
"async_bool_stored");
20 var tableName = ctx.QualifiedTable(
"bool_type_test");
23 await ctx.Kinetica.ExecuteSqlAsync($
"CREATE TABLE {tableName} (id INT, active BOOLEAN, PRIMARY KEY(id))");
24 await ctx.Kinetica.ExecuteSqlAsync($
"INSERT INTO {tableName} VALUES (1, TRUE), (2, FALSE)");
27 var response = await ctx.Kinetica.ExecuteSqlAsync($
"SELECT * FROM {tableName} ORDER BY id");
30 Assert.Equal(2, response.total_number_of_records);
31 Assert.Equal(2, response.data.Count);
34 var record1 = response.data[0];
35 Assert.True(record1.TryGetValue(
"id", out var id1));
36 Assert.True(record1.TryGetValue(
"active", out var active1));
39 Assert.Equal(1, Convert.ToInt32(id1));
40 Assert.Equal(1, Convert.ToInt32(active1));
41 Assert.True(Convert.ToBoolean(active1));
44 var record2 = response.data[1];
45 Assert.True(record2.TryGetValue(
"id", out var id2));
46 Assert.True(record2.TryGetValue(
"active", out var active2));
48 Assert.Equal(2, Convert.ToInt32(id2));
49 Assert.Equal(0, Convert.ToInt32(active2));
50 Assert.False(Convert.ToBoolean(active2));
56 using var ctx =
new TestContext(
"async_bool_typeinfo");
57 var tableName = ctx.QualifiedTable(
"bool_type_test");
60 await ctx.Kinetica.ExecuteSqlAsync($
"CREATE TABLE {tableName} (id INT, active BOOLEAN, PRIMARY KEY(id))");
67 foreach (var col
in ktype.getColumns())
69 if (col.getName() ==
"active")
76 Assert.NotNull(activeColumn);
async Task Boolean_TypeInfo_ShowsIntWithBooleanPropertyAsync()
const string BOOLEAN
This property provides optimized memory and query performance for int columns.
Test context that manages schema and cleanup for integration tests.
Column properties used for Kinetica types.
Async tests for boolean type handling in Kinetica.
async Task Boolean_StoredAsInteger_ReadsCorrectlyAsync()
static KineticaType fromTable(Kinetica kinetica, string tableName)
Create a KineticaType object based on an existing table in the database.
IList< string > getProperties()
Returns the properties for the column.