Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

hibernateÖ´ÐÐÔ­ÉúSqlÓï¾äµÄ·½·¨£¨×ª£©

http://www.thecloud.cn/study/program/java/597.html
hibernate3µÄHQL ÊÇÃæÏò¶ÔÏóµÄÓï·¨,ÒѾ­Ö§³Ö update ,delete fromÓï¾ä,µ«
Ä¿Ç°»¹²»Ö§³Öinsert intoÓï¾ä.
×öÏîÄ¿ÓÐʱºòµÄÈ·ÐèҪдԭÉúµÄsqlÀ´·½±ãweb¿ª·¢.
ÏÂÃæÊÇÎÒ×Ô¼º¹Äµ·³öÀ´µÄ·½·¨,Ï£Íû¶ÔÎÒºÍÅóÓÑÓÐËù°ïÖú.
ÔÚDaoÀïдһ¸ö·½·¨,ÈÃÎÒÃÇÔÚactionÀïµ÷ÓÃËü...
 
public void InsertData(String MytblName,String
Mytitle,String Mycode,String Mycoments){
   
log.debug("insert into dataitems ---drs");
   //ʹÓÃÁËÔ­ÉúsqlÓï¾ä
    try{
   
//½«´«ÈëµÄÀàÃû´¦Àí³É±íÃû ÀýÈç:CTable----¡µC_Table 
   
MytblName = "C_"+MytblName.substring(1,MytblName.length());
    //²åÈë±í µÄ
sql
 
   
String Insert_SQL ="INSERT INTO "+MytblName+
    "
(C_Title,C_Code,C_Comments)"+
    " VALUES
('"+Mytitle+"','"+Mycode+"','"+Mycoments+"')" ;
   
//»ñµÃµ±Ç°sessionµÄÊý¾Ý¿âÁ¬½Ó
    Connection
CurConn   =
getSession().connection();
   
//System.out.println(Insert_SQL);
   
//Éú³ÉÒ»¸öStatement¶ÔÏó
   
PreparedStatement ps = CurConn.prepareStatement(Insert_SQL);
   
    //Ö´Ðвéѯ
   
ps.execute();
   
//¹Ø±Õ¸Ã¶ÔÏó
   
ps.close();
   
getSession().flush();
   
 
   
log.debug("insert into dataitems 
successful");
    }
    catch
(SQLException Re ){ // Òì³£
    
log.error("insert into dataitems failed", Re);
    
Re.printStackTrace();
    }
      
  }


Ïà¹ØÎĵµ£º

ÔÚsql*plusÏÂÉèÖÃautotrace

    ÎÒÃÇÔÚ¹¤×÷ÖÐÏ£ÍûÄÜ¿´¼û×Ô¼ºÔËÐеÄDMLÓï¾äµÄÔËÐб¨¸æ£¬ÀýÈçselect,delete,update,megreºÍinsertÓï¾äÔËÐкóµÄÇé¿ö£¬ÒÔÓÃÀ´¼àÊӺ͵÷ÓÅÓï¾ä¡£ÎÒÃÇͨ³£ÔÚsql*plusÖÐʹÓÃset autotrace on¿ªÆô¡£
    ÄÇautotraceÊÇÈçºÎ°²×°µÄÄØ£¿thomas kyteµÄ´ó×÷Öиø³öÁËÏêϸµÄ·½·¨ºÍ½âÊÍ£º
  & ......

ÅúÁ¿Æô¶¯¹Ø±ÕMS SQL 2005·þÎñBAT

µ±×°ÉÏÁËMSSQL2005ºó£¬ÄÚ´æµÄÕ¼Óûá±äµÃºÜ´ó¡£ËùÒÔÈç¹ûÓÃÒ»¸öÅúÁ¿´¦ÀíÀ´¿ªÆô»ò¹Ø±ÕMSSQL2005ËùÓеķþÎñ£¬Äǽ«»áÈÃÎÒÃǵĵçÄÔ¸üºÃʹÓ᣸ù¾Ý×Ô¼ºµÄ¾­Ñ飬×ö³öÁËÏÂÃæÁ½¸öÅú´¦Àí£º
       1¡¢¿ªÆô·þÎñ£º£¨¸´ÖƺáÏßµÄÄÚÈÝ£¬×¢Ò⣬·þÎñÆ÷ÕæÕýµÄÃû³ÆÄã¿ÉÒÔͨ¹ý“¿ªÊ¼--¡·¿Ø¼þÃæ°æ--¡·¹ÜÀí¹¤¾ ......

¡¾×ª¡¿ ÓÃEXPLAIN PLAN ·ÖÎöSQLÓï¾ä

ÓÃEXPLAIN PLAN ·ÖÎöSQLÓï¾ä
http://blog.csdn.net/kj021320/archive/2006/08/19/1096021.aspx
ÈçºÎÉú³Éexplain plan?
¡¡¡¡½â´ð:ÔËÐÐutlxplan.sql. ½¨Á¢plan ±í
¡¡¡¡Õë¶ÔÌض¨SQLÓï¾ä£¬Ê¹Óà explain plan set statement_id = 'tst1' into plan_table
¡¡¡¡ÔËÐÐutlxplp.sql »ò utlxpls.sql²ì¿´explain plan
EXPLAIN PLA ......

SQLº¯Êý´óÈ«

¾ÛºÏº¯Êý
MAX(×Ö¶Î)      
Çóij×Ö¶ÎÖеÄ×î´óÖµ
MIN(×Ö¶Î)
    
Çóij×Ö¶ÎÖеÄ×îСֵ
AVG(×Ö¶Î)
     
Çóij×Ö¶ÎÖеÄƽ¾ùÖµ
SUM(×Ö¶Î)
    
Çóij×Ö¶ÎÖеÄ×ܺÍ
COUNT(×Ö¶Î) 
ͳ¼Æij×ֶηǿռͼÊý
COUNT
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ