Custom form data generation

Source: Internet
Author: User

Information is divided into three types: data sources, controls, and binding information.
{XX} indicates the part to be replaced by the actual value.
Data source: Use hidden, name = DS $ {ID }$ {updatable}, value = {SQL }$ {keys} $ ~ {Kv1}, {kv2 },...~ {Kv3}, {kv4}
Controls: Name = {ID}, value = {value}
Additional properties of the control: name = pro $ {controlid}, value = {p1 $ P2 $ P3}
Binding information: generate one for each bound control. Use hidden, name = dB $ {controlid }$ {Ind }$ {DS}, value = {DF }$ {datatype}
DS $ is the fixed start of the data source ID, and DB $ is the fixed start of the bound ID, used for identification.
{ID} indicates the id value of the control, {SQL} indicates the SQL value of the data source, {keys} indicates the keys value of the data source, and {kvx} indicates the data of the corresponding key.
{Value} indicates the value of the control.
{Controlid} indicates the ID of the control corresponding to the binding information, {DS} indicates the corresponding data source, {DF} indicates the corresponding data field, and {Ind} indicates the corresponding row index, {datatype} indicates the Data Type of the corresponding field.

 

processing when saving:
1. request. the data in form is divided into three hashtable, and the key and value whose name starts with "ds $" and ends with "$1, htdatabind stores the key and value whose name starts with "DB $", and htcontrol stores the remaining key and value.
2. process the SQL statements of each element in htdatasource and obtain its tablename using regular expressions. Its keys and keysvalues are constructed by using the key of htdatasource as the key, tablename and (keys, keysvalues structure array, generate a hashtable named httable.
3. process each element of the httable Elea:
3.1 pair of Elea. key, and the {DS} in the search value is Elea. eleb. DF and eleb. IND ; according to eleb. the {controlid} of the key obtains the elec element in the htcontrol and obtains the Elec. value.
3.2 If eleb. IND> Elea. value. keysvalues. count, the insert statement is generated: Combine all eleb. DF and Elec. value, plus Elea. tablename generates insert; otherwise, an update statement is generated to combine all eleb. DF and Elec. value generation set clause, elec. keys and elec. keysvalues (IND) generates the WHERE clause, plus Elea. tablename generates update XXX set XXX Where xxx.

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.