[Code Sea pick PUI TC] Use view to define dynamic class

Source: Internet
Author: User

Preface

In the TC,

Persistent Class and Table are the corresponding relationships.

Define a persistent class, and the corresponding table will be generated when updatedb.

In the TC development environment, a username is used. The corresponding will produce a table under this username.

In a formal environment, because the use of ADM, Su, can be key three username, so under these three username will generate the corresponding table.

The specific data stored in which table, see the definition of class is inherited from (if inherited from the admin, the nature is saved in the admin corresponding to the username)

The class is then queried using Querydbobject.

A scope parameter can be set at the time of query

Sc_scope_of_session--Query (basically SU) in the table of the current user
Sc_scope_where_necessary--Query in all user-corresponding table


In addition to the querydbobject approach, TC provides the Querydbview way to query the data in View.

This view does not need to correspond to a persistent class, but a view is available.

So, how does this development work? What kind of situation should we pay attention to?


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 ghost needs to define a attribute
It is important to note that, in addition to the attribute required to process the definition, it is necessary to define the attribute used by some systems


2. Next, define the dynamic class

Define dynamic class VTEST with parent pdmroot; {     attach ATT;}

3. After the definition, there is data in the View. You can use the Querydbview method to find the data.


In a formal environment,


1. If the SQL that created the view is executed in three db, use the SCOPE of sc_scope_where_necessary to query,

Data will be repeated (three strokes)

2. If the SQL that created the view is only executed in SU db, using the SCOPE of sc_scope_where_necessary to query, the table error will not be found.


So the good way is to create a view in SU db and query with Sc_scope_of_session







[Code Sea pick PUI TC] Use view to define dynamic class

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.