Can I Not Use @useObject to Modify Data Objects When Executing SQL Statements in Huawei Cloud Astro Zero Scripts?
Scenario
The method shown in the following figure is used when db.sql().execute() is executed in the script. That is, data objects are dynamically used.

For example, an error will be reported if you do not use @useObject(['User']) when using db.sql().execute("SELECT * FROM User"). Do not use @useObject(['User']) when using db.dynamicObject("User").
Solution
The dynamicObject method is used when the object table to be operated is unknown. For example, a value is assigned externally in the form of a parameter instead of a specific table name. The db.object method is used when the object table to be operated is determined. Therefore, @useObject needs to be used for declaration, as shown in the following figure.

Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot