数据库的隔离级别和锁实现
事务的四大特性
原子性:事务的所有操作在数据库中要么全部正确反映出来,要么完全不反映。
一致性:隔离执行事务时(在没有其他事务并发执行的情况下)保持数据库的一致性。即并发执行的结果要与序列化执行的结果相同。
隔离性:尽管多个事务可能并发执行,但系统保证,对于任何事务TiTiT_i和TjTjT_j,在TiTiT_i看来,TjTjT_j或者在TiTiT_i开始执行之前已经完成执行,或者在TiTiT...
binary-tree-preorder-traversal(二叉树前序遍历)
题目描述
Given a binary tree, return the preorder traversal of its nodes’ values.
For example:Given binary tree{1,#,2,3},return[1,2,3].
Recursive solution is trivial, could you do it iteratively?
翻译:给定二...
binary-tree-postorder-traversal(二叉树后序遍历)
题目描述
Given a binary tree, return the postorder traversal of its nodes’ values.
For example:Given binary tree{1,#,2,3},return[3,2,1].
Note: Recursive solution is trivial, could you do it iteratively?...
reorder-list(重排链表)
问题描述
Given a singly linked list L: L 0→L 1→…→L n-1→L n
reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→…
You must do this in-place without altering the nodes’ values
For example,Given{1,2,3,4}, reorder ...
数据库基础知识汇总(一)
五个基本的关系代数操作
并、差、笛卡尔积、选择、投影
数据库语言四大类
DQL(Data Query Language):数据库查询语言。
DDL(Data Definition Language):数据库定义语言。定义关系模式、删除关系、修改关系模式。
关系、属性
DML(Data Manipulation Language):数据库操纵语言。插入元组、删除元组、修改元组。
元组...
数据库基础知识汇总(二)
视图
隐藏特定的数据
例如职员查看教师表时,不应看到工资。
虚关系:不需要预先存储执行结果。
执行select * from s where ⋯⋯\cdots会计算出查询结果并存储下来。
当底层元组改变,存储的结果将与现结果不匹配。
当定义一个视图时,数据库系统存储视图的定义本身,而非存储执行结果
但需要注意:用于定义视图的关系被修改,视图将过期。
定义视图
create vie...
重载、覆盖、隐藏的区别
重载
重载是指同名函数具有不同的参数表。
在同一访问区域内声明的几个具有不同参数列表(参数的类型、个数、顺序不同)的同名函数,程序会根据不同的参数列来确定具体调用哪个函数。
对于重载函数的调用,编译期间确定,是静态的,它们的地址在编译期间就绑定了。
重载不关心函数的返回值类型。
函数重载的特征
相同的范围(同一个类中)
函数名字相同
参数不同
virtual关键字可有可无。
实例
c...
sum-root-to-left-numbers
题目简述
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which represents the number123.Find the total ...
word-ladder
问题描述
Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:
Only one letter can be changed at a time
Each intermediate ...
加载驱动,为什么不用Class.forName 也可以达到预期的结果
获取一个数据库连接的通用模板如下:
String driver = "oracle.jdbc.OracleDriver"; String url = "jdbc:oracle:thin:@127.0.0.1:1521:orcl"; String user = "scott"; String password = "ticmy"; Class.forName(driver); Connectio...
java程序后台没有任何提示,就是在批量入库的时候程序执行失败了
对数据库主表数据进行操作时,发现能查询,但是update,for update都时提示正在执行中,没有任何反应,我怀疑是锁表了,抱着试试看的态度,我发现还真是。
行锁的表现:
锁定的数据不能插入,更新,删除,只能查询,语法 for update都不好使;
处理方法:
1、查看被锁的表
select a.object_id,a.session_id,b.object_name from v...
Timer用法及实例详解
在C#里现在有3个Timer类:
System.Windows.Forms.Timer
应用于WinForm中的,它是通过Windows消息机制实现的,类似于VB或Delphi中的Timer控件,内部使用API SetTimer实现的。它的主要缺点是计时不精确,而且必须有消息循环,Console Application(控制台应用程序)无法使用。
System
C# 退出程序再重新启动
///
/// 退出登录
///
public static void ReLoign()
{
Application.ExitThread();
Thread thtmp = new Thread(new ParameterizedThreadStart(Run));
C# URI编码详解
混乱的URI编码
JavaScript中编码有三种方法:escape、encodeURI、encodeURIComponent
C#中编码主要方法:HttpUtility.UrlEncode、Server.UrlEncode、Uri.EscapeUriString、Uri.EscapeDataString
JavaScript中的还好,只提供了三个,C#中主要用的就有这么多,还没
DateTimeHelper扩展类
public enum RoundTo
{
Second,
Minute,
Hour,
Day
}
public static class DateTimeHelper { public static string DefaultFormat; static DateTimeHelper() { DefaultFor
今日推荐
周排行