Re: [GENERAL] OID output problems
surfer girl wrote: > > The documentation on this is so scarse it's hard to figure out what the right format >is supposed to be for all this. After much searching (websites, various mailing list >archives), I found the "note" that PHP has a special variable "userfile" for file >uploads. It has a few. /* echo "Original file name is $userfile_name\n"; echo "File size is $userfile_size\n"; echo "File type is $userfile_type\n"; echo "Temporary file name is $userfile\n"; */ > This I have changed, and a straight upload to a file works OK, but the Postgres >input does not. "$userfile" actually points to a file such as "/tmp/php12595baa" - >now, my question is, how do I get the actual BINARY FILE into the database, and not >the NAME of the TEMP FILE. (This, at least, explains the bizarre output). > > What I had put for my input was taken out of the Addison Wesley book but the >explanation was not enough and frankly it's not working. I have yet to find another >example of how to do this, and the function reference is cryptic at best. > > Any ideas would be absolutely appreciated. Thanks. > > --- "Ross J. Reedstrom" <[EMAIL PROTECTED]> > > wrote: > >> pg_Exec($conn, "BEGIN"); > >> $oid = pg_locreate($conn); > >> $handle = pg_loopen($conn, $oid, "w"); > >> pg_lowrite($handle, $file); > > > >Hmm, based on my reading of the php4 docs, this will write the contents of the >variable > >'file' to the lo, expecting it to be a null terminated string. I'm not sure how >you're > >supposed to get binary data in there. Is 'file' by any chance, the name of your >file, > >not the contents? PHP doesn't really have an "open this file into memory" function, but it _does_ allow you to burst lines of a file in, with fgets/fputs, or to build an array out of the file contents. So, you could run a loop (metacoded, not yet tested): if($filetowrite = fopen ("$userfile", "rb") //rb is read binary, right? { while (!feof($userfile)) //as long as it's not end of file { $stringtowrite = fgets($userfile); //get a string pg_lowrite($handle, $file); //write that string /* Offhand, I have no idea how fgets will handle the chars in your */ /* file. It's supposed to read to a newline, so you might have to */ /* Put one back in, a "/n" in the string if your BLOB, however,*/ /* has no lines, well that's another problem. */ } } All this being said, a frequent recommendation from the PHP list is to store the file, on your filesystem, in the filesystem database, outside of an additional database layer (yes, filesystems are databases). Combining this recommendation with the limits imposed by PostgreSQL on row size, it's fairly impractical to be doubling up on the work to write into a postgres BLOB, rather than having BLOB storage outside the DB itself, with DB pointing to it (via filename). Of course, you loose the ability for the DB engine to search _within_ the BLOB... HTH, -Bop -- Brought to you from boop!, the dual boot Linux/Win95 Compaq Presario 1625 laptop, currently running RedHat 6.1. Your bopping may vary.
[GENERAL] Job openings (FreeBSD/C/php/postgresql)
Hopefully this is considered on-topic, please trim cc. http://www.wintelcom.net/\n\n"); exit; ?> Work with the best or die like the rest. hope to hear from you, -- -Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]] "I have the heart of a child; I keep it in a jar on my desk."
Re: [GENERAL] OID output problems
The documentation on this is so scarse it's hard to figure out what the right format is supposed to be for all this. After much searching (websites, various mailing list archives), I found the "note" that PHP has a special variable "userfile" for file uploads. This I have changed, and a straight upload to a file works OK, but the Postgres input does not. "$userfile" actually points to a file such as "/tmp/php12595baa" - now, my question is, how do I get the actual BINARY FILE into the database, and not the NAME of the TEMP FILE. (This, at least, explains the bizarre output). What I had put for my input was taken out of the Addison Wesley book but the explanation was not enough and frankly it's not working. I have yet to find another example of how to do this, and the function reference is cryptic at best. Any ideas would be absolutely appreciated. Thanks. --- "Ross J. Reedstrom" <[EMAIL PROTECTED]> > wrote: >> pg_Exec($conn, "BEGIN"); >> $oid = pg_locreate($conn); >> $handle = pg_loopen($conn, $oid, "w"); >> pg_lowrite($handle, $file); > >Hmm, based on my reading of the php4 docs, this will right the contents of the >variable >'file' to the lo, expecting it to be a null terminated string. I'm not sure how you're >supposed to get binary data in there. Is 'file' by any chance, the name of your file, >not the contents? > >Ross >-- >Ross J. Reedstrom, Ph.D., <[EMAIL PROTECTED]> >NSBRI Research Scientist/Programmer >Computer and Information Technology Institute >Rice University, 6100 S. Main St., Houston, TX 77005 _ Get It Gear --> http://www.getitgear.com
[GENERAL] Removing NOT NULL Contraint
I may be missing something simple here, but I have an attribute in a table that was created as NOT NULL. I now need to remove this constraint. I don't see a proper way to do this. I think I can update the pg_attribute table and change attnotnull from true to false. Is this an acceptable solution or is there a good reason that I should not directly edit the system tables? Maybe I'm missing something but I didn't see another way to do it other then creating a new table, selecting into it and dropping the old table, which seems like a lot of work for something so simple. Thanks, Matt
[GENERAL] Mail Relay sites ...
In order to try and improve the speed of mail delivery, over the past little while we've been using a feature in Mj2 called a 'delivery_rule', which allws us to setup various hosts as 'mail relays' ... What we're trying to do, as much as possible, is split things up quasi-regionally, based on the tail end of the domain (ie. .se, .nz, etc) ... we have sites in .se, .nz, .de and .ch currently handling mail forwarding for their area ... if you are willing to act as a forwarding for this, please contact me directly ... as an extra incentive, for those willing, we're extending the banner ad service as an exchange ... Thanks ... Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy Systems Administrator @ hub.org primary: [EMAIL PROTECTED] secondary: scrappy@{freebsd|postgresql}.org
Re: [GENERAL] OID output problems
On Tue, May 02, 2000 at 10:13:14PM -0800, surfer girl wrote: > --- "Robert B. Easter" <[EMAIL PROTECTED]> wrote: > > > >Try recompiling php 4.0RC1 or whatever is current with the latest Apache > >source (1.3.12). I'm thinking maybe you are not running php as compiled into > >the server. > > Thanks - I had PHP compiled into the server - though I may try the recompile as a >last resort (before the major last resort of just keeping images as files and putting >the filename and location into the db). > > Someone asked if my INPUT was correct. Here's what I've got: > > pg_Exec($conn, "BEGIN"); > $oid = pg_locreate($conn); > $handle = pg_loopen($conn, $oid, "w"); > pg_lowrite($handle, $file); Hmm, based on my reading of the php4 docs, this will right the contents of the variable 'file' to the lo, expecting it to be a null terminated string. I'm not sure how you're supposed to get binary data in there. Is 'file' by any chance, the name of your file, not the contents? Ross -- Ross J. Reedstrom, Ph.D., <[EMAIL PROTECTED]> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005
[GENERAL] postgresql-7.0RC3: slight compile problem on AIX
Script started on Wed May 3 05:54:08 2000 zsh configure && gmake all Package appears to be name=postgresql version=7.0RC3 Using ./configure CC = xlc CXX = xlC CFLAGS = -qmaxmem=16384 -ma -O2 -I/usr/local/include LDFLAGS = -L/usr/local/lib -L/lib LIBPATH = /usr/local/lib:/lib LD_LIBRARY_PATH = /usr/local/lib:/lib nice ./configure --enable-cassert --with-template=aix_42 --with-x --without-CXX --with-perl --without-tcl --without-odbc --with-includes=/usr/local/include --with-libraries=/usr/local/lib 2>&1 creating cache ./config.cache checking host system type... powerpc-ibm-aix4.3.3.0 checking echo setting... checking setting template to... aix_42 checking whether to support locale... disabled checking whether to support cyrillic recode... disabled checking whether to support multibyte... disabled checking setting DEF_PGPORT... 5432 checking setting DEF_MAXBACKENDS... 32 checking setting USE_TCL... disabled checking setting USE_PERL... enabled checking setting USE_ODBC... disabled checking setting ASSERT CHECKING... enabled checking for gcc... xlc checking whether the C compiler (xlc -O2 -qmaxmem=16384 -qhalt=w -qsrcmsg -qlanglvl=extended -qlonglong -L/usr/local/lib -L/lib) works... yes checking whether the C compiler (xlc -O2 -qmaxmem=16384 -qhalt=w -qsrcmsg -qlanglvl=extended -qlonglong -L/usr/local/lib -L/lib) is a cross-compiler... no checking whether we are using GNU C... no checking whether xlc accepts -g... yes checking how to run the C preprocessor... xlc -E - setting CPPFLAGS= -I/usr/local/include - setting LDFLAGS=-L/usr/local/lib -L/lib -L/usr/local/lib checking setting debug compiler flag... using default checking for a BSD compatible install... /usr/local/bin/install -c checking for flex... flex checking for yywrap in -lfl... yes checking whether ln -s works... yes checking whether make sets ${MAKE}... yes checking for ranlib... ranlib checking for find... /usr/bin/find checking for tar... /usr/bin/tar checking for split... /usr/bin/split checking for etags... /usr/local/bin/etags checking for xargs... /usr/bin/xargs checking for trbsd... /usr/bin/trbsd checking for gzcat... /usr/contrib/bin/gzcat checking for perl... perl checking for bison... /usr/local/bin/bison - Using /usr/local/bin/bison -y -d checking for main in -lsfio... no checking for main in -lncurses... no checking for main in -lcurses... yes checking for main in -ltermcap... yes checking for main in -lreadline... yes checking for using_history in -lreadline... yes checking for main in -lm... yes checking for main in -ldl... yes checking for main in -lsocket... no checking for main in -lnsl... yes checking for main in -lipc... no checking for main in -lIPC... no checking for main in -llc... no checking for main in -ldld... no checking for main in -lln... no checking for main in -lld... yes checking for main in -lcompat... no checking for main in -lBSD... no checking for main in -lcrypt... yes checking for main in -lgen... no checking for main in -lPW... yes checking for ANSI C header files... yes checking for sys/wait.h that is POSIX.1 compatible... yes checking for arpa/inet.h... yes checking for crypt.h... yes checking for dld.h... no checking for endian.h... no checking for float.h... yes checking for fp_class.h... no checking for getopt.h... no checking for history.h... no checking for ieeefp.h... no checking for limits.h... yes checking for netdb.h... yes checking for netinet/in.h... yes checking for readline.h... no checking for readline/history.h... yes checking for readline/readline.h... yes checking for sys/select.h... yes checking for termios.h... yes checking for unistd.h... yes checking for values.h... yes checking for sys/param.h... yes checking for pwd.h... yes checking for working const... yes checking for inline... __inline checking for preprocessor stringizing operator... yes checking for uid_t in sys/types.h... yes checking for mode_t... yes checking for off_t... yes checking for size_t... yes checking whether time.h and sys/time.h may both be included... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for tm_zone in struct tm... no checking for tzname... yes checking for signed types... yes checking for volatile... yes checking for type of last arg to accept... size_t checking for int timezone... yes checking for gettimeofday args... 2 args checking for union semun... no checking for fcntl(F_SETLK)... yes checking for 8-bit clean memcmp... yes checking return type of signal handlers... void checking for vprintf... yes checking for memmove... yes checking for sysconf... yes checking for sigprocmask... yes checking for waitpid... yes checking for setsid... yes checking for fcvt... yes checking for fpclass... no checking for fp_class... no checking for fp_class_d... no checking for class... yes checking for snprintf... yes checking for vsnprintf... yes checking for isinf... no checking for getrusage... yes checking for srandom... yes checking for gethostname... ye
[GENERAL] Postgres-Apache authentication link?
Hello World, For a website I am developing I have to create a member section. At this section I also have to add some pictures. The HTML code is already generated using PHP, but now I have to add the security for the jpg files, and that is somewhat of a problem. Who knows how to secury this?? I have heard something about a .htaccess file but how can I get this up and running?? does anyone already have a pre-written solution for my problem? For your info: I already have a database back end. Postgres is maintaining all my users and their passwords. As i understand there used to be a module called mod_auth_pg95 to serve this problem. in the version 1.3 of Apache I couldn't find it. Does anyone of you know where to find it?? Many thanks, Ramses v. Pinxteren
Re: [GENERAL] date format problem
hi bill Null fields shouldnt be the cause of the problem.. A null text field gets translated to a null datetime.. The problem must be because ur database might be specifying the field to be NOT NULL.. Check it out .. If thats the cause there is no way but to drop that constraint.. Hope this helps Anand Raman - Original Message - From: Bill Barnes <[EMAIL PROTECTED]> To: Anand Raman <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, May 03, 2000 1:51 PM Subject: RE: [GENERAL] date format problem > Hello Anand: > > Thanks for the input. > > The problem turned out to be date fields with null values. Disappointing! > A lot of my Sybase procedures tested for null dates. > > So my workaround was to edit the null dates to a pseudo date. This is least > got my database poplulated. Will try the cast for queries and updates. > > I don't know which SQL, Postresql or Sybase, is an extension or non-compliant. > > Bill Barnes > > >= Original Message From "Anand Raman" <[EMAIL PROTECTED]> = > >HI bill > >Try to cast the field to the datetime type > > > >'ur_string_goes_here'::datetime > > > >Hope this will help > >Anand Raman > > > >- Original Message - > >From: Bill Barnes <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >Sent: Friday, April 28, 2000 6:09 PM > >Subject: [GENERAL] date format problem > > > > > >> Hello List: > >> > >> Using 6.5.3 on SuSE 6.4. > >> > >> Built a table with a date field as type 'datetime'. > >> > >> I try to copy a text file to the table and get a 'bad date format' > >> Dates in the text file may be null, but are in the form 1997-12-15. > >> Have tried several of the date field types with the same result. > >> The copy executes properly if I redefine the date field to varchar. > >> > >> Thanks for your help. > >> Bill Barnes > >> > >> > >> This e-mail has been sent to you courtesy of OperaMail, a > >> free web-based service from Opera Software, makers of > >> the award-winning Web Browser - http://www.operasoftware.com > >> > >> > > > This e-mail has been sent to you courtesy of OperaMail, a > free web-based service from Opera Software, makers of > the award-winning Web Browser - http://www.operasoftware.com > >
RE: [GENERAL] date format problem
I dunno, I'm using 6.5.3 and have no probs pgdumping, pguploading and using null dates - moved my app to another server etc, and the null dates are still there. The null dates are dumped as \N which presumably means NULL (but for some reason typing \N (two characters - backslash then N) works for the postgres superuser default password). So perhaps you could convert dates you want null to \N. I'm using perl and DBI, and things work fine - a null date is returned as a perl undefined value (which is different from zero). e.g. if not defined($date) { $date="unknown"; } else { $date=htdate($date); } Cheerio, Link. At 04:21 AM 03-05-2000 -0400, Bill Barnes wrote: >Hello Anand: > >Thanks for the input. > >The problem turned out to be date fields with null values. Disappointing! >A lot of my Sybase procedures tested for null dates. > >So my workaround was to edit the null dates to a pseudo date. This is least >got my database poplulated. Will try the cast for queries and updates. > >I don't know which SQL, Postresql or Sybase, is an extension or non-compliant. > >Bill Barnes > >>= Original Message From "Anand Raman" <[EMAIL PROTECTED]> = >>HI bill >>Try to cast the field to the datetime type >> >>'ur_string_goes_here'::datetime >> >>Hope this will help >>Anand Raman >> >>- Original Message - >>From: Bill Barnes <[EMAIL PROTECTED]> >>To: <[EMAIL PROTECTED]> >>Sent: Friday, April 28, 2000 6:09 PM >>Subject: [GENERAL] date format problem >> >> >>> Hello List: >>> >>> Using 6.5.3 on SuSE 6.4. >>> >>> Built a table with a date field as type 'datetime'. >>> >>> I try to copy a text file to the table and get a 'bad date format' >>> Dates in the text file may be null, but are in the form 1997-12-15. >>> Have tried several of the date field types with the same result. >>> The copy executes properly if I redefine the date field to varchar. >>> >>> Thanks for your help. >>> Bill Barnes >>> >>> >>> This e-mail has been sent to you courtesy of OperaMail, a >>> free web-based service from Opera Software, makers of >>> the award-winning Web Browser - http://www.operasoftware.com >>> >>> > > >This e-mail has been sent to you courtesy of OperaMail, a >free web-based service from Opera Software, makers of >the award-winning Web Browser - http://www.operasoftware.com > > > >
Re: [HACKERS] Re: [GENERAL] Re: [SQL] textsubstr() ...? for postgres 7 beta5
Is there a copy of the old 6.5.x docs lying around somewhere? We'll probably switch to 7.0 eventually but in the meantime it'll be good to be able to access the old docs for 6.5.x Cheerio, Link. At 08:30 PM 30-04-2000 -0400, Tom Lane wrote: >[EMAIL PROTECTED] writes: >> it is not textsubstr() but this : (found in 6.5.2 redhat ) > >> result |function |arguments |description >> +-+---+-- >> text|text_substr |text int4 int4 |return portion of string > >> Is this in 7.0 ? > >Looks like it's called just plain "substr" now. See >http://www.postgresql.org/docs/postgres/functions.htm > > regards, tom lane > >
RE: [GENERAL] date format problem
Hello Anand: Thanks for the input. The problem turned out to be date fields with null values. Disappointing! A lot of my Sybase procedures tested for null dates. So my workaround was to edit the null dates to a pseudo date. This is least got my database poplulated. Will try the cast for queries and updates. I don't know which SQL, Postresql or Sybase, is an extension or non-compliant. Bill Barnes >= Original Message From "Anand Raman" <[EMAIL PROTECTED]> = >HI bill >Try to cast the field to the datetime type > >'ur_string_goes_here'::datetime > >Hope this will help >Anand Raman > >- Original Message - >From: Bill Barnes <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Friday, April 28, 2000 6:09 PM >Subject: [GENERAL] date format problem > > >> Hello List: >> >> Using 6.5.3 on SuSE 6.4. >> >> Built a table with a date field as type 'datetime'. >> >> I try to copy a text file to the table and get a 'bad date format' >> Dates in the text file may be null, but are in the form 1997-12-15. >> Have tried several of the date field types with the same result. >> The copy executes properly if I redefine the date field to varchar. >> >> Thanks for your help. >> Bill Barnes >> >> >> This e-mail has been sent to you courtesy of OperaMail, a >> free web-based service from Opera Software, makers of >> the award-winning Web Browser - http://www.operasoftware.com >> >> This e-mail has been sent to you courtesy of OperaMail, a free web-based service from Opera Software, makers of the award-winning Web Browser - http://www.operasoftware.com