Skip site navigation (1) Skip section navigation (2)

Re: [DEFAULT] Daily digest v1.4551 (20 messages)

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [DEFAULT] Daily digest v1.4551 (20 messages)
Date: 2004-07-28 23:16:06
Message-ID: 20040729011602.5787736@localhost (view raw, whole thread or download thread mbox)
Lists: pgsql-general
         Jerry LeVan writes 

> Is it the case that "insert" could be used in a similiar 
> fashion to load the bytea field? 

Here's a code snippet for inserting a (varchar,bytea) tuple. 

int write_bytea(const char* pkey, const char* buf, int size) 
 Oid in_oid[]={1043,17}; /* varchar, bytea */ 
 const char* params[]={pkey,buf}; 
 const int params_length[]={strlen(pkey),size}; 
 const int params_format[]={0,1}; /* text,binary */ 
 PGresult* res; 
 res = PQexecParams(pgconn,   
                    "INSERT INTO tblob(pkey,contents) VALUES ($1,$2)",   
                    in_oid, params, params_length, 
                    params_format, 1); 
 if (res && PQresultStatus(res)==PGRES_COMMAND_OK) { 
  /* success */ 

 PostgreSQL-powered mail user agent and storage:

In response to

pgsql-general by date

Next:From: Tom LaneDate: 2004-07-29 00:39:06
Subject: Re: Timestamp input + copy
Previous:From: Steve CrawfordDate: 2004-07-28 23:15:42
Subject: Re: Timestamp input + copy

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group