dint-dev/database

Wrong columns order (SQLite). Problem with access a column by index.

Closed this issue · 1 comments

I have a table

CREATE TABLE [tb_inventory] (
	[uuid] BLOB(16) NOT NULL,
	[title] VARCHAR(1024) NOT NULL,
	[parent_inventory_uuid] BLOB(16) NULL,
	[date_unix_created_at] INTEGER NOT NULL,
	[date_unix_deleted_at] INTEGER NULL,
	PRIMARY KEY ([uuid]),
	FOREIGN KEY ([parent_inventory_uuid]) REFERENCES [tb_inventory] ([uuid])
)

My query

var iterator = await sqlClient
    .query("SELECT [uuid], [title], [parent_inventory_uuid], [date_unix_created_at], [date_unix_deleted_at] FROM [tb_inventory]")
    .getIterator();
print(iterator.columnDescriptions);
// expected output: [uuid, title, parent_inventory_uuid, date_unix_created_at, date_unix_deleted_at]
// actual output  : [date_unix_created_at, date_unix_deleted_at, parent_inventory_uuid, title, uuid]

Looks like names are sorted.

My intension is: Use toRows() and access data by index.

dependencies:
  flutter:
    sdk: flutter
  database: ^0.3.3
  database_adapter_sqlite: ^0.1.0

I close this because we are seeking a simpler, better design for the API and it will take some time before the package is ready for the public.