iBatis 3.x ¶¯Ì¬SQLÔªËØÖ®ÊµÏÖ
ÔÚiBatis 2.xÖУ¬¿ÉÒÔʹÓÃ$xxxx$Óï·¨ÔÚSQLÖж¨Òå¿É¶¯Ì¬²åÈëµÄSQLÔªËØ¡£¶øÔÚiBatis 3.xÖÐÒѾ·¢ÉúÁ˺ܴó±ä»¯¡£
Ê×ÏÈ£¬Óï·¨±äΪ ${xxxx} ÐÎʽ£»
Æäʵ£¬ÄãҪʹÓõÄSQLÔªËØ±ØÐëÊÇÒ»¸öJava BeanµÄÊôÐÔ£¬Ò²ËµÊÇÊäÈë²ÎÊý±ØÐëΪJava Bean£»ÔÚ˵Ã÷ÎĵµÖÐҲûÓÐ˵Ã÷ÈçºÎÖ±½ÓʹÓÃÒ»¸öStringÀàÐ͵ÄÊäÈë²ÎÊý¡£
ÓÚÊÇ£¬ÎÒÓÃDEBUG·ÖÎöÁËiBatis 3.xµÄ´úÂ룬·¢ÏÖ»¹ÊÇÓа취ʹÓõ¥¸öStringÀàÐ͵ÄÊäÈë²ÎÊý£¬µ«ÊÇÄãµÄ¶¯Ì¬SQLÔªËØ±ØÐ붨ÒåΪ${_parameter}¡£±ÈÈ磺
<select id="getRecordCount" parameterType="string" resultType="int">
select count(*) as recordNumber from (${_parameter}) t1
</select>
×¢£ºÉÏÃæµÄ${_parameter}²»¿ÉÐÞ¸ÄΪÆäËüÎÄ×Ö
Ïà¹ØÎĵµ£º
ÔÚ³ÌÐòÖÐÓÐЩ²éѯÓï¾äÏà¶Ô½Ï³¤£¬¿ÉÒÔ½«Óï¾äµ¥¶ÀдÔÚÒ»¸öXXX.sqlÎļþÖУ¬ÔÚ³ÌÐòÖжÁÈ¡SQLÎļþ
¾ßÌåÉæ¼°µ½
import java.io.File;
import org.apache.commons.io.FileUtils;
import java.net.URL;
URL resourceUrl = XXXX.class.getClassLoader().getResource(SQL_PATH+sqlName);//SQL_PATH¾ßÌåSQLÎļþ´æÔÚ·¾¶£¬sqlName¼ ......
Ó¦Ò»¸öÅóÓѵÄÒªÇó£¬ÌùÉÏÊղصÄSQL³£Ó÷ÖÒ³µÄ°ì·¨¡«¡«
±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º
SELECT TOP Ò³¼Ç¼ÊýÁ¿ *
from ±íÃû
WHERE (ID NOT IN
(SELECT TOP (ÿҳÐÐÊý*(Ò³Êý-1)) ID
from ± ......
32
λµÄ²Ù×÷ϵͳֻÄÜÓÃ
4G
µÄÄڴ棨²»È·¶¨Õâ¾ä»°ÊÇ·ñÕýÈ·£©£¬ÒòΪ
2
µÄ
32
´Î·½ÊÇ
4G
¡£Ä¬ÈϵÄÇé¿öÏ£¬²Ù×÷ϵͳ¸ø×Ô¼ºÁôÁË
2G
£¬Ê£ÏµÄ
2G
¸øÓ¦ÓóÌÐò¡£ËùÒÔ£¬Ã¿¸öÓ¦ÓóÌÐòËùÄÜʹÓõÄÄڴ棬×î´ó²»³¬¹ý
2G
¡£¾Ý˵¿ÉÒÔ¸Ä
WINDOWS
µÄ
BOOT.INI
£¬Ç¿ÖƲÙ×÷ϵͳֻʹÓÃ
1G
£¬¼´Ê¹ÕâÑù£¬Ó¦ÓóÌÐòÒ²ÖÁ¶àÊÇ
......
SQL±¦µä
SQL±ØÖª±Ø»áµÚÈý°æ
SQLÈëÞµäµÚËİæ
Sams Teach Yourself SQL in 10 Minutes Third Edition
SQL The Complete Reference
......
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä:
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-nam ......