图片与Postgres和Delphi [英] Picture with Postgres and Delphi

查看:69
本文介绍了图片与Postgres和Delphi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!!每个人

我正在使用Delphi开发应用程序,我有一个问题:

我必须将图片保存到我的数据库中。每张图片都有20 o 30k aprox。

更多的optimus是什么方式?

这个表格周围有500000条记录。有人说

的最佳方法是编码图片到字段bytea但是我不知道这个。

另一种方法是保存图片文件的路径但是我不喜欢这么多

因为我需要通过操作系统写入磁盘并且有权将一个

目录写入操作系统。

你做什么想想?

Edwin Quijada


------------------------- - (广播结束)---------------------------

提示2:你可以全部下车使用取消注册命令一次列出

(发送取消注册YourEmailAddressHere到 ma ***** **@postgresql.org

Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That ''s table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??
Edwin Quijada

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

推荐答案




Edwin Quijada写道:
Hi,

Edwin Quijada wrote:
嗨!!每个人
我正在使用Delphi开发应用程序,我有一个问题:
我必须将图片保存到我的数据库中。每张图片都有20 o 30k aprox。
更多的optimus是什么方式?
那张桌子周围有500000条记录。有人说这样做的最好方法是编码图片到字段bytea,但我不知道这个。
另一种方法是保存图片文件的路径,但我不喜欢这么多
因为我需要通过操作系统写入磁盘,并且有权向OS写一个
目录。
你觉得怎么样?
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That ''s table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??



是的,一般你有两种选择,但你也可以将数据存储在

文件中并通过存储过程获取...我用FTP做任何方式(Indy

组件)。它允许我在本地缓存文件。


-

问候,

Micha3 Zaborowski(TeXXaS)



---------------------------(广播结束)------- --------------------

提示4:不要杀死-9''邮政局长


Yes, generally you have two choices, but you can as well store data in
files and get it by stored procedures... Any way I did it with FTP (Indy
component). It allowed me to cache files locally.

--
Regards,
Micha3 Zaborowski (TeXXaS)


---------------------------(end of broadcast)---------------------------
TIP 4: Don''t ''kill -9'' the postmaster


你好,Edwin,


ohter二进制数据存储在FieldType oid中。我注意到在大多数组件中,bytea

并没有在Delphi中映射为TBlobField。我也不知道你是否能够使用带有bytea的PG函数lo_import(),lo_export()

等等。我使用带有Delphi的oid,这对我来说很好。

在Delphi中你可以使用像TBlobField(MyField).LoadFromFile这样的程序。

将图片发布到服务器上会看起来像这样:


DataSet.Insert;

DataSet.BlobField.LoadFromFile(''MyPictureFile'');

DataSet。发布;


现在您的pitcure在服务器上。您还可以使用标准的

DBPicture组件...


Daniel


Am Di,2003 -09-09 um 18.54 schrieb Edwin Quijada:
Hi Edwin,

it depends on the components u use in Delphi. Normally Pictures and
ohter binary data is stored in the FieldType oid. I noticed that bytea
isn''t mapped as TBlobField in Delphi in most components. I also don''t
know if you are able to use the PG-Functions lo_import(), lo_export()
and so on with bytea. I use oid with Delphi and that works fine for me.
In Delphi you can use Procedures like TBlobField(MyField).LoadFromFile.
Post a Picture to the Server will look like this :

DataSet.Insert;
DataSet.BlobField.LoadFromFile(''MyPictureFile'');
DataSet.Post;

Now your pitcure is on the Server. You are also able to use standard
DBPicture-components...

Daniel

Am Di, 2003-09-09 um 18.54 schrieb Edwin Quijada:
嗨!!每个人
我正在使用Delphi开发应用程序,我有一个问题:
我必须将图片保存到我的数据库中。每张图片都有20 o 30k aprox。
更多的optimus是什么方式?
那张桌子周围有500000条记录。有人说这样做的最好方法是编码图片到字段bytea,但我不知道这个。
另一种方法是保存图片文件的路径,但我不喜欢这么多
因为我需要通过操作系统写入磁盘,并且有权向OS写一个
目录。
你觉得怎么样?
Edwin Quijada

--- ------------------------(播出结束)--------------------- ------
提示2:您可以使用取消注册命令立即取消所有列表
(将取消注册YourEmailAddressHere发送到 ma ******* @ postgresql.org



------------- --------------(广播结束)---------------------------

提示7:别忘了增加免费空间地图设置


---------------------------(end of broadcast)---------------------------
TIP 7: don''t forget to increase your free space map settings




---- - 原始消息-----

来自:" listy.mailowe" < li *********** @ wp.pl>

收件人:< pg *********** @ postgresql.org>

发送时间:2003年9月9日星期二下午8:10

主题:Re:[GENERAL]与Postgres和Delphi合作的图片


----- Original Message -----
From: "listy.mailowe" <li***********@wp.pl>
To: <pg***********@postgresql.org>
Sent: Tuesday, September 09, 2003 8:10 PM
Subject: Re: [GENERAL] Picture with Postgres and Delphi



Edwin Quijada写道:
Hi,

Edwin Quijada wrote:
嗨!!每个人
我正在使用Delphi开发应用程序,我有一个问题:
我必须将图片保存到我的数据库中。每张图片都有20 o 30k
aprox。更优化的方式是什么?
这个表的周围有500000条记录。有人说最好的
方法是编码图片到字段bytea,但我不知道
这个。另一种方法是保存图片文件的路径,但我不喜欢这么多
因为我需要通过操作系统写入磁盘并有权将一个
目录写入操作系统。
你是做什么的想想??
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox. What is the way more optimus?
That ''s table will have 500000 records around. Somebody said the best way to do that was encoder the picture to field bytea but I dont know about this. Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??


是的,一般来说你有两个选择,但你也可以将数据存储在
文件中并通过存储过程获取...我用FTP做任何方式(Indy
组件)。它允许我在本地缓存文件。


Yes, generally you have two choices, but you can as well store data in
files and get it by stored procedures... Any way I did it with FTP (Indy
component). It allowed me to cache files locally.



不需要在文件系统上手动存储文件,因为大的

对象正在为你做这件事。我将整个二进制文件存储在

blobs中(来自其他一些平台的大型对象的同义词),而且我不记得
记得我遇到了一个问题。不要忘记libpq对大型对象有很好的支持,你可以存储没有实际存储在服务器文件系统上的大对象,所以你不需要任何文件

对上传目录的权限或类似的东西。

如果您使用的是Delphi,那么有一个很棒的项目叫做Zeos对象,如果我没记错的话,那就是
,它支持大型对象。


问候!

---------------------------(广播结束)---------------------------

提示7:别忘了增加你的费用免费空间地图设置


There is no need for manually storing files on filesystem, because large
objects are doing that for You. I am storing whole binary files in
blobs(synonym for large objects from some other platforms), and I do not
remember that I had a single problem with that. Do not forget that libpq has
great support for large objects, and you can store large object without
actually storing them on server filesystem, so You do not need any file
permissions on "upload directory" or something like that.
If You are using Delp there is great project called "Zeos objects", and
if I remember correctly it has support for large objects.

Regards !
---------------------------(end of broadcast)---------------------------
TIP 7: don''t forget to increase your free space map settings


这篇关于图片与Postgres和Delphi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆