Defining automatic joins

Answered

Comments

3 comments

  • Official comment
    Avatar
    Sergey Smagin (Product manager)

    Hello, Chris.

    If foreign keys are defined in your MySQL database, setting the right syntax provider (MySQLSyntaxProvider) will let Active Query Builder load them automatically. If they aren't defined, you can define them programmatically or using the Metadata Container editor tool: download it (for VCL and Java editions, for .NET edition), run, and load metadata from your database. There you'll be able to create realtions between database objects and save the content to XML file. After that you shouldn't load metadata from your database, but from that XML file.

    I can't point you to the right article in our knowledge base describing this functionality because you didn't tell me about what edition of Active Query Builder you are asking.

    Comment actions Permalink
  • Avatar
    chris

    Thanks a lot - it works fine using XML metadata.


    One more question:

    Is it possible to predefine some conditions in the metadata? (e.g. always append "WHERE deleted = 0" to my SQL-result)


    0
    Comment actions Permalink
  • Avatar
    Sergey Smagin (Product manager)

    Hello, Chris.

    Please create new threads for new questions. This way you'll probably get answers faster.

    You can add conditions to your queries programmatically in several ways. The first way is to modify the query by API right in the QueryBuilder. This way the user will see this change in the Visual Query Builder. This way is illustrated in the Query Modification demo project.

    The second way is to use the QueryTransformer API. Changes made to the Query Transformer aren't shown to end-users, as the source query is not changed. Yo'll be able to get the changed SQL text via the QueryTransformer.SQL property. Read more about the Query Transformer in this article: How to change sorting, add filters, limits and aggregations to the query?

    0
    Comment actions Permalink

Please sign in to leave a comment.