added update sql for observation page

This commit is contained in:
Wappler 2025-01-10 00:48:56 -06:00
parent eabe6b7b3b
commit 9fcd9bf2dd
3 changed files with 155 additions and 24 deletions

View File

@ -10,6 +10,36 @@
"direct": true, "direct": true,
"schema": { "schema": {
"tables": { "tables": {
"da_metaData": {
"db": {}
},
"da_meta": {
"columns": {
"id": {
"db": {
"type": "increments",
"primary": true,
"nullable": false
}
},
"da_id": {
"db": {
"type": "integer",
"primary": false,
"nullable": true
}
},
"obj_dataStore": {
"db": {
"type": "text",
"maxLength": 65535,
"primary": false,
"nullable": true
}
}
},
"db": {}
},
"da": { "da": {
"columns": { "columns": {
"id": { "id": {
@ -74,30 +104,6 @@
"primary": false, "primary": false,
"nullable": true "nullable": true
} }
}
},
"db": {
"engine": "InnoDB",
"schema": "db_training",
"collation": "utf8mb4_unicode_ci",
"system_versioned": false
}
},
"da_meta": {
"columns": {
"id": {
"db": {
"type": "increments",
"primary": true,
"nullable": false
}
},
"da_id": {
"db": {
"type": "integer",
"primary": false,
"nullable": true
}
}, },
"obj_dataStore": { "obj_dataStore": {
"db": { "db": {

View File

@ -0,0 +1,51 @@
{
"meta": {
"$_GET": [
{
"type": "number",
"name": "da_id"
},
{
"type": "object",
"name": "obj_datastore"
},
{
"type": "number",
"name": "id"
}
]
},
"exec": {
"steps": {
"name": "MyUpsert",
"module": "dbupdater",
"action": "custom",
"options": {
"connection": "MyDB",
"sql": {
"query": "INSERT INTO `da_meta` (`id`, `da_id`, `obj_dataStore`) \nVALUES (?, ?, ?) \nON DUPLICATE KEY UPDATE \n`obj_dataStore` = VALUES(`obj_dataStore`), \n`da_id` = VALUES(`da_id`);\n\n",
"params": [
{
"name": ":P1",
"value": "{{$_GET.id}}",
"recid": 1
},
{
"name": ":P2",
"value": "{{$_GET.da_id}}",
"recid": 2
},
{
"name": ":P3",
"value": "{{$_GET.obj_datastore}}",
"recid": 3
}
]
}
},
"output": true,
"meta": [],
"outputType": "array"
}
}
}

View File

@ -0,0 +1,74 @@
{
"meta": {
"$_POST": [
{
"type": "text",
"name": "obj_dataStore"
},
{
"type": "number",
"name": "id"
}
]
},
"exec": {
"steps": {
"name": "MyRecordUpdate",
"module": "dbupdater",
"action": "update",
"options": {
"connection": "MyDB",
"sql": {
"type": "update",
"values": [
{
"table": "da",
"column": "obj_dataStore",
"type": "text",
"value": "{{$_POST.obj_dataStore}}"
}
],
"table": "da",
"wheres": {
"condition": "AND",
"rules": [
{
"id": "id",
"type": "double",
"operator": "equal",
"value": "{{$_POST.id}}",
"data": {
"column": "id"
},
"operation": "="
}
]
},
"returning": "id",
"query": "update `da` set `obj_dataStore` = ? where `id` = ?",
"params": [
{
"name": ":P1",
"type": "expression",
"value": "{{$_POST.obj_dataStore}}",
"test": ""
},
{
"operator": "equal",
"type": "expression",
"name": ":P2",
"value": "{{$_POST.id}}",
"test": ""
}
]
}
},
"meta": [
{
"name": "affected",
"type": "number"
}
]
}
}
}