【问题标题】:dets example importing datadets 示例导入数据
【发布时间】:2012-04-08 22:02:47
【问题描述】:

dets:to_ets/2 有问题

谁能给我指一个网上的例子?我查看了手册页,但我看不到任何示例用法。在谷歌上找不到任何东西..

我的问题似乎出在实际的 dets:to_ets() 函数本身,而不是 dets 的创建。我自己测试过,没问题。

【问题讨论】:

    标签: ets dets


    【解决方案1】:

    您应该在使用 to_ets/2 函数之前创建 ETS 表。除非被覆盖,否则 Ets 表的现有对象将被保留。结果中是否有任何 {error, Reason} 元组?

    【讨论】:

      【解决方案2】:

      dets:to_ets/2 的简单示例。

      1> dets:open_file(d, [{file, "/tmp/d"}, {type, set}]).
      {ok,d}
      2> dets:insert(d, {a, 1}).
      ok
      3> dets:insert(d, {b, 2}).
      ok
      4> ets:new(e, [named_table, set]).
      e
      5> dets:to_ets(d, e).
      e
      6> ets:tab2list(e).
      [{b,2},{a,1}]
      

      【讨论】:

        猜你喜欢
        • 2017-07-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-09
        • 1970-01-01
        • 2016-08-17
        相关资源
        最近更新 更多