Received: from hood.tvd.be (hood.tvd.be [195.162.196.21]) by hub.org (8.10.1/8.10.1) with ESMTP id e6P0Mvh23366; Mon, 24 Jul 2000 20:22:57 -0400 (EDT) Received: from altern.org (IDENT:tsmets@cable-213-132-133-43.upc.chello.be [213.132.133.43]) by hood.tvd.be (8.9.3/8.9.3/RELAY-1.1) with ESMTP id CAA08366; Tue, 25 Jul 2000 02:22:55 +0200 (MET DST) Message-ID: <397CF53C.57790566@altern.org> Date: Tue, 25 Jul 2000 04:02:36 +0200 From: Thomas SMETS X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.9-27mdk i686) X-Accept-Language: en MIME-Version: 1.0 To: psql Admin , psql novice , psql sql Subject: [Fwd: inserting integer in Table] Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200007/90 > > In PostgreSQL table is : > > test=> \d test_blob_s; > Table = test_blob_s > +----------------------------------+----------------------------------+-------+ > | Field | Type | > Length| > +----------------------------------+----------------------------------+-------+ > | filenumber | int4 > | 4 | > | filename | varchar() > | 100 | > | filecontent | oid > | 4 | > +----------------------------------+----------------------------------+-------+ > test=> > > > Now I'm willing to insert in that table rows like this one : > , , . > > Here's is the (not-so-running) code : > > > # > # > # ############################################ > import os, glob > from pg import DB > > conn=DB('test') > conn.query("BEGIN WORK;") > > i = 0 > for name in glob.glob("*.jpg"): > print "Name is ", name, > try: > conn.query("insert into test_blob_s filenumber values (" + i + > ")") > print " inserted" > except TypeError,e: > print '\nerror ', e, 'undefined' > # conn.query( "update test_blob_s set filename = '" + name + "')") > # conn.query( "update test_blob_s set filecontent = '" + > lo_import(name) + "')") > > i = i + 1 > > conn.query(" COMMIT WORK;"); > > > > of course I can't have it passing the insert of "i" > Could some one help ? > > Thomas, -- Thomas SMETS Phone : +32 (0)2 742. 05. 94. Av. de la Brabançonne 133 / 3 e-mail : tsmets @altern.org 1030 Bruxelles ==== Quote of the day ========= You shouldn't wallow in self-pity. But it's OK to put your feet in it and swish them around a little. -- Guindon ======= End of Quote =========