ÒòΪĿǰÕâЩÌØÐÔÊÇÎÒÃǶÀÓеģ¬ËùÒÔÎÒÃÇÔÚ Java Àïͨ¹ýÒ»Ì×À©Õ¹µÄ API Ìṩ¶ÔÕâЩÌØÐÔµÄÖ§³Ö£®ÔÚ±ê×¼Çý¶¯µÄºËÐÄÀïÓÐЩÌØÐÔʵ¼ÊÉÏÊÇͨ¹ýÕâЩÀ©Õ¹ÊµÏֵģ¬±ÈÈç´ó¶ÔÏóµÈ£®
»ñµÃÕâЩÀ©Õ¹ Òª»ñµÃijЩÀ©Õ¹£¬ÄãÐèҪʹÓà postgresql.Connection ÀàÀïµÄһЩ¶îÍâµÄ·½·¨ Õâʱ£¬ÄãÐèҪת»» Driver.getConnection() µÄ·µ»ØÖµ£® ÀýÈ磺 Connection db = Driver.getConnection(url,user,pass); // later on Fastpath fp = ((postgresql.Connection)db).getFastpathAPI(); Class postgresql.Connection java.lang.Object | +----postgresql.Connection ¹«¹²Àà (public class) Connection À©Õ¹ÁË(Àà) Object ʵÏÖµÄ Connection ÕâЩÊÇÓÃÓÚ»ñÈ¡ÎÒÃǵÄÀ©Õ¹µÄ¶îÍâ·½·¨£®ÎÒ Ã»ÓÐÁгöÓÉ java.sql.Connection ¶¨ÒåµÄ·½·¨£® public Fastpath getFastpathAPI() throws SQLException ÕâÀï·µ»Øµ±Ç°Áª½ÓµÄ Fastpath API£® ×¢Ò⣺Õâ¸öÓ÷¨²»ÊÇ JDBC µÄÒ»²¿·Ö£¬µ«ÊÇÔÊÐíʹÓà postgresql ºó¶Ë±¾ÉíµÄº¯Êý£® Õâ¸öÓ÷¨»ù±¾ÉÏÊÇÓÃÓÚ LargeObject API µÄ ʹÓÃÕâ¸öÓ÷¨µÄ×îºÃµÄ·½·¨ÊÇ£º import postgresql.fastpath.*; ... Fastpath fp = ((postgresql.Connection)myconn).getFastpathAPI(); ÕâÀï myconn ÊÇÒ»¸ö´ò¿ªÁ˵ĵ½ postgresql µÄ Connection £¨Áª½Ó£©£® ·µ»Ø£º Fastpath ¶ÔÏóÔÊÐíʹÓÃÔÚ postgresql ºó¶ËÉϵĺ¯Êý£® Å׳ö£º SQLException ÔÚ Fastpath ΪµÚÒ»´ÎʹÓóõʼ»¯Ê±Éú³É public LargeObjectManager getLargeObjectAPI() throws SQLException Õâ¸öÓï¾äΪµ±Ç°Áª½Ó·µ»Ø LargeObject API£® ×¢Ò⣺Õâ¸öÓ÷¨²»ÊÇ JDBC µÄÒ»²¿·Ö£¬µ«ÊÇÔÊÐíʹÓà postgresql ºó¶Ë±¾ÉíµÄº¯Êý£® ʹÓÃÕâ¸öÓ÷¨µÄ×îºÃµÄ·½·¨ÊÇ£º import postgresql.largeobject.*; ... LargeObjectManager lo = ((postgresql.Connection)myconn).getLargeObjectAPI(); ÕâÀï myconn ÊÇÒ»¸ö´ò¿ªÁ˵ĵ½ postgresql µÄ Connection £¨Áª½Ó£©£® ·µ»Ø£º ʵÏָà API µÄ LargeObject ¶ÔÏó Å׳ö£º SQLException ÔÚ LargeObject ΪµÚÒ»´ÎʹÓóõʼ»¯Ê±Éú³É public void addDataType(String type, String name) Õâ¸öº¯ÊýÔÊÐí¿Í»§Ó¦ÓôúÂëΪ postgresql ÖÚ¶à¶ÀÁ¢Êý¾ÝÀàÐ͵ÄÒ»¸öÔö¼ÓÒ»¸ö¿ØÖÆÆ÷£® ͨ³££¬Çý¶¯Æ÷²»ÄÜʶ±ðµÄÊý¾ÝÀàÐÍÓÉ ResultSet.getObject() ×öΪ PGobject ʵÀý·µ»Ø£® Õâ¸ö·½·¨ÔÊÐíÄãдһ¸öÀàÀ©Õ¹ PGobject£¬²¢ÇÒ ¸æËßÇý¶¯Æ÷ҪʹÓõÄÀàÐÍÃû³ÆºÍÀàÃû³Æ£® ÕâÑù×öµÄ²»±ãÖ®´¦ÊÇÄãÿ´Î½øÐÐÁª½Óºó¶¼±ØÐëµ÷ÓÃÕâ¸ö·½·¨. ×¢Ò⣺Õâ¸öÓ÷¨²»ÊÇ JDBC µÄÒ»²¿·Ö, ¶øÊÇÒ»¸öÀ©Õ¹£® ʹÓÃÕâ¸öÓ÷¨µÄ×îºÃ·½·¨ÊÇ£º ... ((postgresql.Connection)myconn).addDataType("mytype","my.class.name"- ); ... ÕâÀï myconn ÊÇÒ»¸ö´ò¿ªÁ˵ÄÓë postgresql µÄ Connection £¨Áª½Ó£©£® ¸Ã¿ØÖÆÀà±ØÐëÀ©Õ¹ postgresql.util.PGobject ²ÎÔÄ£º PGobject Fastpath Fastpath ÊÇÒ»Ì×´æÔÚÓÚlibpq C ½Ó¿ÚÀïµÄAPI£¬²¢ÇÒÕâ¸ö½Ó¿ÚÔÊÐí¿Í»§»úÆ÷Ö´Ðкó¶ËÊý¾Ý¿âµÄº¯Êý. ´ó¶àÊý¿Í»§¶Ë´úÂë²»ÐèҪʹÓÃÕâ¸ö·½·¨£¬µ«ÊÇÎÒÃÇ»¹ÊÇÌṩÕâ¸ö·½·¨£¬ÒòΪ´ó¶ÔÏó API ʹÓÃËü£® ҪʹÓÃÕâ¸öÌØÐÔ£¬ÄãÐèÒªÊäÈë postgresql.fastpath °ü£¬Ê¹ÓÃÏÂÃæÐÐ import postgresql.fastpath.*; È»ºó£¬ÔÚÄãµÄ´úÂëÀÄãÐèÒª»ñÈ¡Ò»¸ö FastPath ¶ÔÏó£º Fastpath fp = ((postgresql.Connection)conn).getFastpathAPI(); ÕâÑù½«·µ»ØÒ»¸öʵÀý£¬¸ÃʵÀýÓëÄãÓÃÀ´Ö´ÐÐÃüÁîµÄÊý¾Ý¿âÁª½ÓÏà¹ØÁª£® °Ñ Connection ת»»³É postgresql.Connection ÊDZØÐëµÄ£¬ÒòΪ getFastpathAPI() ÊÇÎÒÃÇ×Ô¼ºµÄ ·½·¨Ö®Ò»£¬¶ø²»ÊÇ JDBC µÄ£® Ò»µ©ÄãÓÐÒ»¸ö Fastpath ʵÀý£¬Äã¾Í¿ÉÒÔʹÓà fastpath() ·½·¨À´Ö´Ðкó¶Ëº¯Êý. Class postgresql.fastpath.Fastpath java.lang.Object | +----postgresql.fastpath.Fastpath ¹«¹²Àà (public class) Fastpath À©Õ¹ÁË Object Õâ¸öÀàʵÏÖÁË Fastpath api £¨±à³Ì½Ó¿Ú£©£® ÕâÊÇÔÚÒ»¸ö java Ó¦ÓÃÀïÖ´ÐÐÄÚǶÔÚ postgresql ºó¶ËµÄº¯ÊýµÄ·½·¨£® Õâ¸ö·½·¨ÊÇÒÔÎļþ src/interfaces/libpq/fe-exec.c Ϊ»ù´¡µÄ ²ÎÔÄ£º FastpathFastpathArg, LargeObject ·½·¨ public Object fastpath(int fnid, boolean resulttype, FastpathArg args[]) throws SQLException Ïò PostgreSQL ºó¶Ë·¢ËÍÒ»¸öº¯Êýµ÷Óà ²ÎÊý: fnid - º¯Êý id resulttype - Èç¹û½á¹ûÊÇÕûÊý·µ»ØÕæ (true), ÆäËû½á¹û·µ»Ø¼Ù (false) args - ´«µÝ¸ø fastpath µÄ²ÎÊý FastpathArguments ·µ»Ø: Èç¹ûûÓÐÊý¾Ý·µ»Ø¿Õ(null), Èç¹û½á¹ûΪÕûÊý·µ»ØÒ»¸öInteger, ·ñÔò·µ»Ø byte[] Å׳ö: SQLException Èç¹û·¢ÉúÁËÒ»¸öÊý¾Ý¿â·ÃÎÊ´íÎó. public Object fastpath(String name, boolean resulttype, FastpathArg args[]) throws SQLException ͨ¹ýÃû³ÆÏò PostgreSQL ºó¶Ë·¢ËÍÒ»¸öº¯Êýµ÷ÓÃ. ×¢Òâ: º¯ÊýÃûµ½º¯Êý id µÄÓ°Éä±ØÐë´æÔÚ, ͨ³£Ïȵ÷Óà addfunction(). ÕâÊǵ÷Óú¯ÊýµÄ±È½ÏºÃµÄ·½·¨, ÒòΪº¯Êý id ÔÚ²»Í¬°æ±¾µÄºó¶ËÀïÊÇ»á/¿ÉÄܸıäµÄ. »ñÈ¡Õâ¸ö·½·¨¹¤×÷µÄÀý×Ó, ²ÎÔÄ postgresql.LargeObject ²ÎÊý: name - º¯ÊýÃû³Æ resulttype - Èç¹û½á¹ûÊÇÕûÊý·µ»ØÕæ (true), ÆäËû½á¹û·µ»Ø¼Ù (false) args - ´«µÝ¸ø fastpath µÄ²ÎÊý FastpathArguments ·µ»Ø: Èç¹ûûÓÐÊý¾Ý·µ»Ø¿Õ (null), Èç¹û½á¹ûΪÕûÊý·µ»ØÒ»¸ö Integer, ·ñÔò·µ»Ø byte[] Å׳ö: SQLException Èç¹ûÃû³Æδ֪»òÕßÊý¾Ý¿â·ÃÎÊ´íÎó·¢Éú. ²ÎÔÄ: LargeObject public int getInteger(String name, FastpathArg args[]) throws SQLException Õâ¸ö±ãÀû·½·¨¼ÙÉè·µ»ØÖµÊÇÒ»¸ö Integer (ÕûÊý) ²ÎÊý: name - º¯ÊýÃû args - º¯Êý²ÎÊý ¡¡¡¡¡¡¡¡¡¡·µ»Ø: ÕûÊý½á¹û Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó»òÕßûÓнá¹û public byte[] getData(String name, FastpathArg args[]) throws SQLException Õâ¸ö±ãÀû·½·¨¼ÙÉè·µ»ØÖµÊǶþ½øÖÆÊý¾Ý ²ÎÊý: name - º¯ÊýÃû args - º¯Êý²ÎÊý ·µ»Ø: °üº¬½á¹ûµÄ byte[] Êý×é Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó»òÕßûÓнá¹û public void addFunction(String name, int fnid) Õâ¸ö·½·¨ÏòÎÒÃǵÄ(º¯Êý)¼ìË÷±íÀïÔö¼ÓÒ»¸öº¯Êý. Óû§´úÂëÓ¦¸ÃʹÓà addFunctions ·½·¨, ÒòΪÕâ¸ö·½·¨»ùÓÚÒ»¸ö²éѯ,¶ø²»ÊÇÄÑдµÄ oid ´úÂë. ÎÒÃDz»±£Ö¤Ò»¸öº¯ÊýµÄ oid ÊǾ²Ì¬µÄ, ÉõÖÁÔËÐÐÔÚ²»Í¬·þÎñÆ÷µÄͬ°æ±¾µÄÊý¾Ý¿âÒ²²»Äܱ£Ö¤ÊÇͳһµÄ. ²ÎÊý: name - º¯ÊýÃû fnid - º¯Êý id public void addFunctions(ResultSet rs) throws SQLException Õâ¸ö·½·¨½ÓÊÕÒ»¸ö°üº¬Á½¸ö×Ö¶ÎµÄ ResultSet. ×ֶΠ1 °üº¬º¯ÊýÃû, ×ֶΠ2 ÊÇ oid. Ëü¶ÁÈ¡Õû¸ö ResultSet, °ÑÖµ×°ÔØÈ뺯Êý±í. µ÷ÓÃÍêÕâ¸ö·½·¨ºó¼ÇµÃÓà close() ¹Ø±Õ½á¹û¼¯!! ¹ØÓÚº¯ÊýÃû²éÕÒʵÏÖµÄÐÅÏ¢: PostgreSQL ÔÚ pg_proc ±íÀï´æ´¢º¯Êý id ºÍËüÃǶÔÓ¦µÄÃû³Æ, ÔÚ ²éÕÒʱ²»ÊǴӸñíÀï²éѯÿ¸öËùÐ躯ÊýµÄÃû³Æ, ¶øÊÇʹÓÃÁËÒ»¸ö Hashtable (É¢Áбí). ͬÑù, Ö»ÓÐÐèÒªµÄº¯ÊýµÄÃû³Æ²Å·Åµ½Õâ¸ö±íÀï, ÒÔ±£Ö¤Á¬½ÓËٶȾ¡¿ÉÄÜ¿ì. postgresql.LargeObject ÀàÔÚÆô¶¯Ê±Ö´ÐÐÒ»¸ö²éѯ, ²¢ÇÒ°Ñ·µ»ØµÄ ResultSet ´«µÝ¸øÕâÀïÌáµ½µÄ addFunctions() ·½·¨ Ò»µ©ÕâЩ¹¤×÷Íê³É, LargeObject api ÓÃÃû³ÆÒýÓú¯Êý. ²»ÒªÒÔΪÊÖ¹¤°ÑËüÃÇת»»³É oid ¿ÉÒÔ¹¤×÷. µÄÈ·, Ä¿Ç°ÕâÑù×öÊÇ¿ÉÒÔÓõÄ, µ«Ëæ×Å¿ª·¢µÄ ¹ý³ÌÕâЩ¿ÉÄܱ»ÐÞ¸Ä(ÔÚ V7.0 °æ±¾µÄÌÖÂÛÖÐÓÐһЩ¹ØÓÚÕâЩµÄ»°Ìâ), ËùÒÔÕâÑù×öÊÇ·ÀֹδÀ´½«³öÏÖµÄ ÈκÎûÓб£Ö¤µÄÍ´¿àµÄÊÖ¶Î. ²ÎÊý: rs - ResultSet Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó. ²ÎÔÄ: LargeObjectManager public int getID(String name) throws SQLException Õâ¸ö·½·¨·µ»ØÓ뺯ÊýÃû¹ØÁªµÄº¯Êý id Èç¹û»¹Ã»ÓжÔÕâ¸öº¯Êýµ÷Óà addFunction() »ò addFunctions(), ÄÇôÅ׳öÒ»¸ö SQLException . ²ÎÊý: name - ´ý²éÕҵĺ¯ÊýÃû ·µ»Ø: ÓÃÓÚ fastpath µ÷Óõĺ¯Êý ID Å׳ö: SQLException Èç¹ûº¯Êýδ֪. Class postgresql.fastpath.FastpathArg java.lang.Object | +----postgresql.fastpath.FastpathArg public class FastpathArg extends Object ÿ¸ö fastpath µ÷ÓÃÐèÒªÒ»¸ö²ÎÊýÁбí, ÆäÊýÄ¿ºÍÀàÐÍÈ¡¾öÓÚ±»µ÷Óõĺ¯Êý. Õâ¸öÀàʵÏÖÁËÌṩÕâ¸ö¹¦ÄÜËùÐèÒªµÄ·½·¨. ¹ØÓÚÈçºÎʹÓÃÕâ¸ö·½·¨µÄÀý×Ó, ²ÎÔÄpostgresql.largeobject °ü ²ÎÔÄ: Fastpath, LargeObjectManager, LargeObject ¹¹Ôì(·½·¨) public FastpathArg(int value) ¹¹ÔìÒ»¸ö°üº¬Ò»¸öÕûÊýµÄ²ÎÊý ²ÎÊý: value - ´ýÉèÖÃµÄ int (ÕûÊý)Öµ public FastpathArg(byte bytes[]) ¹¹ÔìÒ»¸ö°üº¬Ò»Ð©×Ö½ÚµÄÊý×éµÄ²ÎÊý ²ÎÊý: bytes - Òª±£´æµÄÊý×é public FastpathArg(byte buf[], int off, int len) ¹¹ÔìÒ»¸ö°üº¬Ò»¸öÊý×éµÄÒ»²¿·ÖµÄ²ÎÊý ²ÎÊý: buf - Ô´Êý×é off - Êý×éÄÚµÄÆ«ÒÆÁ¿ len - Òª°üÀ¨µÄÊý¾ÝµÄ³¤¶È public FastpathArg(String s) ¹¹ÔìÒ»¸ö°üº¬Ò»¸ö×Ö·û´®µÄ²ÎÊý. ²ÎÊý: s - Òª±£´æµÄ×Ö·û´® ¼¸ºÎÊý¾ÝÀàÐÍ PostgreSQL ÓÐÒ»¸öÍù±íÀï´æ´¢¼¸ºÎÌØÐÔµÄÊý¾ÝÀàÐͼ¯.·¶Î§°üÀ¨µã, Ïß, ºÍ¶à±ßÐÎ. ÎÒÃÇͨ¹ý postgresql.geometric °üÀ´ÔÚ Java ÀïÖ§³ÖÕâЩÀàÐÍ. Ëü°üÀ¨À©Õ¹ postgresql.util.PGobject ÀàµÄÀà.²Î¿¼¸ÃÀà»ñÈ¡ÈçºÎʵÏÖÄã×Ô¼ºµÄÊý¾ÝÀàÐ͵ĿØÖÆÆ÷µÄϸ½Ú. Class postgresql.geometric.PGbox java.lang.Object | +----postgresql.util.PGobject | +----postgresql.geometric.PGbox ¹«¹²Àà PGbox À©Õ¹ PGobject ʵÏÖ Serializable, Cloneable Õâ¸öÀàÔÚ postgresql Àï±íʾºÐ×Ó (box) Êý¾ÝÀàÐÍ. ±äÁ¿ (Variables) public PGpoint point[] ÕâЩÊǺÐ×ÓµÄÁ½¸ö¶Ô½Çµã. ¹¹Ôì(·½·¨) public PGbox(double x1, double y1, double x2, double y2) ²ÎÊý: x1 - µÚÒ»¸ö x ×ø±ê y1 - µÚÒ»¸ö y ×ø±ê x2 - µÚ¶þ¸ö x ×ø±ê y2 - µÚ¶þ¸ö y ×ø±ê public PGbox(PGpoint p1, PGpoint p2) ²ÎÊý: p1 - µÚÒ»¸öµã p2 - µÚ¶þ¸öµã public PGbox(String s) throws SQLException ²ÎÊý: s - PostgreSQL Óï·¨ÀïµÄºÐ×Ó¶¨Òå Å׳ö: SQLException Èç¹û¶¨Òå·Ç·¨ public PGbox() ±ØÐëµÄ¹¹Ôì(·½·¨) ·½·¨ public void setValue(String value) throws SQLException Õâ¸ö·½·¨ÉèÖÃÕâ¸ö¶ÔÏóµÄÖµ. ËüÓ¦¸Ã±»ÖØÔØ, µ«ÊÇÈÔÈ»±»×ÓÀàµ÷ÓÃ. ²ÎÊý: value - Ò»¸ö´ú±í¶ÔÏóÖµµÄ×Ö·û´® Å׳ö: SQLException Èç¹û´ËÊýÖµ¶ÔÕâ¸öÀàÐͶøÑÔÊÇ·Ç·¨µÄ ÖØÔØ: Àà PGobject ÀïµÄ setValue public boolean equals(Object obj) ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½¸öºÐ×ÓÏàµÈ·µ»ØÕæ (true) ÖØÔØ: Àà PGobject ÀïµÄ equals public Object clone() ±ØÐëÖØÔØÕâ¸ö·½·¨ÒÔÔÊÐí¶ÔÏ󱻿Ë¡ (cloned) ÖØÔØ: Àà PGobject ÀïµÄ clone public String getValue() ·µ»Ø: postgresql ÐèÒªµÄ PGbox ¾ä·¨×Ö´® ÖØÔØ: PGobject ÀïµÄ getValue Class postgresql.geometric.PGcircle java.lang.Object | +----postgresql.util.PGobject | +----postgresql.geometric.PGcircle ¹«¹²Àà PGcircle À©Õ¹ PGobject ʵÏÖµÄ Serializable, Cloneable Õâ¸öÀà´ú±í postgresql µÄÔ²Êý¾ÝÀàÐÍ, ÓÉÒ»¸öµãºÍÒ»¸ö°ë¾¶×é³É ±äÁ¿ public PGpoint center ÕâÊÇÔ²ÐÄ public double radius ÕâÊǰ뾶 ¹¹Ôì(·½·¨) public PGcircle(double x, double y, double r) ²ÎÊý: x - Ô²ÐÄ×ø±ê y - Ô²ÐÄ×ø±ê r - Ô²°ë¾¶ public PGcircle(PGpoint c, double r) ²ÎÊý: c - PGpoint ÃèÊöÔ²ÐÄ r - Ô²°ë¾¶ public PGcircle(String s) throws SQLException ²ÎÊý: s - PostgreSQL ÀïÓï·¨¶¨ÒåµÄÔ². Å׳ö: SQLException Èç¹ûת»»Ê§°Ü public PGcircle() Õâ¸ö¹¹Ôì(·½·¨)±»Çý¶¯Æ÷ʹÓÃ. ·½·¨ public void setValue(String s) throws SQLException ²ÎÊý: s - Óà PostgreSQL µÄÓï·¨¶¨ÒåµÄÔ². Å׳ö: SQLException Èç¹ûת»»Ê§°Ü ÖØÔØ: ÀàPGobject ÀïµÄ setValue public boolean equals(Object obj) ²ÎÊý: obj - Òª¶Ô±ÈµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½¸öÔ²Ïàͬ·µ»ØÕæ (true) ÖØÔØ: Àà PGobject ÀïµÄ equals public Object clone() ±ØÐëÖØÔØÕâ¸ö·½·¨ÒÔ±ãÔÊÐí¶ÔÏ󱻿Ë¡ (cloned) ÖØÔØ: Àà PGobject ÀïµÄ clone public String getValue() ·µ»Ø: postgresql Óï·¨ÐèÒªµÄ PGcircle ×Ö´® ÖØÔØ: PGobject ÀïµÄ getValue Class postgresql.geometric.PGline java.lang.Object | +----postgresql.util.PGobject | +----postgresql.geometric.PGline ¹«¹²Àà PGline À©Õ¹ PGobject ʵÏÖµÄ Serializable, Cloneable Õâ¸öÀàʵÏÖÓÉÁ½¸öµã×é³ÉµÄÏß. Ä¿Ç°Ïß»¹Ã»ÓÐÔÚºó¶ËʵÏÖ,µ«Õâ¸öÀà±£Ö¤ÔÚºó¶ËʵÏÖºó¼´¿ÉʹÓÃ(Ïß). ±äÁ¿ public PGpoint point[] ÕâÊÇÁ½¸öµã. ¹¹Ôì(·½·¨) public PGline(double x1, double y1, double x2, double y2) ²ÎÊý: x1 - µÚÒ»¸öµãµÄ×ø±ê y1 - µÚÒ»¸öµãµÄ×ø±ê x2 - µÚ¶þ¸öµãµÄ×ø±ê y2 - µÚ¶þ¸öµãµÄ×ø±ê public PGline(PGpoint p1, PGpoint p2) ²ÎÊý: p1 - µÚÒ»¸öµã p2 - µÚ¶þ¸öµã public PGline(String s) throws SQLException ²ÎÊý: s - PostgreSQL Óï·¨¶¨ÒåµÄµã. Å׳ö: SQLException µ±·¢Éúת»»´íÎóʱ public PGline() Çý¶¯ÐèÒª ·½·¨ public void setValue(String s) throws SQLException ²ÎÊý: s - PostgreSQL ÀïÓï·¨µÄÏ߶εĶ¨Òå Å׳ö: SQLException µ±·¢Éúת»»´íÎóʱ ÖØÔØ: Àà PGobject ÀïµÄ setValue public boolean equals(Object obj) ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½ÌõÏ߶ÎÏàͬ·µ»ØÕæ (true) ÖØÔØ: Àà PGobject ÀïµÄ equals public Object clone() Õâ¸ö·½·¨±ØÐë±»ÖØÔØÒÔ±ãÔÊÐíÕâ¸ö¶ÔÏó¿ÉÒÔ±»¿Ë¡ ÖØÔØ: Àà PGobject ÀïµÄ clone public String getValue() ·µ»Ø: postgresql Óï·¨ÒªÇóµÄ PGline ×Ö´® ÖØÔØ: Àà PGobject ÀïµÄ getValue Class postgresql.geometric.PGlseg java.lang.Object | +----postgresql.util.PGobject | +----postgresql.geometric.PGlseg ¹«¹²Àà PGlseg À©Õ¹ PGobject ʵÏÖµÄ Serializable, Cloneable Õâ¸öʵÏÖÊÇÒ»Ìõ°üº¬Á½¸öµãµÄ lseg (Ï߶Î) ±äÁ¿ public PGpoint point[] ÕâÀïÊÇÁ½¸öµã ¹¹Ôì(·½·¨) public PGlseg(double x1, double y1, double x2, double y2) ²ÎÊý: x1 - µÚÒ»¸öµãµÄ×ø±ê y1 - µÚÒ»¸öµãµÄ×ø±ê x2 - µÚ¶þ¸öµãµÄ×ø±ê y2 - µÚ¶þ¸öµãµÄ×ø±ê public PGlseg(PGpoint p1, PGpoint p2) ²ÎÊý: p1 - µÚÒ»¸öµã p2 - µÚ¶þ¸öµã public PGlseg(String s) throws SQLException ²ÎÊý: s - PostgreSQL ÀïÓï·¨¶ÔÏ߶ζ¨ÒåµÄ×Ö´®. Å׳ö: SQLException ÔÚ·¢Éúת»»´íÎóʱ public PGlseg() Çý¶¯ÒªÇó ·½·¨ public void setValue(String s) throws SQLException ²ÎÊý: s - PostgreSQL ÀïÓï·¨¶ÔÏ߶ζ¨ÒåµÄ×Ö´® Å׳ö: SQLException ÔÚ·¢Éúת»»´íÎóʱ ÖØÔØ: Àà PGobject ÀïµÄ setValue public boolean equals(Object obj) ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½ÌõÏ߶ÎÏàµÈ ÖØÔØ: Àà PGobject ÀïµÄ equals public Object clone() ±ØÐëÖØÔØÕâ¸ö·½·¨ÒÔ±ãÔÊÐíÕâ¸ö¶ÔÏ󱻿Ë¡ ÖØÔØ: Àà PGobject ÀïµÄ clone public String getValue() ·µ»Ø: postgresql Óï·¨ÒªÇóµÄ PGlseg ×Ö´® ÖØÔØ: Àà PGobject ÀïµÄ getValue Class postgresql.geometric.PGpath java.lang.Object | +----postgresql.util.PGobject | +----postgresql.geometric.PGpath ¹«¹²Àà PGpath À©Õ¹ PGobject ʵÏÖ Serializable, Cloneable ÕâÊÇ·¾¶( ¶àÏ߶ÎͼÐÎ, ¿ÉÒÔΪ·â±ÕµÄ )µÄʵÏÖ ±äÁ¿ public boolean open Èç¹û·¾¶¿ª·ÅʱΪÕæ (True), Ϊ·â±ÕʱΪ¼Ù public PGpoint points[] ¶¨Òå·¾¶µÄµã ¹¹Ôì(·½·¨) public PGpath(PGpoint points[], boolean open) ²ÎÊý: points - ¶¨Òå·¾¶µÄ PGpoints open - Èç¹û·¾¶ÊÇ¿ª·ÅµÄΪÕæ (True), ·â±ÕΪ¼Ù (false) public PGpath() Çý¶¯ÐèÒª public PGpath(String s) throws SQLException ²ÎÊý: s - PostgreSQL µÄÓï·¨¶¨ÒåµÄ·¾¶µÄ×Ö´®. Å׳ö: SQLException ÔÚ·¢Éúת»»´íÎóʱ ·½·¨ public void setValue(String s) throws SQLException ²ÎÊý: s - PostgreSQL µÄÓï·¨¶¨ÒåµÄ·¾¶µÄ×Ö´® Å׳ö: SQLException ÔÚ·¢Éúת»»Ê§°Üʱ ÖØÔØ: Àà PGobject ÀïµÄ setValue public boolean equals(Object obj) ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½¸ö·¾¶Ïàͬ·µ»ØÕæ (true) ÖØÔØ: Àà PGobject ÀïµÄ equals public Object clone() ±ØÐëÖØÔØÕâ¸ö·½·¨ÒÔ±ãÔÊÐíÕâ¸ö¶ÔÏ󱻿Ë¡ ÖØÔØ: Àà PGobject ÀïµÄ clone public String getValue() Õâ¸ö·½·¨·µ»Ø postgresql Óï·¨µÄ¶à±ßÐÎ×Ö´® ÖØÔØ: Àà PGobject ÀïµÄ getValue public boolean isOpen() Èç¹û·¾¶ÊÇ¿ª·ÅµÄÕâ¸ö·½·¨·µ»ØÕæ (true) public boolean isClosed() Èç¹û·¾¶ÊÇ·â±ÕµÄÕâ¸ö·½·¨·µ»ØÕæ (true) public void closePath() ±ê¼Ç·¾¶Îª·â±Õ public void openPath() ±ê¼Ç·¾¶Îª¿ª·Å Class postgresql.geometric.PGpoint java.lang.Object | +----postgresql.util.PGobject | +----postgresql.geometric.PGpoint ¹«¹²Àà PGpoint À©Õ¹ PGobject ʵÏÖ Serializable, Cloneable Õâ¸öÀàʵÏÖÁË java.awt.Point µÄÒ»¸ö°æ±¾, µ«Óà double ±íʾ²ÎÊý. Ëü¶ÔÓ¦ÓÚ postgresql ÀïµÄ point Êý¾ÝÀàÐÍ. ±äÁ¿ public double x µãµÄ X ×ø±ê public double y µãµÄ Y ×ø±ê ¹¹Ôì(·½·¨) public PGpoint(double x, double y) ²ÎÊý: x - ×ø±ê y - ×ø±ê public PGpoint(String value) throws SQLException Õâ¸ö·½·¨Ö÷Òª´ÓÆäËû¼¯ºÏÀàÐ͵÷Óà -- µ±Ò»¸öµãǶÈëËüÃǵĶ¨ÒåÖÐʱ. ²ÎÊý: value - PostgreSQL Óï·¨¶¨ÒåµÄµã public PGpoint() Çý¶¯ÐèÒª ·½·¨ public void setValue(String s) throws SQLException ²ÎÊý: s - PostgreSQL Óï·¨¶¨ÒåµÄµã Å׳ö: SQLException ÔÚת»»Ê§°Üʱ ÖØÔØ: Àà PGobject ÀïµÄ setValue public boolean equals(Object obj) ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½¸ö¶ÔÏóÏàͬ·µ»ØÕæ (true) ÖØÔØ: Àà PGobject ÀïµÄ equals public Object clone() ±ØÐëÖØÔØÕâ¸ö·½·¨ÒÔ±ãÔÊÐíÕâ¸ö¶ÔÏ󱻿Ë¡ ÖØÔØ: Àà PGobject ÀïµÄ clone public String getValue() ·µ»Ø: postgresql ÆÚÍûµÄÓï·¨µÄ PGpoint µÄ±íʾ×Ö´®. ÖØÔØ: Àà PGobject ÀïµÄ getValue public void translate(int x, int y) ¶Ôµã×öÖ¸¶¨ÊýÁ¿µÄת»»(λÒÆ). ²ÎÊý: x - Ïò x ÖáÔö¼ÓµÄÕûÐÍÊýÁ¿ y - Ïò y ÖáÔö¼ÓµÄÕûÐÍÊýÁ¿ public void translate(double x, double y) ¶Ôµã×öÖ¸¶¨ÊýÁ¿µÄת»»(λÒÆ). ²ÎÊý: x - Ïò x ÖáÔö¼ÓµÄË«¾«¶ÈÐÍÊýÁ¿ y - Ïò y ÖáÔö¼ÓµÄË«¾«¶ÈÐÍÊýÁ¿ public void move(int x, int y) °ÑµãÒƵ½Ö¸¶¨×ø±ê. ²ÎÊý: x - ÕûÊý×ø±ê y - ÕûÊý×ø±ê public void move(double x, double y) °ÑµãÒƵ½Ö¸¶¨×ø±ê. ²ÎÊý: x - Ë«¾«¶È×ø±ê y - Ë«¾«¶È×ø±ê public void setLocation(int x, int y) °ÑµãÒƵ½Ö¸¶¨×ø±ê. ²Î¿¼ java.awt.Point »ñÈ¡Õâ¸ö·½·¨µÄÃèÊöÐÅÏ¢ ²ÎÊý: x - ÕûÊý×ø±ê y - ÕûÊý×ø±ê ²ÎÔÄ: Point public void setLocation(Point p) °ÑµãÒƵ½Ö¸¶¨×ø±ê. ²Î¿¼ java.awt.Point »ñÈ¡Õâ¸ö·½·¨µÄÃèÊöÐÅÏ¢ ²ÎÊý: p - Òƶ¯µÄÄ¿µÄµã (Point) ²ÎÔÄ: Point Class postgresql.geometric.PGpolygon java.lang.Object | +----postgresql.util.PGobject | +----postgresql.geometric.PGpolygon ¹«¹²Àà PGpolygon À©Õ¹ PGobject ʵÏÖ Serializable, Cloneable Õâ¸öÀàÔÚ PostgreSQL ÀïʵÏÖÁË polygon (¶à±ßÐÎ)Êý¾ÝÀàÐÍ. ±äÁ¿ public PGpoint points[] ¶¨Òå polygon (¶à±ßÐÎ)µÄµã ¹¹Ôì(·½·¨) public PGpolygon(PGpoint points[]) ʹÓÃÒ»¸ö PGpoints Êý×é´´½¨Ò»¸ö¶à±ßÐÎ ²ÎÊý: points - ¶¨Òå¶à±ßÐÎ polygon µÄµã public PGpolygon(String s) throws SQLException ²ÎÊý: s - Óà PostgreSQL Óï·¨¶¨ÒåµÄ¶à±ßÐÎ. Å׳ö: SQLException ÔÚת»»Ê§°Üʱ public PGpolygon() Çý¶¯ÐèÒª ·½·¨ public void setValue(String s) throws SQLException ²ÎÊý: s - Óà PostgreSQL Óï·¨¶¨ÒåµÄ¶à±ßÐÎ. Å׳ö: SQLException ÔÚת»»Ê§°Üʱ ÖØÔØ: Àà PGobject ÀïµÄ setValue public boolean equals(Object obj) ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½¸ö¶ÔÏóÏàͬ·µ»ØÕæ (true) ÖØÔØ: Àà PGobject ÀïµÄ equals public Object clone() ±ØÐëÖØÔØÕâ¸ö·½·¨ÒÔ±ãÔÊÐíÕâ¸ö¶ÔÏ󱻿Ë¡ ÖØÔØ: Àà PGobject ÀïµÄ clone public String getValue() ·µ»Ø: postgresql ÆÚÍûµÄÓï·¨±íʾµÄ PGpolygon ×Ö´®. ÖØÔØ: Àà PGobject ÀïµÄ getValue ´ó¶ÔÏó ±ê×¼µÄ JDBC ¹æ·¶ÀïÒ²Ö§³Ö´ó¶ÔÏó. µ«ÊÇ, ÄǸö½Ó¿ÚÓÐÏÞÖÆ, ¶ø PostgreSQL ÌṩµÄ api ÔÊÐí¶Ô¶ÔÏóÄÚÈݵÄËæ»ú·ÃÎÊ, ¾ÍÏóÄÇÊÇÒ»¸ö±¾µØÎļþÒ»Ñù. postgresql.largeobject °üΪ Java ÌṩÁË libpq C ½Ó¿ÚµÄ´ó¶ÔÏó API. Ëü°üº¬Á½¸öÀà, LargeObjectManager, ´¦Àí´´½¨, ´ò¿ªºÍɾ³ý´ó¶ÔÏóµÄÈÎÎñ, ÒÔ¼° LargeObject, ´¦Àí¶ÀÁ¢µÄ¶ÔÏó. Class postgresql.largeobject.LargeObject java.lang.Object | +----postgresql.largeobject.LargeObject ¹«¹²Àà LargeObject À©Õ¹ Object Õâ¸öÀàʵÏÖ postgresql µÄ´ó¶ÔÏó½Ó¿Ú. ËüÌṩÔËÐнӿڵĻù±¾µÄ·½·¨, ÁíÍ⻹ÓÐÒ»¶Ô·½·¨Îª´Ë¶ÔÏóÌṩ InputStream ºÍ OutputStream Àà. ͨ³£, ¿Í»§´úÂ뽫ÔÚ ResultSet ÀïʹÓà getAsciiStream, getBinaryStream, »ò getUnicodeStream ·½·¨, »òÔÚ·ÃÎÊ´ó¶ÔÏó PreparedStatement ʱÓà setAsciiStream, setBinaryStream, »ò setUnicodeStream ·½·¨. µ«ÊÇ, ÓÐʱºòÐèÒªµÍ²ã´ÎµÄ´ó¶ÔÏó·ÃÎÊ·½·¨,ÄÇÊÇ JDBC ¹æ·¶»¹²»Ö§³ÖµÄ. ²Î¿¼ postgresql.largeobject.LargeObjectManager »ñÈ¡ÈçºÎ·ÃÎÊ´ó¶ÔÏóºÍÈçºÎ´´½¨´ó¶ÔÏóµÄÐÅÏ¢. ²ÎÔÄ: LargeObjectManager ±äÁ¿ public static final int SEEK_SET ±êʶ´ÓÒ»¸öÎļþµÄ¿ªÍ·½øÐÐÒ»´ÎËÑË÷ public static final int SEEK_CUR ±êʶ´Óµ±Ç°Î»ÖýøÐÐÒ»´ÎËÑË÷ public static final int SEEK_END ±êʶ´ÓÒ»¸öÎļþµÄ½áβ½øÐÐÒ»´ÎËÑË÷ ·½·¨ public int getOID() ·µ»Ø: ´Ë´ó¶ÔÏóµÄ OID public void close() throws SQLException Õâ¸ö·½·¨¹Ø±Õ¶ÔÏó. ÔÚµ÷ÓÃÕâ¸ö·½·¨ºóÄã²»Äܵ÷ÓÃÕâ¸ö¶ÔÏóÀïµÄÈκη½·¨. Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public byte[] read(int len) throws SQLException ´Ó¶ÔÏó¶ÁȡһЩÊý¾Ý, ²¢ÇÒ×öΪ byte[] Êý×é·µ»Ø ²ÎÊý: len - ¶ÁÈ¡µÄ×Ö½ÚÊý ·µ»Ø: °üº¬¶ÁÈ¡Êý¾ÝµÄ byte[] Êý×é Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public void read(byte buf[], int off, int len) throws SQLException ´Ó¶ÔÏó¶ÁȡһЩÊý¾Ýµ½ÏÖÓÐÊý×é ²ÎÊý: buf - Ä¿µÄÊý×é off - Êý×éÄÚÆ«ÒÆÁ¿ len - ¶ÁÈ¡µÄ×Ö½ÚÊý Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public void write(byte buf[]) throws SQLException Ïò¶ÔÏóÀïдÈëÒ»¸öÊý×é ²ÎÊý: buf - ´ýдÊý×é Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public void write(byte buf[], int off, int len) throws SQLException ´ÓÊý×éÀïдһЩÊý¾Ýµ½¶ÔÏó ²ÎÊý: buf - Ä¿±êÊý×é off - Êý×éÄÚÆ«ÒÆÁ¿ len - дÈë×Ö½ÚÊý Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public void seek(int pos, int ref) throws SQLException ÔÚ¶ÔÏóÄÚ²¿ÉèÖõ±Ç°Î»ÖÃ. Õâ¸öÀàËÆÓÚ±ê×¼ C ¿âÀïµÄ fseek() µ÷ÓÃËüÔÊÐíÄã¶Ô´ó¶ÔÏó½øÐÐËæ»ú·ÃÎÊ. ²ÎÊý: pos - ¶ÔÏóÄÚ²¿µÄλÖà ref - ¿ÉÒÔÊÇ SEEK_SET, SEEK_CUR »ò SEEK_END Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public void seek(int pos) throws SQLException ÔÚ¶ÔÏóÄÚ²¿ÉèÖõ±Ç°Î»ÖÃ. Õâ¸öÀàËÆÓÚ±ê×¼ C ¿âÀïµÄ fseek() µ÷ÓÃËüÔÊÐíÄã¶Ô´ó¶ÔÏó½øÐÐËæ»ú·ÃÎÊ. ²ÎÊý: pos - ¶ÔÏóÄÚ²¿Ïà¶Ô¿ªÍ·µÄλÖà Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public int tell() throws SQLException ·µ»Ø: ¶ÔÏóÄÚ²¿µ±Ç°Î»Öà Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public int size() throws SQLException Õâ¸ö·½·¨²»¹»¸ßЧ, ÒòΪÕÒ³öÒ»¸ö¶ÔÏóµÄΨһ·½·¨ÊÇËÑË÷µ½½áβ, ¼Ç¼µ±Ç°Î»ÖÃ,È»ºó·µ»Øµ½³õʼλÖÃ. ½ñºóÒªÕÒ³öÒ»¸ö¸üºÃµÄ·½·¨. ·µ»Ø: ´ó¶ÔÏóµÄ³ß´ç Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public InputStream getInputStream() throws SQLException ´Ó¶ÔÏó·µ»ØÒ»¸ö InputStream. È»ºóÕâ¸ö InputStream ¾Í¿ÉÒÔÓÃÓÚÈκÎÐèÒªÒ»¸ö InputStream µÄ·½·¨Àï. Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó public OutputStream getOutputStream() throws SQLException ·µ»ØÒ»¸öÕâ¸ö¶ÔÏóµÄ OutputStream È»ºóÕâ¸ö OutputStream ¾Í¿ÉÒÔÓÃÓÚÈκÎÐèÒªÒ»¸ö OutputStream µÄ·½·¨Àï. Å׳ö: SQLException Èç¹û·¢ÉúÁËÊý¾Ý¿â·ÃÎÊ´íÎó Class postgresql.largeobject.LargeObjectManager java.lang.Object | +----postgresql.largeobject.LargeObjectManager ¹«¹²Àà LargeObjectManager À©Õ¹ Object Õâ¸öÀàÐÍʵÏÖ postgresql µÄ´ó¶ÔÏó½Ó¿Ú. ËüÌṩÁËÔÊÐí¿Í»§´úÂë´ÓÊý¾Ý¿âÀï´´½¨, ´ò¿ªºÍɾ³ý´ó¶ÔÏóµÄ·½·¨.ÔÚ´ò¿ªÒ»¸ö¶ÔÏóʱ, ·µ»ØÒ»¸ö postgresql.largeobject.LargeObject µÄʵÀý, ²¢ÇÒËüµÄ·½·¨ÔÊÐí·ÃÎʸöÔÏó. Õâ¸öÀàÖ»ÄÜÓÉ postgresql.Connection ´´½¨ Òª·ÃÎÊÕâ¸öÀà, ʹÓÃÏÂÃæµÄ´úÂëƬ¶Î: import postgresql.largeobject.*; Connection conn; LargeObjectManager lobj; ... code that opens a connection ... lobj = ((postgresql.Connection)myconn).getLargeObjectAPI(); ͨ³£, ¿Í»§´úÂë»áÔÚ ResultSet ÀïʹÓà getAsciiStream, getBinaryStream, »ò getUnicodeStream ·½·¨, »òÔÚ·ÃÎÊ´ó¶ÔÏóµÄ PreparedStatement ÀïʹÓà setAsciiStream, setBinaryStream, »ò setUnicodeStream ·½·¨. µ«ÊÇ, ÓÐʱºòÐèÒªµÍ²ã´ÎµÄ´ó¶ÔÏó·ÃÎÊ·½·¨,ÄÇÊÇ JDBC ¹æ·¶»¹²»Ö§³ÖµÄ. Çë²Î¿¼ postgresql.largeobject.LargeObject »ñÈ¡ÈçºÎ¿ØÖÆ´ó¶ÔÏóÄÚÈݵÄÐÅÏ¢. ²ÎÔÄ: LargeObject ±äÁ¿ public static final int WRITE Õâ¸öģʽ±íÃ÷ÎÒÃÇҪдÈë´ó¶ÔÏó public static final int READ Õâ¸öģʽ±íÃ÷ÎÒÃÇÒª¶ÁÈ¡´ó¶ÔÏó public static final int READWRITE Õâ¸öģʽÊÇȱʡµÄ, ±íÃ÷ÎÒÃÇÒª¶Ô´ó¶ÔÏó½øÐжÁºÍдµÄ²Ù×÷ ·½·¨ public LargeObject open(int oid) throws SQLException Õâ¸ö·½·¨´ò¿ªÒ»¸öÏÖÓеĴó¶ÔÏó, ÒÔÆä OID Ϊ»ù´¡. Õâ¸ö·½·¨¼ÙÉè ÎÒÃÇÐèÒª READ ºÍ WRITE ·ÃÎÊģʽ (ȱʡģʽ). ²ÎÊý: oid - ´ó¶ÔÏó±êʶ (oid) ·µ»Ø: Ìṩ·ÃÎÊ´ó¶ÔÏóµÄ·½·¨µÄ LargeObject ʵÀý Å׳ö: SQLException ³ö´íʱ public LargeObject open(int oid, int mode) throws SQLException Õâ¸ö·½·¨´ò¿ªÒ»¸öÏÖÓеĴó¶ÔÏó, ÒÔÆä OID Ϊ»ù´¡. ²ÎÊý: oid - ´ó¶ÔÏó±êʶ (oid) mode - ´ò¿ªÄ£Ê½ ·µ»Ø: Ìṩ·ÃÎÊ´ó¶ÔÏóµÄ·½·¨µÄ LargeObject ʵÀý Å׳ö: SQLException ³ö´íʱ public int create() throws SQLException Õâ¸ö·½·¨´´½¨Ò»¸ö´ó¶ÔÏó, ·µ»ØËüµÄ OID. Ëü°Ñд´½¨µÄ´ó¶ÔÏóģʽÉèΪȱʡµÄ READWRITE . ·µ»Ø: жÔÏóµÄ oid (¶ÔÏó±êʶ) Å׳ö: SQLException ³ö´íʱ public int create(int mode) throws SQLException Õâ¸ö·½·¨´´½¨Ò»¸ö´ó¶ÔÏó, ·µ»ØËüµÄ OID. ²ÎÊý: mode - Ò»¸öÃèÊöжÔÏó²»Í¬ÊôÐÔµÄλÑÚÂë ·µ»Ø: жÔÏóµÄ oid (¶ÔÏó±êʶ) Å׳ö: SQLException ³ö´íʱ public void delete(int oid) throws SQLException Õâ¸ö·½·¨É¾³ýÒ»¸ö´ó¶ÔÏó. ²ÎÊý: oid - ÃèÊöҪɾ³ýµÄ¶ÔÏó Å׳ö: SQLException ³ö´íʱ public void unlink(int oid) throws SQLException Õâ¸ö·½·¨É¾³ýÒ»¸ö´ó¶ÔÏó. Õâ¸ö·½·¨µÈͬÓÚ delete ·½·¨, ²¢ÇÒ×÷ΪÀàËÆʹÓà unlink µÄ C API ³öÏÖ. ²ÎÊý: oid - ÃèÊöҪɾ³ýµÄ¶ÔÏó Å׳ö: SQLException ³ö´íʱ ¶ÔÏóµÄ´®Ðл¯ (Object Serialisation)PostgreSQL ²»ÊÇͨ³£µÄ SQL Êý¾Ý¿â. Ëü±ÈÆäËûÊý¾Ý¿âÓиüÇ¿µÄ¿ÉÀ©Õ¹ÐÔ, ²¢ÇÒÖ§³ÖÃæÏò¶ÔÏóµÄÌØÐÔ, ÕâÒ»µãÁí postgresql ·Ç³£¶ÀÌØ. ÕâЩÌØÐÔµÄÒ»¸ö½á¹û¾ÍÊÇÄã¿ÉÒÔÓµÓÐÒ»¸öÒýÓÃÆäËû±íµÄÐеıí, ÀýÈç: test=> create table users (username name,fullname text); CREATE test=> create table server (servername name,adminuser users); CREATE test=> insert into users values ('peter','Peter Mount'); INSERT 2610132 1 test=> insert into server values ('maidast',2610132::users); INSERT 2610133 1 test=> select * from users; username|fullname --------+-------------- peter |Peter Mount (1 row) test=> select * from server; servername|adminuser ----------+--------- maidast | 2610132 (1 row) ºÃ, ÉÏÃæµÄÀý×Ó±íÃ÷ÎÒÃÇ¿ÉÒÔ°ÑÒ»¸ö±íµ±×÷×Ö¶ÎÀ´ÓÃ,²¢ÇÒ¸ÃÐÐµÄ oid Öµ±£´æÔÚ¸Ã×Ö¶ÎÀï. ÄÇôÕâЩÓë Java ÓÐʲô¹ØϵÄØ? ÔÚ Java Àï, Ö»ÒªÒ»¸ö¶ÔÏóµÄÀàʵÏÖÁË java.io.Serializable ½Ó¿Ú, Äã¾Í¿ÉÒÔ°ÑÒ»¸ö¶ÔÏó´æ´¢³ÉÒ»¸ö Stream (Á÷). Õâ¸ö¹ý³Ì³ÆΪ¶ÔÏó´®Ðл¯ (Object Serialization), ¿ÉÒÔÓÃÓÚ½«¸´ÔӵĶÔÏó´æÈëÊý¾Ý¿â. ÏÖÔÚ, ÔÚ JDBC Àï, Ä㽫²»µÃ²»Ê¹ÓÃÒ»¸ö LargeObject À´´æ´¢ËüÃÇ.²»¹ý, Äã²»ÄÜÔÚÕâЩ¶ÔÏóÉÏÖ´Ðвéѯ. postgresql.util.Serialize Àà×öµÄ¹¤×÷¾ÍÊÇÌṩһ¸ö°ÑÒ»¸ö¶ÔÏó´æ´¢Îª±íµÄ·½·¨, ²¢ÇÒ´ÓÒ»¸ö±íÖмìË÷³ö¸Ã¶ÔÏó. ´ó¶àÊýÇé¿öÏÂ, Ä㽫²»ÐèÒªÖ±½Ó·ÃÎÊÕâ¸öÀà, µ«ÊÇÄãÒªÓõ½ PreparedStatement.setObject() ºÍ ResultSet.getObject() ·½·¨. ÕâЩ·½·¨½«¶ÔÕÕÊý¾Ý¿âÀïµÄ±í¼ì²é¶ÔÏóÀàµÄÃû³Æ, Èç¹ûÕÒµ½Ò»¸öÆ¥ÅäµÄ, Ëü¾Í¼ÙÉè¸Ã¶ÔÏóÊÇÒ»¸ö´®Ðл¯Á˵ĶÔÏó È»ºó´Ó¸Ã±íÖмìË÷³ö¶ÔÏóÀ´. ÔÚÕâô×öµÄͬʱ, Èç¹û¸Ã¶ÔÏó°üº¬ÆäËû´®Ðл¯¶ÔÏó ÄÇôËüµÝ¹éµØ¼ìË÷Õâ¸öǶÌ×Ê÷. ÌýÆðÀ´ºÜ¸´ÔÓ? ʵ¼ÊÉÏ, Ëü±ÈÎÒдµÄÒª¼òµ¥ - Ö»ÊǽâÊÍÆðÀ´À§ÄÑЩ. Äã¿ÉÄÜ·ÃÎÊÕâ¸öÀàµÄΨһ»ú»áÊÇʹÓà create() ·½·¨. ÕâЩ²»»á±»Çý¶¯Ê¹ÓÃ, Ö»ÊǶÔÊý¾Ý¿âÖ´ÐÐÒ»Ìõ»ò¸ü¶àÌõ "create table" Óï¾ä - ÒÔÄãÏëÒª´®Ðл¯µÄ±í»ò Java ¶ÔÏóΪ»ù´¡. Ŷ, ×îºóÒ»¼þÊÂÇé. Èç¹ûÄãµÄ¶ÔÏó°üº¬ÏóÕâÑùµÄÒ»ÐÐ: public int oid; ÄÇô, µ±¶ÔÏó´Ó±íÀï¼ìË÷³öÀ´Ê±, Ëü±»ÉèÖÃΪ±íÀïµÄ oid. ÄÇô, Èç¹û¸Ã¶ÔÏó±»ÐÞ¸Ä, È»ºóÖØд®Ðл¯, ÄÇôÏÖÓеļǼ½«±»¸üÐÂ. Èç¹û²»´æÔÚ oid ±äÁ¿, ÄÇôµ±¶ÔÏó´®Ðл¯Ê±, Ëü×ÜÊDZ»²åÈë±íÖÐ, ¶øÈκÎÏÖ´æµÄ¼Ç¼½«±£Áô. ÔÚ´®Ðл¯Ö®Ç°°Ñ oid ÉèΪ 0 ½«Í¬Ñùµ¼Ö¶ÔÏó±»²åÈë.ÕâÑù¾ÍʹÔÚ±íÖи´ÖƶÔÏó³ÉΪ¿ÉÄÜ. Class postgresql.util.Serialize java.lang.Object | +----postgresql.util.Serialize ¹«¹²Àà Serialize À©Õ¹ Object Õâ¸öÀàʹÓà PostgreSQL µÄÃæÏò¶ÔÏóµÄÌØÐÔ´æ´¢ Java ¶ÔÏó. Ëüͨ¹ý°Ñ Java Class µÄÃû³ÆÓ³Éäµ½Ò»¸öÊý¾Ý¿âÀïµÄ±íʵÏÖÕâÒ»µã. ÕâÑù, Õâ¸öбíÀïµÄÿÌõ¼Ç¼¶¼´ú±íÒ»¸öÕâ¸öÀàµÄ´®Ðл¯Á˵ÄʵÀý. ÒòΪÿÌõ¼Ç¼¶¼ÓÐÒ»¸ö OID (Object IDentifier ¶ÔÏó±êʶ), Õâ¸ö OID ¿ÉÒÔ±»°üº¬ÔÚÆäËû±íÀï. ÔÚÕâÀïÑÝʾʵÔÚÊÇÌ«¸´ÔÓÁË, ½«ÔÚÖ÷ÎĵµÀï¼Ç¼¸ü¶àµÄϸ½Ú. ¹¹Ôì(·½·¨) public Serialize(Connection c, String type) throws SQLException Õâ¸ö·½·¨´´½¨Ò»¸ö¿ÉÒÔÓÃÓÚ´ÓÒ»¸ö PostgreSQL ±íÀï´®Ðл¯Ò»¸ö Java ¶ÔÏóµÄʵÀý. ·½·¨ public Object fetch(int oid) throws SQLException Õâ¸ö·½·¨Í¨¹ý¸ø³öµÄ OID ´ÓÒ»¸ö±íÀïץȡһ¸ö¶ÔÏó. ²ÎÊý: oid - ¶ÔÏóµÄ oid (¶ÔÏó±êʶ) ·µ»Ø: Óë oid Ïà¹ØµÄ Object (¶ÔÏó) Å׳ö: SQLException ³ö´íʱ public int store(Object o) throws SQLException Õâ¸ö·½·¨°ÑÒ»¸ö¶ÔÏó´æÈëÒ»¸ö±íÖÐ, ·µ»ØËüµÄ OID. Èç¹û¶ÔÏóÓÐÒ»¸ö int (ÕûÊý)½Ð OID, ²¢ÇÒ > 0, ÄÇôÄǸöÖµ ÓÃÓÚ OID, ²¢ÇÒ±í½«±»¸üÐÂ. Èç¹û OID µÄÖµÊÇ 0, ÄÇô½«´´½¨Ò»¸öÐÂÐÐ, ¶øÇÒ OID µÄÖµ½«±»ÉèÖÃÔÚ¶ÔÏóÀï(¶ÔÏó±ØÐëʵÏÖ´®Ðл¯). ÕâÑù¾Íʹһ¸ö¶ÔÏóÔÚÊý¾Ý¿âÀïµÄÖµ±»¸üгÉΪ¿ÉÄÜ. Èç¹û¶ÔÏóûÓÐÃûΪ OID µÄ int (ÕûÊý), ÄÇô¶ÔÏó±»´æ´¢. ²»¹ý, Èç¹û¶ÔÏóËæºó±»¼ìË÷, ¸Ä¶¯²¢ÇÒÖØР´æ´¢, ÄÇôËüµÄÐÂ״̬½«±»¸½¼Óµ½±íÉÏ, ²¢ÇÒ½«²»¸²¸ÇÔÀ´µÄ¼Ç¼. ²ÎÊý: o - ´ý´æ´¢µÄ Object ¶ÔÏó (±ØÐëʵÏÖ´®Ðл¯) ·µ»Ø: ´æ´¢Á˵ĶÔÏóµÄ oid Å׳ö: SQLException ³ö´íʱ public static void create(Connection con, Object o) throws SQLException Õâ¸ö·½·¨²»±»Çý¶¯Ê¹ÓÃ, µ«ÊÇËü´´½¨Ò»¸ö±í, ¸ø³öÒ»¸ö¿É´®Ðл¯µÄ Java ¶ÔÏó. Ó¦¸ÃÔÚ´®Ðл¯ÈκζÔÏó֮ǰʹÓÃËü. ²ÎÊý: c - ÓëÊý¾Ý¿âµÄ Connection (Áª½Ó) o - ±íËùÒÀÀµµÄ Object (¶ÔÏó) Å׳ö: SQLException ³ö´íʱ ·µ»Ø: Óë Object (¶ÔÏó)Ïà¹ØµÄ oid Å׳ö: SQLException ³ö´íʱ public int store(Object o) throws SQLException Õâ¸ö·½·¨´æ´¢Ò»¸ö¶ÔÏóµ½±íÀïÃæ, ·µ»Ø¶ÔÏóµÄ OID. Èç¹û¶ÔÏóÓÐÒ»¸ö int (ÕûÊý)½Ð OID, ²¢ÇÒ > 0, ÄÇôÄǸöÖµ ÓÃÓÚ OID, ²¢ÇÒ±í½«±»¸üÐÂ. Èç¹û OID µÄÖµÊÇ 0, ÄÇô½«´´½¨Ò»¸öÐÂÐÐ, ¶øÇÒ OID µÄÖµ½«±»ÉèÖÃÔÚ¶ÔÏóÀï. ÕâÑù¾Íʹһ¸ö¶ÔÏóÔÚÊý¾Ý¿âÀïµÄÖµ±»¸üгÉΪ¿ÉÄÜ. Èç¹û¶ÔÏóûÓÐÃûΪ OID µÄ int (ÕûÊý), ÄÇô¶ÔÏó±»´æ´¢. ²»¹ý, Èç¹û¶ÔÏóËæºó±»¼ìË÷, ¸Ä¶¯²¢ÇÒÖØР´æ´¢, ÄÇôËüµÄÐÂ״̬½«±»¸½¼Óµ½±íÉÏ, ²¢ÇÒ½«²»¸²¸ÇÔÀ´µÄ¼Ç¼. ²ÎÊý: o - Òª´æ´¢µÄ Object (¶ÔÏó) (±ØÐëʵÏÖ´®Ðл¯) ·µ»Ø: ´æ´¢Á˵ĶÔÏóµÄ oid Å׳ö: SQLException ³ö´íʱ public static void create(Connection con, Object o) throws SQLException Õâ¸ö·½·¨²»±»Çý¶¯Ê¹ÓÃ, µ«ÊÇËü´´½¨Ò»¸ö±í, ¸ø³öÒ»¸ö¿É´®Ðл¯µÄ Java ¶ÔÏó. Ó¦¸ÃÔÚ´®Ðл¯ÈκζÔÏó֮ǰʹÓÃËü. ²ÎÊý: c - ÓëÊý¾Ý¿âµÄ Connection (Áª½Ó) o - ±íËùÒÀÀµµÄ Object (¶ÔÏó) Å׳ö: SQLException ³ö´íʱ public static void create(Connection con, Class c) throws SQLException Õâ¸ö·½·¨²»±»Çý¶¯Ê¹ÓÃ, µ«ÊÇËü´´½¨Ò»¸ö±í, ¸ø³öÒ»¸ö¿É´®Ðл¯µÄ Java ¶ÔÏó. Ó¦¸ÃÔÚ´®Ðл¯ÈκζÔÏó֮ǰʹÓÃËü. ²ÎÊý: c - ÓëÊý¾Ý¿âµÄ Connection (Áª½Ó) o - ±íËùÒÀÀµµÄ Object (¶ÔÏó) Å׳ö: SQLException ³ö´íʱ public static String toPostgreSQL(String name) throws SQLException Õâ¸ö·½·¨°ÑÒ»¸ö Java ÀàÃû³Æת»»³ÉÒ»¸ö postgresql ±í, ͨ¹ý °Ñ . Ìæ»»³É _ ÒòΪÕâ¸öÔÒò, Ò»¸öÀàµÄÃû³Æ²»ÄÜ°üº¬ _ . ÁíÍâÒ»¸öÏÞÖÆ, ÊÇÕû¸ö±íÃû (°üÀ¨ °üÃû) ²»Äܳ¤ÓÚ 31 ¸ö×Ö·û (Ò»¸öÔ´ÓÚ PostgreSQL µÄÏÞÖÆ ). ²ÎÊý: name - ÀàÃû³Æ ·µ»Ø: PostgreSQL ±íÃû³Æ Å׳ö: SQLException ³ö´íʱ public static String toClassName(String name) throws SQLException Õâ¸ö·½·¨°ÑÒ»¸ö postgresql ±íת»»³ÉÒ»¸ö Java ÀàÃû³Æ, ͨ¹ý°Ñ _ Ìæ»»³É . ²ÎÊý: name - PostgreSQL ±íÃû³Æ ·µ»Ø: ÀàÃû³Æ Å׳ö: SQLException ³ö´íʱ ¹¤¾ßÀà postgresql.util °ü°üº¬±»Ö÷Çý¶¯ÄÚ²¿Ê¹ÓõÄÀàÒÔ¼°ÆäËûÀ©Õ¹. Class postgresql.util.PGmoney java.lang.Object | +----postgresql.util.PGobject | +----postgresql.util.PGmoney ¹«¹²Àà PGmoney À©Õ¹ PGobject ʵÏÖ Serializable, Cloneable Õâ¸öÀàʵÏÖÒ»¸ö²Ù×Ý PostgreSQL money (»õ±Ò)ÀàÐ͵ÄÀà ±äÁ¿ public double val ×ֶεÄÖµ ¹¹Ôì(·½·¨) public PGmoney(double value) ²ÎÊý: value - ×Ö¶ÎÖµ public PGmoney(String value) throws SQLException Õâ¸ö·½·¨Ö÷ÒªÊDZ»´ÓÆäËûÀàÐÍÀïÃæµ÷Óà -- µ±»õ±Ò±»Ç¶Èëµ½ÄÇЩÀàÐ͵Ķ¨ÒåÀïÃæµÄʱºò. ²ÎÊý: value - PostgreSQL µÄÓï·¨¶¨ÒåµÄ»õ±Ò×Ö´® public PGmoney() Çý¶¯ÐèÒª ·½·¨ public void setValue(String s) throws SQLException ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½¸ö¶ÔÏóÏàͬ·µ»ØÕæ (true) ÖØÔØ: Àà PGobject ÀïµÄ equals public boolean equals(Object obj) ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½¸ö¶ÔÏóÏàͬ·µ»ØÕæ (true) ÖØÔØ: Àà PGobject ÀïµÄ equals public Object clone() ±ØÐëÖØÔØÕâ¸ö·½·¨ÒÔ±ãÔÊÐíÕâ¸ö¶ÔÏ󱻿Ë¡ ÖØÔØ: Àà PGobject ÀïµÄ clone public String getValue() ·µ»Ø: postgresql Ï£ÍûµÄ»õ±Ò¸ñʽ×Ö´® ÖØÔØ: Àà PGobject ÀïµÄ getValue Class postgresql.util.PGobject java.lang.Object | +----postgresql.util.PGobject ¹«¹²Àà PGobject À©Õ¹ Object ʵÏÖ Serializable, Cloneable Õâ¸öÀàÓÃÓÚÃèÊö±ê×¼ JDBC ²»ÈÏʶµÄÊý¾ÝÀàÐÍ ¶Ô postgresql.Connection µÄµ÷ÓÃÔÊÐíÒ»¸öÓëÕâ¸öÀà¹ØÁªµÄÀàÓëÒ»¸öÃüÃûÀàÐÍÏà¹ØÁª. Õâ¾ÍÊÇ postgresql.geometric °ü¹¤×÷µÄÔÀí. ResultSet.getObject() ¶ÔÈκÎÎÞ·¨Ê¶±ðÓµÓÐ×ÔÉí¿ØÖÆÆ÷µÄÊý¾ÝÀàÐͶ¼½«·µ»ØÕâ¸öÀà. Òò´Ë, ÈκΠpostgresql Êý¾ÝÀàÐͶ¼±»Ö§³Ö. ¹¹Ôì(·½·¨) public PGobject() Õâ¸ö·½·¨±» postgresql.Connection.getObject() µ÷ÓÃÀ´´´½¨¶ÔÏó ·½·¨ public final void setType(String type) Õâ¸ö·½·¨ÉèÖÃÕâ¸ö¶ÔÏóµÄÀàÐÍ. Ëü²»Äܱ»×ÓÀàÀ©Õ¹, Òò´ËËüÊÇ final ²ÎÊý: type - Ò»¸öÃèÊö¶ÔÏóÀàÐ͵Ä×Ö´® public void setValue(String value) throws SQLException Õâ¸ö·½·¨ÉèÖöÔÏóµÄÖµ. Ëü±ØÐë±»¸²¸Ç. ²ÎÊý: value - Ò»¸ö´ú±í¶ÔÏóÖµµÄ×Ö´® Å׳ö: SQLException Èç¹ûÊýÖµ¶ÔÓÚ´ËÀàÐÍ·Ç·¨ public final String getType() ÒòΪÔÚ¶ÔÏóµÄÉú´æÆÚÀïËü²»Äܱ»¸Ä±ä, ËùÒÔÊÇ final. ·µ»Ø: ¶ÔÏóµÄÀàÐÍÃû public String getValue() Õâ¸ö±ØÐë±»ÖØÔØ, ÒÔ±ãÒÔ postgresql ÒªÇóµÄ¸ñʽ·µ»Ø¶ÔÏóµÄÖµ. ·µ»Ø: ¶ÔÏóÖµ public boolean equals(Object obj) Õâ¸ö·½·¨±ØÐëÖØÔØ, ÒÔÔÊÐí¶Ô¶ÔÏóµÄ±È½Ï ²ÎÊý: obj - Òª±È½ÏµÄ¶ÔÏó ·µ»Ø: Èç¹ûÁ½¸ö¶ÔÏóÏàͬ·µ»ØÕæ (true) ÖØÔØ: Àà Object ÀïµÄ equals public Object clone() ±ØÐëÖØÔØÕâ¸ö·½·¨ÒÔ±ãÔÊÐíÕâ¸ö¶ÔÏ󱻿Ë¡ ÖØÔØ: Àà Object ÀïµÄ clone public String toString() Õâ¸ö·½·¨ÔÚÕâÀﶨÒå, ÕâÑùÓû§´úÂë¾Í²»±ØÖØÔØËü. ·µ»Ø: ÒÔ postgresql Ô¤ÆÚµÄÓï·¨±íʾµÄ¶ÔÏóÖµ. ÖØÔØ: Àà Object ÀïµÄ toString Class postgresql.util.PGtokenizer java.lang.Object | +----postgresql.util.PGtokenizer ¹«¹²Àà PGtokenizer À©Õ¹ Object Õâ¸öÀàÓÃÓÚ°Ñ postgres µÄÎı¾Êä³ö±êÖ¾»¯. ÎÒÃÇ¿ÉÒÔʹÓà StringTokenizer À´×÷ÕâЩÊÂ, ²»¹ýÎÒÃÇÐèÒª²Ù×÷ '(' ')' '[' ']' '<' ºÍ '>' µÄǶÌ×, ÒòΪÕâЩ±»¼¸ºÎÊý¾ÝÀàÐÍʹÓÃ. Õâ¸ö·½·¨Ö÷Òª±»¼¸ºÎÀàʹÓÃ, µ«ÊÇ¿ÉÒÔÓÃÓÚ·ÖÎöÈÎºÎ´Ó postgresql Êä³öµÄ¿Í»§Êä³öÊý¾ÝÀàÐÍ. ²ÎÔÄ: PGbox, PGcircle, PGlseg, PGpath, PGpoint, PGpolygon ¹¹Ôì(·½·¨) public PGtokenizer(String string, char delim) ´´½¨Ò»¸ö±êÖ¾·ÖÎöÆ÷. ²ÎÊý: string - °üº¬±êÖ¾µÄ×Ö´® delim - µ¥¸ö×Ö·û, ÓÃÓÚ·Ö¸ô±êÖ¾ ·½·¨ public int tokenize(String string, char delim) Õâ¸ö·½·¨ÓÃÒ»¸öеÄ×Ö´®»ò·Ö¸ô·ûÖØÖñêÖ¾·ÖÎöÆ÷. ²ÎÊý: string - °üº¬±êÖ¾µÄ×Ö´® delim - µ¥¸ö×Ö·û, ÓÃÓÚ·Ö¸ô±êÖ¾ public int getSize() ·µ»Ø: ¿ÉµÃµÄ±êÖ¾ÊýÁ¿ public String getToken(int n) ²ÎÊý: n - ±êÖ¾ÊýÁ¿ ( 0 ... getSize()-1 ) ·µ»Ø: ±êÖ¾Öµ public PGtokenizer tokenizeToken(int n, char delim) Õâ¸ö·½·¨·µ»ØÒ»¸öеĻùÓÚÎÒÃǵıêÖ¾Ö®Ò»µÄ±êÖ¾·ÖÎöÆ÷. ¼¸ºÎÀàÐÍÓÃÕâ¸ö·½·¨´¦ÀíǶÌ׵ıêÖ¾ (ͨ³£ÊÇ PGpoint). ²ÎÊý: n - ±êÖ¾Êý ( 0 ... getSize()-1 ) delim - ËùÓõķָô·û ·µ»Ø: Ò»¸öеĻùÓڸñêÖ¾µÄ PGtokenizer ʵÀý public static String remove(String s, String l, String t) Õâ¸ö·½·¨´ÓÒ»¸ö×Ö´®É¾È¥Ç°µ¼/½áβ×Ö´® ²ÎÊý: s - Ô´×Ö´® l - Ҫɾ³ýµÄÇ°µ¼×Ö´® t - Ҫɾ³ýµÄ½áβ×Ö´® ·µ»Ø: ɾȥǰµ¼/½áβ×Ö´®µÄ×Ö´® public void remove(String l, String t) Õâ¸ö·½·¨É¾È¥ËùÓбêÖ¾µÄÇ°µ¼/½áβ×Ö´® ²ÎÊý: l - Ҫɾ³ýµÄÇ°µ¼×Ö´® t - Ҫɾ³ýµÄ½áβ×Ö´® public static String removePara(String s) ´Ó×Ö´®¿ªÍ·ºÍ½áβɾ³ý ( ºÍ ) ²ÎÊý: s - Ҫɾ³ý ( ºÍ ) µÄ×Ö´® ·µ»Ø: ûÓÐ ( »ò ) µÄ×Ö´® public void removePara() ´Ó±êÖ¾¿ªÍ·ºÍ½áβɾ³ý ( ºÍ ) ·µ»Ø: ûÓÐ ( »ò ) µÄ×Ö´® public static String removeBox(String s) ´Ó×Ö´®¿ªÍ·ºÍ½áβɾ³ý [ ºÍ ] ²ÎÊý: s - Ҫɾ³ý [ ºÍ ] µÄ×Ö´® ·µ»Ø: ûÓÐ [ »ò ] µÄ×Ö´® public void removeBox() ´Ó±êÖ¾¿ªÍ·ºÍ½áβɾ³ý [ ºÍ ] ·µ»Ø: ûÓÐ [ »ò ] µÄ×Ö´® public static String removeAngle(String s) ´Ó×Ö´®¿ªÍ·ºÍ½áβɾ³ý < ºÍ > ²ÎÊý: s - Ҫɾ³ý < ºÍ > µÄ×Ö´® ·µ»Ø: ûÓÐ < »ò > µÄ×Ö´® public void removeAngle() ´Ó±êÖ¾¿ªÍ·ºÍ½áβɾ³ý < ºÍ > ·µ»Ø: ûÓÐ < »ò > µÄ×Ö´® Class postgresql.util.Serialize Õâ¸öÀàÔÚÇ°Ãæ Object Serialisation (¶ÔÏó´®Ðл¯)ÒѾÓÐÎĵµÁË. Class postgresql.util.UnixCrypt java.lang.Object | +----postgresql.util.UnixCrypt ¹«¹²Àà UnixCrypt À©Õ¹ Object Õâ¸öÀàΪÎÒÃÇÌṩÁËÔÚͨ¹ýÍøÂçÁ÷´«Êä¿ÚÁîʱµÄ¼ÓÃܵŦÄÜ °üº¬¾²Ì¬·½·¨ÓÃÓÚ¼ÓÃÜ¿ÚÁîºÍÓë Unix ¼ÓÃܵĿÚÁî±È½Ï. ²ÎÔÄ John Dumas µÄ Java Crypt (¼ÓÃÜ)Ò³Ãæ»ñÈ¡Ôʼ´úÂë. http://www.zeh.com/local/jfd/crypt.html ·½·¨ public static final String crypt(String salt, String original) ¼ÓÃܸø³öÁËÃ÷ÎÄ¿ÚÁîºÍÒ»¸ö"ÖÖ×Ó"("salt"£©µÄ¿ÚÁî. ²ÎÊý: salt - Ò»¸öÁ½×Ö·û×Ö´®´ú±íµÄËùÓõÄÖÖ×Ó£¬¡¡ÓÃÒÔÏò¼ÓÃÜÒýÇæ˵Ã÷¼ÓÃܵIJ»Í¬·½Ê½£® Èç¹ûÄãÒªÉú³ÉÒ»¸öеÄÃÜÎÄÄÇôÕâ¸öÖµÓ¦¸ÃÊÇËæ»úÉú³ÉµÄ. original - ´ý¼ÓÃÜ¿ÚÁî. ·µ»Ø: Ò»¸ö×Ö´®, ÏÈÊÇ 2 ×Ö·ûµÄÖÖ×Ó, È»ºó¸ú×ÅÃÜÎÄ¿ÚÁî. public static final String crypt(String original) ¼ÓÃܸø³öµÄÃ÷ÎÄ¿ÚÁî. Õâ¸ö·½·¨Óà 'java.util.Random' ÀàÉú³ÉÒ»¸öËæ»úµÄÖÖ×Ó. ²ÎÊý: original - Òª¼ÓÃܵĿÚÁî. ·µ»Ø: Ò»¸ö×Ö´®, ÏÈÊÇ 2 ×Ö·ûµÄÖÖ×Ó, È»ºó¸ú×ÅÃÜÎÄ¿ÚÁî. public static final boolean matches(String encryptedPassword, String enteredPassword) ¼ì²é enteredPassword ¿ÉÒÔ¼ÓÃÜ³É encryptedPassword. ²ÎÊý: encryptedPassword - encryptedPassword (¿ÚÁîÃÜÎÄ). Í·Á½×Ö·û ¼ÙÉèΪÖÖ×Ó. Õâ¸ö×Ö·û´®½«Óë Unix Îļþ /etc/passwd ÀïµÄÒ»Ñù. enteredPassword - Óû§ÊäÈëµÄ¿ÚÁî (»òÕßÆäËûÐèÒªµÄ¶«Î÷). ·µ»Ø: Èç¹û¿ÚÁî±»ÈÏΪÊÇÕýÈ·µÄÔò·µ»ØÕæ (true). ÔÚÒ»¸ö¶à Threaded (Ïß³Ì) »ò Servlet (·þÎñÆ÷СӦÓÃ)»·¾³ÀïʹÓÃÇý¶¯ Ðí¶à JDBC Çý¶¯µÄÒ»¸ö¹²Í¬ÎÊÌâÊÇËüÃÇÔÚÈÎÒâʱ¿ÌÒ»¸öÏß³ÌÖ»ÄÜʹÓÃÒ»¸öÁª½Ó (Connection) - ·ñÔò¿ÉÄÜÒ»¸öÔÚ·¢ËÍÒ»¸ö²éѯ¶øÁíÒ»¸öÏß³ÌÕýÔÚ½ÓÊܽá¹û, Õâ¸öÏÖÏó¶ÔÊý¾Ý¿âÒýÇæÊÇÒ»¸öºÜÔã¸âµÄÊÂÇé. PostgreSQL 6.4, ¶ÔÕû¸öÇý¶¯¶¼ÊÇḬ̈߳²È«µÄ. ±ê×¼ JDBC ÔÚ 6.3.x ÀïÊÇḬ̈߳²È«µÄ, µ«ÊÇ Fastpath API ²»ÊÇ. ËùÒÔ, Èç¹ûÄãµÄÓ¦ÓÃҪʹÓöàÏß³Ì (¿ÉÄÜÊÇ×îÓÅÃÀµÄÒ»ÖÖÐÎʽ),ÄÇôÄã²»±Ø¿¼ÂÇÈÎÒâʱ¿ÌÖ»ÔÊÐí Ò»¸öÏß³ÌʹÓÃÊý¾Ý¿âµÄ¸´ÔÓÉè¼Æ. Èç¹ûÒ»¸öÏß³ÌÔÚÆäËûÏß³ÌÕýÔÚʹÓÃÊý¾Ý¿âʱÊÔͼ·ÃÎÊÊý¾Ý¿â, ÄÇôËü½«µÈµ½ÁíÒ»¸öÏß³ÌÍê³Éµ±Ç°²Ù×÷Ö®ºó½øÐÐ. Èç¹ûÕâÊÇÒ»¸ö±ê×¼µÄ SQL Óï¾ä, ÄÇô¸Ã²Ù×÷¾ÍÊÇ·¢Ë͸ÃÓï¾ä,²¢¼ìË÷ÈκΠResultSet (ÍêÕûµÄ). Èç¹ûÕâÊÇÒ»¸ö Fastpath µ÷Óà (ÀýÈç: ´ÓÒ»¸ö´ó¶ÔÏóÀï¶ÁÈ¡Ò»¸öÊý¾Ý¿é), ÄÇôÕâʱ¾Í·¢ËÍ, ºÍ½ÓÊÕ¸ÃÊý¾Ý¿é. Õâ¶Ô¿Í»§´óСӦÓö¼ºÜºÃ, µ«ÊÇ¿ÉÄÜÔì³É·þÎñÆ÷СӦÓà (servlets) µÄÐÔÄÜÎÊÌâ. ¶ÔÓÚ servlets, ÄãÔÚÁª½ÓÉÏ¿ÉÄÜ»áÓкܳÁÖصĸººÉ. Èç¹ûÄãÓкü¸¸öÏß³ÌÖ´Ðвéѯ, ÄÇôËüÃÇÿ¸ö¶¼ÔÝÍ£¿É²»ÊÇÄãÏë¿´µ½µÄ. Òª½â¾öÕâ¸öÎÊÌâ, ÎÒÃǽ¨ÒéÄã´´½¨Ò»¸öÁª½Ó³Ø. (pool of Connections) µ±Ò»¸öÏß³ÌÐèҪʹÓÃÊý¾Ý¿â, ËüÏò¹ÜÀíÀàÇëÇóÒ»¸öÁª½Ó (Connection). ¹ÜÀíÆ÷¸³Óè¸ÃÏß³ÌÒ»¸ö¿ÕÏÐÁª½Ó, È»ºó°ÑËü±ê¼ÇΪæ. Èç¹ûûÓпÕÏÐÁª½Ó, ¹ÜÀíÆ÷¾Í´ò¿ªÒ»¸ö. Ò»µ©Ïß³ÌÍê³ÉÊý¾Ý¿âʹÓÃ, ¸ÃḬ̈߳ÑÁª½Ó·µ»Ø¸ø¹ÜÀíÆ÷, ¹ÜÀíÆ÷¼È¿ÉÒԹرոÃÁª½Ó, Ò²¿ÉÒÔ °ÑËü¼Óµ½Áª½Ó³ØÀï. ¹ÜÀíÆ÷ͬÑù»¹¼ì²éÁª½ÓÊÇ·ñÈÔÈ»»÷»î, Èç¹ûÁª½ÓËÀÍöÁ˾ͰÑËü´ÓÁª½Ó³Øɾ³ý. ËùÒÔ, ¶ÔÓÚ·þÎñÆ÷СӦÓà ( servlets ), Ñ¡Ôñµ¥Áª½Ó»¹ÊÇÁª½Ó³ØÊÇÄãµÄÔðÈÎ. ʹÓÃÁª½Ó³ØµÄÓŵãÊÇÏ̲߳»»á³ÉΪµ¥¸öÍøÂçÁª½ÓµÄÆ¿¾±. ȱµãÊÇÕâÑù×öÔö¼ÓÁË·þÎñÆ÷¶Ë µÄ¸ººÉ, ÒòΪ¶Ôÿ¸öÁª½Ó¶¼Òª´´½¨Ò»¸öºó¶Ë½ø³Ì. Ñ¡ÔñºÎÖÖ·½Ê½ÊÇÄãºÍÄãµÄÓ¦ÓõÄÐèÇó¾ö¶¨µÄ.