• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Map 3D

    Reply
    Contributor
    jens.kuegl
    Posts: 18
    Registered: ‎07-25-2011
    Accepted Solution

    Change settings of a constraint in SQLite

    359 Views, 4 Replies
    01-11-2012 02:52 AM

    I am not able to change a constraint in SQLite:

    1. I created a schema  in SQLite witth AutoCAD Map 3D 2012.
    2. I set a constraint to one field: a list with 3 entries valid for the property. For example:
           Test 1
           Test 2
           Test 3
    3.    I draw some lines

    In the schema editor I want to change the constraint:
    -    But I am not able to add a new entry “Test 4” to the list from step 2
    -    I am also not able to change an existing entries (“test 1” to “test 1 new”)

    Is it possible to change the settings of a constraint?

    The help (http://docs.autodesk.com/MAP/2012/ENU/filesMUG/GUID-47B2AD48-11F7-45DA-9B11-979265C7FDA8.htm) says: “You cannot edit a schema to convert an existing field to use a different constraint type if the table already contains data. The table must be empty.”
    But I do not want to change the “constraint type”. I want to change the entries of the list.

    Thanks

    Jens

    Please use plain text.
    *Expert Elite*
    Posts: 6,460
    Registered: ‎06-29-2007

    Re: Change settings of a constraint in SQLite

    01-14-2012 09:40 AM in reply to: jens.kuegl

    Hi,

     

    at least the help is right, and also: I do understand your situations (it get's sometimes frustrating having data finalized and then have to add or modify some fields).

    What would I do:

    • First I would try to close Map3D or at least disconnect from the DB, modify some fields within the SQLite-database itself, then connect again to the DB.
    • If that does not help, by what reason ever, you can create a new scheme and then do a masscopy from your previous scheme to the new one.

     

    Good luck, - alfred -

    -------------------------------------------------------------------------
    Alfred NESWADBA
    Ingenieur Studio HOLLAUS ... www.hollaus.at
    -------------------------------------------------------------------------
    Please use plain text.
    Contributor
    jens.kuegl
    Posts: 18
    Registered: ‎07-25-2011

    Re: Change settings of a constraint in SQLite

    01-16-2012 01:08 AM in reply to: alfred.neswadba

    Alfred,

    thank you for your answer.

    Autodesk has now replied to me directly. Autodesk has also proposed to do an export/import.

    Your idea to modify the SQLite-database is good. But unfortunately this does not work:
    I've looked at how a “constraint in AutoCAD FDO schema” is implemented in SQLite. SQLite uses a SQL-constraint when a table is created:
    CREATE TABLE "testtable” … "testfield" TEXT CONSTRAINT CHK_Typ CHECK("testfield " IN(‘Test 1, Test 1, Test 1)) …

    Normaly I would drop the existing constraint, and add the new constraint:
    ALTER TABLE ... DROP CONSTRAINT CHK_Typ
    ALTER TABLE ... ADD CONSTRAINT CHK_Typ ...

    The problem is that SQLite does not support a CONSTRAINT option in the ALTER command (http://www.sqlite.org/omitted.html).

    In my opinion this is very great limitation of a geodatabase based on SQLite.

    Thanks for your help.

    Regards

    Jens

    Please use plain text.
    Product Support
    Posts: 88
    Registered: ‎04-25-2008

    Re: Change settings of a constraint in SQLite

    01-17-2012 11:19 AM in reply to: jens.kuegl

    I agree with Alfred - the new schema (possibly from an export/import of just the schema), then a bulkcopy is likely the easiest route, considering the SQLite limitations.



    Nate Moore, GISP
    Geospatial Premium Support Specialist
    Global Services
    Autodesk, Sarl
    Please use plain text.
    Contributor
    jens.kuegl
    Posts: 18
    Registered: ‎07-25-2011

    Re: Change settings of a constraint in SQLite

    01-18-2012 01:10 AM in reply to: NateMoore

    Thanks to Alfred and Nate. I will use their workarounds proposed (import/export/bulkcopy).

    Jens

    Please use plain text.