$createnames and SQLite

Doug Easterbrook doug at artsman.com
Thu May 8 19:07:07 UTC 2025


hi andrew.

I defined a list from a table class (which is based on a schema or query class) as below… and I seem to seem to have found the nulls setting and the type of field it is.

I cannot tell you if it will provide the primary kay or not.    I would think that is outside the scope of schema’s and shou may need to use naming conventions to parse the code and inject whatever you need to set for primary key.

again, I’m using postgres, but I can’t see it being that much different for sql lite.  you should get, integer, varchar, text, numeric with precision — all settings that match the equivalent type in omnis.   I cut the returned list back a bit so that it shows examples of different date types.

It even tells me if a variable type is JSONB (the last one) — but then how did omnis know to make it a JSONB field since omnis does not support JSONB.





Do list.$definefromsqlclass('tF_CLIENT')
Do list.$createnames() Returns #S1

C_SEQ INTEGER NOT NULL,
C_LAST_NAME VARCHAR(30),
C_PROFILE_TYPE SMALLINT,
C_PASSPORT_DATE_EXPIRES DATE,
C_DATE_UPDATED TIMESTAMP,
C_HEIGHT NUMERIC(17,2),
C_DECEASED BOOLEAN,
C_MERGED_C_SEQ_LIST TEXT,
C_METADATA JSONB

It even tells me if a variable type is JSONB (the last one) — but then how did omnis know to make it a JSONB field since omnis does not support JSONB.
In $startup of our postgresDam object, we define custom types for certain variables we use, specific to postgres as below.

example, and omnis field declared as char 99999999 is really a JSONB field.     Does this really mean anything — not really .. . except that if you are using custom types in your sqllite database, then omnis will respect that in the $createnames

a useful feature since JSONB is not a native field type in omnis :)



Do iCustomFieldTypes.$define(iCustomFieldLength,iCustomFieldPostgresType)
Do iCustomFieldTypes.$add(99999999,'jsonb')
Do iCustomFieldTypes.$add(99999998,'tsvector')

For iCustomFieldTypes.$line from 1 to iCustomFieldTypes.$linecount
Do $cinst.$addcustomtype(iCustomFieldTypes.iCustomFieldLength,iCustomFieldTypes.iCustomFieldPostgresType) Returns #F
End For

Doug Easterbrook
doug at artsman.com
Phone (403) 650-1978

> On May 8, 2025, at 11:20 AM, Andrew Stolarz <stolarz at gmail.com> wrote:
> 
> Hello,
> 
> When I use $createnames, it returns the column name and Data type from the
> schema class.
> 
> How do I also include the Data subtype, Primary key and No nulls info that
> is defined in the schema class?
> 
> 
> Andrew
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com



More information about the omnisdev-en mailing list