Vector.sql 689 B

1234567891011121314151617181920212223
  1. /* syntax version 1 */
  2. $typing = TupleType(VoidType(), VoidType(), String);
  3. $vectorCreate = YQL::Udf(AsAtom("Vector.Create"), Void(), $typing);
  4. $vectorEmplace = YQL::Udf(AsAtom("Vector.Emplace"), Void(), $typing);
  5. $vectorSwap = YQL::Udf(AsAtom("Vector.Swap"), Void(), $typing);
  6. $vectorGetResult = YQL::Udf(AsAtom("Vector.GetResult"), Void(), $typing);
  7. $a = $vectorCreate(0);
  8. $a = $vectorEmplace($a, 0, "test1");
  9. $a = $vectorEmplace($a, 1, "test2");
  10. $a = $vectorEmplace($a, 2, "test3");
  11. $state1 = $vectorGetResult($a);
  12. $a = $vectorEmplace($a, 1, "test22");
  13. $state2 = $vectorGetResult($a);
  14. $a = $vectorSwap($a, 0, 2);
  15. $state3 = $vectorGetResult($a);
  16. SELECT $state1, $state2, $state3;