[Code sea shell TC] Use View to define dynamic Class, sea shell tc

Source: Internet
Author: User

[Code sea shell TC] Use View to define dynamic Class, sea shell tc
Preface

In TC,

Persistent Class corresponds to Table.

Define a Persistent Class. updatedb generates the corresponding table.

In the development environment of TC, a corresponding username will generate a table under this username

In the formal environment, because adm, su, and key are used, the corresponding table will be generated under these three usernames.

The specific table in which the data is stored depends on where the Class definition inherits (if it inherits from admin, it is stored under the username corresponding to admin)

Then use QueryDbObject to query the Class.

You can set a Scope parameter during query.

SC _SCOPE_OF_SESSION -- query in the table corresponding to the current user (basically su)
SC _SCOPE_WHERE_NECESSARY -- query in the table corresponding to all users


In addition to the QueryDbobject method, TC also provides the QueryDbView method to Query data in the View.

This View does not need to correspond to a Persistent Class, but a View.

So, how can this development be done? What should I pay attention?


Query View

1. First, define the db view

CREATE OR REPLACE FORCE VIEW "VTEST" ASSELECT ATT AS ATT,                                                                                                                                                                                        '-' AS CreationDate , '-' AS CurDbName , '-' AS LastUpdate , '-' AS OBID , NULL AS Recycled , NULL AS SEIndexLanguageList , NULL AS ZBlob , 'VTEST' AS ClassFROM View SQL;

Here the ATT proxy needs to define an attribute
Note that, in addition to the attribute needed for processing the definition, you also need to define the attribute used by some systems.


2. Second, define a dynamic class

define dynamic class VTEST with parent PdmRoot;{     attach ATT;}

3. After definition, the View contains data. You can use QueryDbView to find data.


In the official environment,


1. If the SQL statement used to create a View is executed in all three databases, use the scope SC _SCOPE_WHERE_NECESSARY for query,

The data will be repeated (three pieces)

2. If the SQL statement used to create the View is executed only in the su db, use the scope SC _SCOPE_WHERE_NECESSARY to query, and the table cannot be found.


A good way is to create a view in the su db and use SC _SCOPE_OF_SESSION to query







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.