Replace UDF´Â ¿À¹ö·ÎµåµÇ°í UDFÀÇ »ç¿ë ¹æ¹ý¿¡ µû¶ó ´Ù¸¥ Çü½ÄÀ» °®½À´Ï´Ù. Çü½ÄÀº ´ÙÀ½°ú °°½À´Ï´Ù.
Çü½Ä 1: Ŭ¶óÀÌ¾ðÆ® ¹öÆÛ ¶Ç´Â Ŭ¶óÀÌ¾ðÆ® ÆÄÀÏ¿¡¼ ¿ÀºêÁ§Æ®¸¦ °»½ÅÇϰí ÇØ´ç ÁÖ¼®À» °»½ÅÇÕ´Ï´Ù.
Replace( handle, /* object handle */ content, /* object content */ source_format, /* source format */ target_file, /* target file name for storage in file */ comment /* user comment */ );
Çü½Ä 2: ¼¹ö ÆÄÀÏ¿¡¼ ¿ÀºêÁ§Æ®¸¦ °»½ÅÇϰí ÇØ´ç ÁÖ¼®À» °»½ÅÇÕ´Ï´Ù.
Replace( handle, /* object handle */ source_file, /* server file name */ source_format, /* source format */ stortype, /* MMDB_STORAGE_TYPE_EXTERNAL=store */ /* in file server*/ /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/ comment /* user comment */ );
Çü½Ä 3: Ŭ¶óÀÌ¾ðÆ® ¹öÆÛ ¶Ç´Â Ŭ¶óÀÌ¾ðÆ® ÆÄÀÏ¿¡¼ »ç¿ëÀÚ Á¦°ø ¼Ó¼ºÀ» »ç¿ëÇÏ¿© ¿ÀºêÁ§Æ®¸¦ ´ëüÇϰí ÁÖ¼®À» °»½ÅÇÕ´Ï´Ù.
Replace( handle, /* object handle */ content, /* object content */ target_file, /* target file name for storage in file */ /* or NULL for storage in table as BLOB */ comment, /* user comment */ attrs, /* user-supplied attributes */ thumbnail /* thumbnail */ );
Çü½Ä 4: ¼¹ö ÆÄÀÏ¿¡¼ »ç¿ëÀÚ Á¦°ø ¼Ó¼ºÀ¸·Î ¿ÀºêÁ§Æ®¸¦ ÀúÀåÇÕ´Ï´Ù.
Replace( handle, /* object handle */ source_file, /* server file name */ stortype, /* MMDB_STORAGE_TYPE_EXTERNAL=store */ /* in file server*/ /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/ comment, /* user comment */ attrs, /* user-supplied attributes */ thumbnail /* thumbnail */ );
À̹ÌÁö ¿ÀºêÁ§Æ®ÀÇ °æ¿ì¿¡ ÇÑÇØ Replace UDF´Â ´ÙÀ½ÀÇ Ãß°¡ Çü½ÄÀ» °®½À´Ï´Ù.
Çü½Ä 5: Çü½Ä º¯È¯À» »ç¿ëÇÏ¿© Ŭ¶óÀÌ¾ðÆ® ¹öÆÛ ¶Ç´Â Ŭ¶óÀÌ¾ðÆ® ÆÄÀÏ¿¡¼ À̹ÌÁö¸¦ °»½ÅÇϰí ÇØ´ç ÁÖ¼®À» °»½ÅÇÕ´Ï´Ù.
Replace( handle, /* object handle */ content, /* object content */ source_format, /* source format */ target_format, /* target format */ target_file, /* target file name for storage in file server */ /* or NULL for storage in table as BLOB */ comment /* user comment */ );
Çü½Ä 6: Çü½Ä º¯È¯À» »ç¿ëÇÏ¿© ¼¹ö ÆÄÀÏ¿¡¼ ¿ÀºêÁ§Æ®¸¦ °»½ÅÇϰí ÇØ´ç ÁÖ¼®À» °»½ÅÇÕ´Ï´Ù.
Replace( handle, /* object handle */ source_file, /* server file name */ source_format, /* source format */ target_format, /* target format */ target_file, /* MMDB_STORAGE_TYPE_EXTERNAL=store */ /* in file server */ /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/ comment /* user comment */ );
Çü½Ä 7: Çü½Ä º¯È¯ ¹× Ãß°¡ º¯°æÀ» »ç¿ëÇÏ¿© Ŭ¶óÀÌ¾ðÆ® ¹öÆÛ ¶Ç´Â Ŭ¶óÀÌ¾ðÆ® ÆÄÀÏ¿¡¼ À̹ÌÁö¸¦ °»½ÅÇϰí ÇØ´ç ÁÖ¼®À» °»½ÅÇÕ´Ï´Ù.
Replace( handle, /* object handle */ content, /* object content */ source_format, /* source format */ target_format, /* target format */ conversion_options, /* conversion options */ target_file, /* target file name for storage in file server */ /* or NULL for storage in table as BLOB */ comment /* user comment */ );
Çü½Ä 8: Çü½Ä º¯È¯ ¹× Ãß°¡ º¯°æÀ» »ç¿ëÇÏ¿© ¼¹ö ÆÄÀÏ¿¡¼ ¿ÀºêÁ§Æ®¸¦ °»½ÅÇϰí ÇØ´ç ÁÖ¼®À» °»½ÅÇÕ´Ï´Ù.
Replace( handle, /* object handle */ source_file, /* server file name */ source_format, /* source format */ target_format, /* target format */ conversion_options, /* conversion options */ target_file, /* MMDB_STORAGE_TYPE_EXTERNAL=store */ /* in file server */ /* MMDB_STORAGE_TYPE_INTERNAL=store as a BLOB*/ comment /* user comment */ );
¿¹¸¦ µé¾î, C ÀÀ¿ëÇÁ·Î±×·¥¿¡ ÀÖ´Â ´ÙÀ½ ¸í·É¹®Àº Á÷¿ø Å×ÀÌºí¿¡ ÀÖ´Â ¿Àµð¿À Ŭ¸³°ú ¿¬°üµÈ ÁÖ¼®À» °»½ÅÇÕ´Ï´Ù. °»½ÅÇÒ ¼Ò½º ³»¿ëÀº ajones.wav¶ó´Â ¼¹ö ÆÄÀÏ¿¡ ÀÖ½À´Ï´Ù. °»½ÅµÈ ¿Àµð¿À Ŭ¸³Àº Çü½Ä º¯È¯ ¾øÀÌ BLOBÀ¸·Î Á÷¿ø Å×ÀÌºí¿¡ ÀúÀåµË´Ï´Ù(Audio Extender´Â Çü½Ä º¯È¯À» Áö¿øÇÏÁö ¾Ê½À´Ï´Ù). À̰ÍÀº ¾Õ¿¡¼ ¼³¸íÇÑ Çü½Ä 2¿¡ ´ëÀÀÇÕ´Ï´Ù.
EXEC SQL BEGIN DECLARE SECTION; long hvStorageType; EXEC SQL END DECLARE SECTION; hvStorageType=MMDB_STORAGE_TYPE_INTERNAL; EXEC SQL UPDATE EMPLOYEE SET SOUND=REPLACE( SOUND, /*audio handle*/ '/employee/newaud/ajones.wav', /*source file */ 'WAV', /*keep the audio format*/ :hvStorageType, /*store audio in DB as BLOB*/ 'Anita''s new greeting') /*user comment*/ WHERE NAME='Anita Jones';
´ÙÀ½ÀÇ ¿¹½Ã¿¡¼ À̹ÌÁö¿Í °ü·Ã ÁÖ¼®ÀÌ °»½ÅµË´Ï´Ù. °»½ÅÇÒ ¼Ò½º ³»¿ëÀº ¼¹ö ÆÄÀÏ¿¡ ÀÖ½À´Ï´Ù. °»½ÅµÈ À̹ÌÁö´Â BLOBÀ¸·Î Á÷¿ø Å×ÀÌºí¿¡ ÀúÀåµÇ°í BMP¿¡¼ GIF Çü½ÄÀ¸·Î º¯È¯µË´Ï´Ù. (À̰ÍÀº ¾Õ¿¡¼ ¼³¸íÇÑ Çü½Ä 6¿¡ ÇØ´çµË´Ï´Ù.)
EXEC SQL UPDATE EMPLOYEE SET PICTURE=REPLACE( PICTURE, /*image handle*/ '/employee/newimg/ajones.bmp', /*source file */ 'BMP', /*source format*/ 'GIF', /*target format*/ '' /*store image in DB as BLOB*/ 'Anita''s new picture') WHERE NAME='Anita Jones'; /* user comment */