12prepare_update.mql 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. -- ============================================================
  2. -- Prepare Update 操作测试
  3. -- ============================================================
  4. -- 1. prepare update 基本操作
  5. update /test/aaa/test_prepare set p_int=? where p_name=?
  6. /**
  7. params(999, "prep_insert_001")
  8. **/
  9. ;
  10. select p_name, p_int from /test/aaa/test_prepare where p_name='prep_insert_001'
  11. /**
  12. output()
  13. **/
  14. ;
  15. -- 2. prepare update 多个 ?
  16. update /test/aaa/test_prepare set p_text=?, p_int=? where p_name=?
  17. /**
  18. params("updated by prepare update", 888, "prep_insert_002")
  19. **/
  20. ;
  21. select p_text, p_int from /test/aaa/test_prepare where p_name='prep_insert_002'
  22. /**
  23. output()
  24. **/
  25. ;
  26. -- 3. prepare update float
  27. update /test/aaa/test_prepare set p_float=?, p_double=? where p_name=?
  28. /**
  29. params(99.99, 999.999999, "prep_insert_001")
  30. **/
  31. ;
  32. select p_float, p_double from /test/aaa/test_prepare where p_name='prep_insert_001'
  33. /**
  34. output()
  35. **/
  36. ;
  37. -- 4. prepare update 不存在的记录
  38. update /test/aaa/test_prepare set p_int=? where p_name=?
  39. /**
  40. params(1, "non_exist_prepare_key")
  41. **/
  42. ;
  43. select * from /test/aaa/test_prepare where p_name='non_exist_prepare_key'
  44. /**
  45. output()
  46. count(0)
  47. **/
  48. ;