12prepare_update.mql 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. match("p_int","999")
  14. **/
  15. ;
  16. -- 2. prepare update 多个 ?
  17. update /test/aaa/test_prepare set p_text=?, p_int=? where p_name=?
  18. /**
  19. params("updated by prepare update", 888, "prep_insert_002")
  20. **/
  21. ;
  22. select p_text, p_int from /test/aaa/test_prepare where p_name='prep_insert_002'
  23. /**
  24. output()
  25. match("p_int","888")
  26. **/
  27. ;
  28. -- 3. prepare update float
  29. update /test/aaa/test_prepare set p_float=?, p_double=? where p_name=?
  30. /**
  31. params(99.99, 999.999999, "prep_insert_001")
  32. **/
  33. ;
  34. select p_float, p_double from /test/aaa/test_prepare where p_name='prep_insert_001'
  35. /**
  36. output()
  37. match("p_float","99.99")
  38. **/
  39. ;
  40. -- 4. prepare update 不存在的记录
  41. update /test/aaa/test_prepare set p_int=? where p_name=?
  42. /**
  43. params(1, "non_exist_prepare_key")
  44. **/
  45. ;
  46. select * from /test/aaa/test_prepare where p_name='non_exist_prepare_key'
  47. /**
  48. output()
  49. count(0)
  50. **/
  51. ;