CRUD Operations
CloudBase provides multiple SDKs for developers to operate MySQL databases, including Mini Program SDK, JS SDK, Node SDK, etc.
| SDK Type | Applicable Platform |
|---|---|
| Mini Program ClientSDK | Mini Program |
| JS SDK | Web Browser |
| Node SDK | Node.js Environment |
| HTTP API | Universal |
After obtaining the db instance with Mini Program ClientSDK, the syntax for operating MySQL database is consistent with WebSDK. For specific syntax, please refer to JS SDK
Common Error Handling
xxx.rdb is not a function
Error Cause: The SDK version is too old and does not support MySQL database operations.
Solution: Update SDK to the latest version.
Generating default gateway base url failed: env not found
Error Cause: The WeChat base library version is too low and does not support CloudBase MySQL database functionality.
Solution: Update the WeChat base library to version 3.8.9 or above.
Set the minimum base library version in WeChat DevTools:
- Open "Project Details"
- In "Local Settings", set "Debug Base Library" to version 3.8.9 or higher
- In "Basic Information", set "Minimum Base Library Version" to version 3.8.9 or higher
After updating the base library version, please ensure compatibility handling for the Mini Program in lower versions of WeChat, or set the minimum version requirement in the Mini Program admin console.