Guest User

Untitled

a guest
Apr 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import sys
  2. from rocketdb.storage import Storage
  3.  
  4. m = Storage()
  5.  
  6. if sys.argv[1] == "add":
  7.  
  8. m.create_db("blog")
  9. m.create_table("posts")
  10. m.insert("topic","hello world 1!")
  11. m.insert("topic","hello world 2!")
  12. m.insert("topic","hello world 3!")
  13. m._save()
  14.  
  15. else:
  16.  
  17. m.select_db("blog")
  18. m.use_table("posts")
  19.  
  20. print "Inspect:"
  21. print m.inspect()
  22.  
  23. print "select by id:"
  24. print m.select_by_id(0)
  25.  
  26. print "match key by id:"
  27. print m.match_key_by_id(1,"topic")
  28.  
  29. print "match all by key:"
  30. print m.match_all_by_key("topic")
Add Comment
Please, Sign In to add comment