07 2012 档案

摘要:case 语句带有选择效果知返回第一个条件满足要求的语句,即语句一语句二都的判断都为 true ,返回排在前面的。case 的语法根据放置的位置不同而不同。一.case 语句CASE SELECTOR WHEN EXPRESSION_1 THEN STATEMENT_1; [WHEN EXPRESSION_2 THEN STATEMENT_2;] [...] [ELSE STATEMENT_N+1 ;]END CASE;这个是一般语句,注意 在then 后面需要 ; 分号,而且结束的时候 是 END CASE ;CASE v_element WHEN xx T... 阅读全文
posted @ 2012-07-19 21:20 A_zhu 阅读(9917) 评论(0) 推荐(1)
摘要:commit想当前数据库提交commit,时:1.事务所做的所有工作都会永久化。2.其他用户可以看到这个事务所做的数据变更。3.该事务拥有的所有锁被释放。COMMIT [WORK];ROLLBACK1.该事务所做的所有工作都被撤销。2.事务拥有的锁被释放。ROLLBACK [WORK] [TO SAVEPOINT savepoint_name];SAVEPOINT这是保存点,返回到当前步。SAVEPOINT savepoint_name; 阅读全文
posted @ 2012-07-19 14:40 A_zhu 阅读(2187) 评论(0) 推荐(0)
摘要:c++ efficient 的第六章,看书笔记,顺便说下理解。对于一般直接 new 与delete 性能较差,可以自己管理写内存的申请与释放。版本0:class Rational{public: Rational(int a=0, int b =1 ): n(a),d(b){}private: int n; int d;};版本1: 专用的内存管理器这版本是通过重载 目标类 中的new 与delete 实现内存管理,只适用于目标类,但是速度是最快的。实现方式是维护一个链表,类中静态声明链表头,链表维护一串空间,通过类型转换在 目标类 和 链表指针 之间转换。如果内存不够(fr... 阅读全文
posted @ 2012-07-15 20:48 A_zhu 阅读(2241) 评论(0) 推荐(0)
摘要:说个题外话#include <iostream>using namespace std;class A{public: char a; char b; char c;public: A(char aa, char bb=97, char cc=97):a(aa),b(bb),c(cc){}};int main(){ A e=98; cout<<e.a<<e.b<<e.c<<endl; return 0;}对于 下面的 A e= 98; 是能够匹配到A的构造函数的,aa 需不需要默认值都可以,这样的声明会将 98 赋予第一个 参数,即a 阅读全文
posted @ 2012-07-14 15:47 A_zhu 阅读(768) 评论(0) 推荐(0)
摘要:返回值优化,是一种属于编译器的技术,它通过转换源代码和对象的创建来加快源代码的执行速度。RVO = return value optimization。class Complex//复数{ friendd Complex operator + (const Complex & , const Complex&);public: Conplex(double r=0.0,double i= 0.0): real(r),imag(i){} Complex(const Complex& a):real(a.real),imag(a.imag){}; Complex opera 阅读全文
posted @ 2012-07-14 14:49 A_zhu 阅读(3422) 评论(2) 推荐(1)
摘要:再看 efficient c++, 写一下笔记。这是写第一章:跟踪实例。主要讲一个类,用于跟中,有一个公共变量控制是否需要跟踪,跟踪什么这个看个人要求,通过怎么实现跟踪类能够达到消耗最低。//初始版本class Trace{public: Trace(const string &name); ~Trace(); void debug(const string &msg); static bool traceIsActive;private: string theFunctionName;};inlineTrace::Trace(const string &name... 阅读全文
posted @ 2012-07-14 14:20 A_zhu 阅读(477) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include #include using namespace std;int fun1(int value){ return value*2;}int fun2(int value1,int val... 阅读全文
posted @ 2012-07-11 15:45 A_zhu 阅读(2391) 评论(0) 推荐(0)
摘要:字符串输入输出流,istringstream、ostringstream,可以将输入或输出变成一个string,多次读写或多次输出。 也可以通过这两个实现变量类型的转换,如int 型数据输出到ss(stringstream),然后读取到string 中。#include <iostream>#include <sstream>#include <windows.h>using namespace std;int main(){ string buf; getline(cin,buf);/* 这个可以结合一下语句在处理文件读取时使用,先读整行,然后像cin处理 阅读全文
posted @ 2012-07-11 15:43 A_zhu 阅读(3018) 评论(0) 推荐(0)
摘要:#include<iostream>using namespace std;template<class T>struct Unit{ public: Unit * next; T value;};template<class T>class MyLink{public: class LinkIterator { private: Unit<T> * init; public: LinkIterator(Unit<T> * init) { this->init=init; ... 阅读全文
posted @ 2012-07-11 15:42 A_zhu 阅读(2807) 评论(0) 推荐(0)