python
bitscn.comubuntu11.10安装mysql+handlersocket
http://www.cnblogs.com/aaronwxb/archive/2012/04/29/2475834.html
何为pyhs?简单来说,就是封装了接口,实现python以nosql方式连接mysql数据库,对数据库进行一些操作。
pyhs is a pure python client (with optional c speedups) for handlersocket plugin to mysql database. in short, it provides access to the data omitting the sql engine in a nosql-like interface. it allows all simple operations (get, insert, update, delete) over indexed data to perform considerably faster than by usual means.
安装方法:
http://packages.python.org/python-handler-socket/installation.html
简明教程:
http://packages.python.org/python-handler-socket/usage.html
进入主题,在update操作时,使用变量是没错的:
1 from pyhs import manager 2 3 attendant_id = '222' 4 newname = 'wxb' 5 newpwd = '123456' 6 7 hs = manager() 8 name = '2a' 9 10 data=hs.update('final','kf_attendant','=',['ad_id','ad_name','ad_password'],[attendant_id],[attendant_id,newname,newpwd],none,1,0,true)
但是进行insert操作时,直接使用变量名就一直出错“systemerror: null result without error in pyobject_call”,结果使用str()函数解决了~
1 from pyhs import manager 2 import uuid 3 4 hs = manager() 5 6 newid = uuid.uuid1() 7 newname = 'aaa' 8 newpwd = '123' 9 10 hs.insert('final','kf_attendant',[('ad_id',str(newid)),('ad_name',str(newname)),('ad_password',str(newpwd))])
bitscn.com