[go: up one dir, main page]

Menu

#135 Get to know DataBase references' connections

None
closed
nobody
None
1
2020-08-25
2020-08-18
No

Hi,

I am creating a dia2sql program in python:
https://github.com/SanPen/dia2sql/blob/master/dia2sql.py

So far, the only thing left to have a fully functional program is to properly detect the atributes of the tables that a reference entry is using.

The reference object has inside a property called "connections" with a list of objects with 3 properties:

  • handle: 0 or 1 to indicate the from / to
  • to: Referenced table ID
  • connection: ??, it is a number but I have not made sense of it yet.

My question is:

How does DIA interprete a schematic Reference so that it connects to the proper item graphically?

this would help me understand which attributes are beign connected.

*See attached a very simple diagram

Best regards,
Santiago

1 Attachments

Discussion

  • Zander Brown

    Zander Brown - 2020-08-18
      <dia:connections>
        <dia:connection handle="0" to="O0" connection="13"/>
        <dia:connection handle="1" to="O1" connection="14"/>
      </dia:connections>
    
    attr desc
    handle which handle (so in this case end) we are connecting from
    to object connected to
    connection which connection point on to
    <dia:connection handle="0" to="O0" connection="13"/>
    

    objects["02"].handles[0] --> objects["O3"].connections[13]

     

    Last edit: Zander Brown 2020-08-18
  • Santiago Peñate Vera

    Thanks a lot!

    Can we assume that the connections are numbered always like that?

     
    • Zander Brown

      Zander Brown - 2020-08-24

      Since I try hard to ensure newer Dia can open files from older Dia yes it's a safe assumption that the numbering of connections for a given version of a given object type will remain the same - if they don't it's a bug

      Hope that helps with your script

       
  • Ben Centin

    Ben Centin - 2020-08-25

    Zander, thank you for trying hard to ensure backwards compatibility. Some of these ".dia" files are filed away and then pulled out years later when an enhancement is needed. I don't even know what version originally created them. I noticed one had a reference to xmlns:dia and http://www.lysator.liu.se/~alla/dia/ but that site doesn't exist anymore. I tried to look at the "DummyDB.dia" file here, and it looks like binary. but the ".dia" filie I have is XML. I don't understand.

     
  • Zander Brown

    Zander Brown - 2020-08-25

    You probably saved the file with compression on

    $ mv DummyDB.dia DummyDB.dia.gz
    $ gunzip DummyDB.dia
    $ head DummyDB.dia 
    <?xml version="1.0" encoding="UTF-8"?>
    <dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
      <dia:diagramdata>
        <dia:attribute name="background">
          <dia:color val="#ffffff"/>
        </dia:attribute>
        <dia:attribute name="pagebreak">
          <dia:color val="#000099"/>
        </dia:attribute>
        <dia:attribute name="paper">
    

    And yup, http://www.lysator.liu.se/~alla/dia/ is long dead, of course changing that url potentially breaks something somewhere so we are stuck with it

     
  • Zander Brown

    Zander Brown - 2020-08-25
    • status: open --> closed
    • Group: -->
     

Log in to post a comment.