ParsX.com
سايت دانشجويان رشته كامپيوتر و راهنماي كنكور كارشناسي ارشد و كارداني به كارشناسي (كارشناسي ناپيوسته )
  سوال کننده عزیز می توانی جهت رفع مشکل پروژه و یا آموزش با شماره من 09376225339 مهندس محمدی تماس بگیری.
   ProfileProfile   Log in to check your private messagesLog in to check your private messages  |  FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups Log inLog in   RegisterRegister 

ذخیره کردن تصویر و فایل در PostgreSQL

 
Post new topic   Reply to topic    ParsX.com Forum Index -> Writers
View previous topic :: View next topic  
Author Message
vahid
بي تو هرگز


Joined: 26 Nov 2004
Posts: 2735
Location: Tehran

PostPosted: Tue Jul 14, 2009 2:16 pm    Post subject: ذخیره کردن تصویر و فایل در PostgreSQL Reply with quote

یکی از مشکلات عمده ای که برنامه نویسان با آن برخورد می کنند .این است که برای ذخیره فایل ها از جمله فایل های تصویری در بانک های اطلاعاتی با پسوند هایی چون jpg gif png و ... مشکل دارند .
در بانک اطلاعاتی PostgreSQL برای رفع این مشکل باید فیلد مورد نظر را از نوع oid انتخاب کنید و برای ذخیره فایل تصویر از تابع lo_import و برای بازیابی از تابع lo_export استفاده کنید . که در زیر نمونه ای را بیان می کنم :

create table test ( filename char(100), image oid );
insert into test values ( 'myimage',lo_import('c:/documents/test.jpg'));
select lo_export(test.image,'c:/newfile.jpg') from test where name='myimage';
Back to top
Display posts from previous:   
Post new topic   Reply to topic    ParsX.com Forum Index -> Writers All times are GMT + 3.5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum