[fdo-users] Sqlite and AutoGenerated

Bruno Scott bscott at geomapgis.com
Fri Feb 22 08:50:22 PST 2013


Hi All
I'm trying to figure out how FDO is determining if a column is AutoGenerated
or Not

Looking in the Code we find this first step

                // if is PK and has NOT NULL constraint then the column is
not autogenerated
                if (i == pTable->iPKey && pTable->aCol[i].isPrimKey)
                    dpd->SetIsAutoGenerated(!pTable->aCol[i].notNull);
                else
                    dpd->SetIsAutoGenerated(false);

I don't understand the relation between NotNull and AutoGenerated

Next we find a second step
                        // in case we have a PK and we have a trigger
property could be autogenerated
                        // we can "detect" that only when we have FDO
metadata
                        if (!dpd->GetIsAutoGenerated() && pTable->pTrigger
!= NULL &&
                            (dt == FdoDataType_Int16 || dt ==
FdoDataType_Int32 || dt == FdoDataType_Int64))
                        {
                            if (dpd->GetReadOnly() && propMarkedAsReadOnly)
                                dpd->SetIsAutoGenerated(true);
                            else
                                dpd->SetIsAutoGenerated(dpd->GetReadOnly());
                        }

A primaryKey that is ReadOnly must be set by something, this is alright for
me
But there is a also a test on a trigger. Any trigger(update,insert,delete)
on any field.
this test is a little week.

In my test case a have a table with a primaryKey set as not null and with
the autoincrement flag.
And it never return the AutoGenerated flag to true.

Bruno Scott




--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Sqlite-and-AutoGenerated-tp5036198.html
Sent from the FDO Users mailing list archive at Nabble.com.


More information about the fdo-users mailing list