如何从Postgres列中选择二进制数据 [英] How to select binary data from postgres column

查看:64
本文介绍了如何从Postgres列中选择二进制数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编程一个应用程序,其中我要从Postgres数据库和表名片中选择数据。

I am.programming an.application in which i am selecting data from postgres database and table name cards.

名片中有很多列,但有两个列。是bytea数据类型。它有一个保存的blob。列名为tpl,其他列为photo,但是当我选择数据并通过dataAdapter填充datatable时,datable将这两个列值显示为System.Byte [],并将其插入到我的主数据库中时。插入为System.Byte []它正在丢失。该列中的二进制数据。我必须将本地服务器表同步到主服务器。我们公司的通行证有不同的门,然后将通行证同步到中央服务器..

In.cards we have many columns but two.columns are bytea datatype. It has a blob saved one.column is named as tpl and other is photo but when i select data and fill datatable through dataAdapter the datable shows theese two column values as System.Byte[] and when i insert it in my master database it.insert it as System.Byte[] it is loosing.the binary data which is in the column. I have to.syncrhonize local server tables to master server . We have different gates in our company where passes are issued and.then.they are synchrinized to a central sever ..

我希望你们能得到我的帮助,请帮忙

I hope you people get my point please help

Databae是PostgreSQL 8.2
启用了on.c#

Databae is postgresql 8.2 Apllication is on.c#

推荐答案

在使用dblink连接控制不同版本的postgres服务器之间的数据传输之前,我已经在数据库系统上工作。这包括传输字节数据和维护数据类型。 dblink连接有一点限制,我不能说连接时间开销,但是它们很好地用于数据传输。

I've worked on a db system before where it used dblink connections for controlling the data transfer between postgres servers of different versions. This included transferring of bytea data and maintaining the data type. Dblink connections are a little restrictive and I can't speak for connection time overheads however they serve their purpose well for data transfer.

在主服务器上,数据被拉入从卫星:

On the main server the data was pulled in from the satellites:

INSERT INTO main_table
SELECT * FROM dblink("connect_string", ''SELECT tpl, photo FROM satellite_table;'')
AS data(tpl bytea, photo bytea);

这允许您专门指定传入的数据类型。不确定这是否有帮助,但是我已经看到在8.3 db上可以正常工作。 http://www.postgresql.org/docs/8.3/static/contrib -dblink.html

This allows you to specify the incoming data types specifically. Not sure if this helps but I've seen this working fine on an 8.3 db. http://www.postgresql.org/docs/8.3/static/contrib-dblink.html

这篇关于如何从Postgres列中选择二进制数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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