X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2CBE5528BE for ; Wed, 15 Jun 2005 19:21:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12706-08 for ; Wed, 15 Jun 2005 22:21:23 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id CA92B528B2 for ; Wed, 15 Jun 2005 19:21:21 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id 57so101268wri for ; Wed, 15 Jun 2005 15:21:24 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jAd07jGUAd4RZ7HBrVY7Ph83Imc1vhsePe3ly9GKV8/ohy1hiuDx0sAQTwTDmUVJQUUW/QixQkLfjxbsIiU4GL/TC3CRGjiPP6wzE2Np1TcAbEZh9aR3uO8yYlU6sfZGdkZkhZgpxn3ZnJ5DETS0NxFY9KlUQ2F/cObjwBrIFXs= Received: by 10.54.18.5 with SMTP id 5mr3870931wrr; Wed, 15 Jun 2005 03:57:48 -0700 (PDT) Received: by 10.54.30.45 with HTTP; Wed, 15 Jun 2005 03:57:48 -0700 (PDT) Message-ID: <7104a737050615035763124eb9@mail.gmail.com> Date: Wed, 15 Jun 2005 13:57:48 +0300 From: Volkan YAZICI Reply-To: Volkan YAZICI To: Weber Matthias Subject: Re: FW: How to store binaries and ASCII files in DB Cc: pgsql-php@postgresql.org In-Reply-To: <09766A6E64A068419B362367800D50C0B58C17@moritz.faps.uni-erlangen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <09766A6E64A068419B362367800D50C0B58C17@moritz.faps.uni-erlangen.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.129 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/13 X-Sequence-Number: 3172 Hi, On 6/15/05, Weber Matthias wrote: > is their any php code example on how to store files (binary and > ASCII) into a postgres db? There's not so much difference between a data INSERT and file storage. But, as a first step, you should decide on the way you want to store the related data. Will it be stored on a normal table row (in a bytea field) or as a large object? If you'll use LO, then you should refer to its documentation for related functions and examples. But if you'll use a normal bytea column, I'd strongly encourage you to use parameters while inserting data. This is going to save you from CPU and RAM wasting escaping routines, plus SQL-Injection attacks. (For further performance tweaks, you can use binary mode while transmitting data.) Regards.