CREATEPROCEDURE modifyRootEntry() BEGIN DECLARE done INTDEFAULTFALSE; DECLARE userId INT; DECLARE userIdIter CURSORFORSELECTDISTINCT user_id from entries; OPEN userIdIter;
read_loop: LOOP FETCH userIdIter INTO userId; IF done THEN LEAVE read_loop; END IF; INSERTINTO entries (id, name, user_id, parent_id) VALUES(0, 'root_parent', userId, 0); UPDATE entries SET parent_id=0where user_id=userId AND name='file_root'AND parent_id isNULL; END LOOP;
CREATEPROCEDURE modifyRootEntry() BEGIN DECLARE done INTDEFAULTFALSE; DECLARE userId INT; DECLARE userIdIter CURSORFORSELECTDISTINCT user_id from entries; START TRANSACTION; // here ! OPEN userIdIter; read_loop: LOOP FETCH userIdIter INTO userId; IF done THEN LEAVE read_loop; END IF; INSERTINTO entries (id, name, user_id, parent_id) VALUES(0, 'root_parent', userId, 0); END LOOP; UPDATE entries SET parent_id=0where user_id=userId AND name='file_root'AND parent_id isNULL; // here! CLOSE userIdIter; COMMIT;// here ! END;
CREATEPROCEDURE pFastCreateNums (cnt INT UNSIGNED) BEGIN DECLARE s INT UNSIGNED DEFAULT1; TRUNCATETABLE Nums; INSERTINTO Nums SELECT s; WHILE s*2<= cnt DO BEGIN INSERTINTO Nums SELECT a+s FROM Nums; SET s = s*2; END; END WHILE; END;
2. 另外发现update的一个问题。如果使用事务, 首先select 数据然后再使用该数据进行update,有可能会有问题。一般使用 update [table] set col = col + value where …这种形式进行更新,比select col from [table]; 取到col然后再进行update [table] set col = 刚才select 出的col value + value; 这样更加正确,因为update自身可以加写锁。保证了不会幻读。
Starting with v1.4, pip will only install stable versions as specified by PEP426 by default. If a version cannot be parsed as a compliant PEP426 version then it is assumed to be a pre-release.
If a Requirement specifier includes a pre-release or development version (e.g. >=0.0.dev0) then pip will allow pre-release and development versions for that requirement. This does not include the != flag.
The pip install command also supports a –pre flag that will enable installing pre-releases and development releases.
总结:
SO, 这东西看起来很美,但是它只不过用一套更加复杂的密钥机制代替了人工可记忆的密钥。让我想到:技术宅永远都不可能改变世界。他们只不过给世界一个美好简单的假象。当你仔细观察假象的时候,却发现竟然是由复杂丑陋的拼图拼接而成。该死的技术宅们…请研究一套能够真正能够认证“人”的技术。即使记忆可以移植,即使DNA可以复制,即使指纹可以盗用,即使所有的一切都可以复制。但是只有一样只会随着人本身发生变化,那就是每一个人在其生活环境、经历、岁月中造就的思维模式。你可以copy 我的文字,但是你写这个主题,不可能和我一字不差。不过这种变化的认证估计在我能看到的未来都不可能实现…
<!-- the transactional advice (i.e. what 'happens'; see the <aop:advisor/> bean below) --> <tx:adviceid="txAdvice"transaction-manager="txManager"> <!-- the transactional semantics... --> <tx:attributes> <!-- all methods starting with 'get' are read-only --> <tx:methodname="get*"read-only="true" /> <!-- other methods use the default transaction settings (see below) --> <tx:methodname="*"rollback-for="java.lang.Exception" /> </tx:attributes> </tx:advice>
<!-- ensure that the above transactional advice runs for any execution of an operation defined by the Transcation bean interface --> <aop:config> <aop:pointcutid="transcationServiceOperation" expression="execution(* chillyc.info.dao.transactions.*.*(..))" /> <aop:advisoradvice-ref="txAdvice"pointcut-ref="transcationServiceOperation" /> </aop:config>
<!-- scan for mappers and let them be autowired --> <beanclass="org.mybatis.spring.mapper.MapperScannerConfigurer"> <propertyname="basePackage"value="chillyc.info.dao.orm.mapper" /> </bean>