blog_20131228_1_686447 22行 SQL
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
SELECT CURDATE(),CURTIME(),MONTH(birthday) AS month_ FROM t_mysqlFunTest;

SELECT userName,UPPER(userName) AS '全部大写',LOWER(userName) AS '全部小写',CHAR_LENGTH(userName) AS '字符长度' FROM t_mysqlFunTest;



SELECT num,ABS(num) AS '绝对值' FROM t_mysqlFunTest;

SELECT SQRT(4) AS '开方',MOD(9,4) AS '求余' FROM t_mysqlFunTest;



INSERT INTO t_mysqlFunTest VALUES(NULL,'2013-1-1','Zhongshu.Qian',1,PASSWORD('123456'));

INSERT INTO t_mysqlFunTest VALUES(NULL,'2013-1-1','Zhongshu.Qian',1,MD5('123456'));

INSERT INTO t_mysqlFunTest VALUES(NULL,'2013-1-1','Zhongshu.Qian',1,MD5('123456'),ENCODE('abcd','aa'));


SELECT pp FROM t_mysqlFunTest WHERE id=5;

SELECT DECODE(pp,'aa') FROM t_mysqlFunTest WHERE id=5;
blog_20140105_2_8713604 101行 html/xml
Raw
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
<span style="font-family:SimSun;"><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hongbo.easyweb</groupId>
<artifactId>llms</artifactId>
<packaging>war</packaging>
<name>llms</name>
<version>1.0.0-SNAPSHOT</version>

<properties>
<spring.version>3.1.1.RELEASE</spring.version>
<struts.version>2.3.4</struts.version>
<hibernate.version>3.6.9.Final</hibernate.version>
<axis2.version>1.6.2</axis2.version>
<mysql.version>5.1.9</mysql.version>
<aspectj.version>1.6.9</aspectj.version>
<slf4j.version>1.6.4</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<!--TODO 一个项目所依赖的全部Jar文件信息定义描述-->
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>

<!--TODO 针对一个项目的编译环节-->
<build>
<!--TODO finalName 属性是你项目的名字-->
<finalName>llms</finalName>
<plugins>

<!--TODO 编译操作的定义-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>

<!-- TODO Maven的打包部署与Debug行为描述-->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration> <!-- 有这个定义,则你调试的时候不会进入target目录下,你就不用总去重启服务,尤其在页面调试的时候很方便 -->
<webappDirectory>${basedir}/src/main/webapp</webappDirectory>
<warSourceDirectory>${basedir}/src/main/webapp</warSourceDirectory>
</configuration>
</plugin>

<!-- TODO 这是个毛操作, 查查-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>

<!--Maven Clean 操作-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>${basedir}/src/main/webapp/WEB-INF/</directory>
<excludes> <!--排除哪些内容不被清除-->
<excluse>**/web.xml</excluse>
</excludes>
</fileset>
</filesets>
</configuration>
</plugin>

</plugins>
</build>
</project></span>
blog_20140111_2_2291655 31行 SQL
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
DELIMITER &&
CREATE PROCEDURE Clear_DB(IN DB_NAME VARCHAR(32),IN Engine_type VARCHAR(16)) # 数据库名称 引擎类型
BEGIN
DECLARE done INT DEFAULT 0; # 游标的标志位
DECLARE TB_NAME VARCHAR(64); # 数据库的表名
DECLARE COMMAND VARCHAR(64); # 更改数据库引擎的命令
DECLARE cur1 CURSOR FOR SELECT table_name FROM information_schema.TABLES WHERE table_schema=DB_NAME ;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; #错误定义,标记循环结束
OPEN cur1;
REPEAT # 循环开始
FETCH cur1 INTO TB_NAME;
IF NOT done THEN
SET COMMAND=CONCAT('ALTER TABLE ',DB_NAME,'.',TB_NAME,' ENGINE = ',Engine_type); # 拼更改引擎的命令 ALTER TABLE test_3 ENGINE = MYISAM ;
SET @E=COMMAND;
PREPARE stmt1 FROM @E;
EXECUTE stmt1; # 执行命令
DEALLOCATE PREPARE stmt1; # 释放对象 deallocate prepare
END IF;
UNTIL done END REPEAT; # 循环结束
CLOSE cur1; #关闭游标
END;
&&
DELIMITER ;


CALL Clear_DB('testaaa','MYISAM');

CALL Clear_DB('testaaa','InnoDB');


SELECT table_name,ENGINE FROM information_schema.TABLES WHERE table_schema='testaaa' ;
blog_20140111_2_1903196 31行 SQL
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
DELIMITER &&
CREATE PROCEDURE changeEngineType(IN DB_NAME VARCHAR(32),IN Engine_type VARCHAR(16)) # 数据库名称 引擎类型
BEGIN
DECLARE done INT DEFAULT 0; # 游标的标志位
DECLARE TB_NAME VARCHAR(64); # 数据库的表名
DECLARE COMMAND VARCHAR(64); # 更改数据库引擎的命令
DECLARE cur1 CURSOR FOR SELECT table_name FROM information_schema.TABLES WHERE table_schema=DB_NAME ;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; #错误定义,标记循环结束
OPEN cur1;
REPEAT # 循环开始
FETCH cur1 INTO TB_NAME;
IF NOT done THEN
SET COMMAND=CONCAT('ALTER TABLE ',DB_NAME,'.',TB_NAME,' ENGINE = ',Engine_type); # 拼更改引擎的命令 ALTER TABLE test_3 ENGINE = MYISAM ;
SET @E=COMMAND;
PREPARE stmt1 FROM @E;
EXECUTE stmt1; # 执行命令
DEALLOCATE PREPARE stmt1; # 释放对象 deallocate prepare
END IF;
UNTIL done END REPEAT; # 循环结束
CLOSE cur1; #关闭游标
END;
&&
DELIMITER ;


CALL changeEngineType('testaaa','MYISAM');

CALL changeEngineType('testaaa','InnoDB');


SELECT table_name,ENGINE FROM information_schema.TABLES WHERE table_schema='testaaa' ;