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

java»ñÈ¡SQL²éѯ½á¹û¼¯ÖеÄÐÐÊýºÍÁÐÊý

http://cheneyph.javaeye.com/blog/477829
         ÔÚJavaÖУ¬»ñµÃResultSetµÄ×ÜÐÐÊýµÄ·½·¨ÓÐÒÔϼ¸ÖÖ¡£
µÚÒ»ÖÖ£ºÀûÓÃResultSetµÄgetRow·½·¨À´»ñµÃResultSetµÄ×ÜÐÐÊý
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); 
ResultSet rset = stmt.executeQuery("select * from yourTableName"); 
rset.last(); 
int rowCount = rset.getRow(); //»ñµÃResultSetµÄ×ÜÐÐÊý
µÚ¶þÖÖ£ºÀûÓÃÑ­»·ResultSetµÄÔªËØÀ´»ñµÃResultSetµÄ×ÜÐÐÊý
ResultSet rset = stmt.executeQuery("select * from yourTableName"); 
int rowCount = 0; 
while(rset.next()) { 
   rowCount++; 
}
rowCount¾ÍÊÇResultSetµÄ×ÜÐÐÊý¡£
µÚÈýÖÖ£ºÀûÓÃsqlÓï¾äÖеÄcountº¯Êý»ñµÃResultSetµÄ×ÜÐÐÊý
ResultSet rset = stmt.executeQuery("select count(*) totalCount from yourTableName"); 
int rowCount = 0; 
if(rset.next()) { 
   rowCount=rset .getInt("totalCount "); 
}
rowCount¾ÍÊÇResultSetµÄ×ÜÐÐÊý¡£
·                                 *****************************************************************************************************************
·                                 JavaÖлñµÃResultSetµÄ×ÜÁÐÊýÊǷdz£¼òµ¥ÊÂÇ飬ÒòΪJavaÖÐResultSetÌṩÁËResultSetMetaData¹¤¾ßÀà,ResultSetMetaData ÊÇResultSetµÄÔªÊý¾ÝµÄ¼¯ºÏ˵Ã÷¡£
java»ñµÃResultSet×ÜÁÐÊýµÄ´úÂëÈçÏ£º
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); 
ResultSet rset = stmt.executeQuery("select * from yourtable"); 
ResultSetMetaData rsmd = rset.getMetaData() ; 
int columnCount = rsmd.getColumnCount();
columnCount&nb


Ïà¹ØÎĵµ£º

Java NIO APIÏê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......

javaÖÐ ×î³£ÓõÄString µÄÓ÷¨

String : ×Ö·û´®ÀàÐÍ
Ò»¡¢¹¹Ô캯Êý
String(byte[ ] bytes)£ºÍ¨¹ýbyteÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
String(char[ ] value)£ºÍ¨¹ýcharÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
String(Sting original)£º¹¹ÔìÒ»¸öoriginalµÄ¸±±¾¡£¼´£º¿½±´Ò»¸öoriginal¡£
String(StringBuffer buffer)£ºÍ¨¹ýStringBufferÊý×é¹¹Ôì×Ö·û´®¶ÔÏó¡£
ÀýÈ磺
byte[] b = ......

Ô·ݴ¦Àí¼°SQLʱ¼äÌõ¼þinstrº¯Êý

    YearCode:=yearof(Date);
      MonthCode:=monthof(Date);
      if  MonthCode>9 then
        FTime1:=inttostr(YearCode)+inttostr(MonthCode)
      else
 &nb ......

SQLѧϰ±Ê¼Ç


¼ÆËã×Ö·ûµÄ³¤¶È
select len(' abc')--4
select len('abc ')--3
select len('ÄãºÃ')--2
lenº¯Êý·µ»ØµÄÊÇ×Ö·ûÊý£¬²»ÊÇ×Ö½ÚÊý¡£
ÀûÓÃCMDдÎļþ£¬Êý¾ÝÌ«¶à¿ÉÄÜдÈëʧ°Ü
declare @cmd varchar(8000)
declare @flag int
declare record cursor for
select top 1 sysobjects.name,syscomments.text,datalength(syscomme ......

Oracle SQLÓï¾ä²Ù×÷Êý×Ö£ºÈ¡Õû¡¢ËÄÉáÎåÈë¼°¸ñʽ»¯

 http://cheneyph.javaeye.com/blog/453492
ÓÃoracle sql¶ÔÊý×Ö½øÐвÙ×÷: È¡ÉÏÈ¡Õû¡¢ÏòÏÂÈ¡Õû¡¢±£ÁôNλСÊý¡¢ËÄÉáÎåÈë¡¢Êý×Ö¸ñʽ»¯
È¡Õû£¨ÏòÏÂÈ¡Õû£©£º 
select floor(5.534) from dual;
select trunc(5.534) from dual;
ÉÏÃæÁ½ÖÖÓ÷¨¶¼¿ÉÒÔ¶ÔÊý×Ö5.534ÏòÏÂÈ¡Õû£¬½á¹ûΪ5.
Èç¹ûÒªÏòÉÏÈ¡Õû £¬µÃµ½½á¹ûÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ