Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71119 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61925 invoked from network); 14 Jan 2014 02:59:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2014 02:59:26 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.177 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.177 mail-lb0-f177.google.com Received: from [209.85.217.177] ([209.85.217.177:44856] helo=mail-lb0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/F3-41371-C08A4D25 for ; Mon, 13 Jan 2014 21:59:25 -0500 Received: by mail-lb0-f177.google.com with SMTP id z5so3576421lbh.22 for ; Mon, 13 Jan 2014 18:59:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=5ff2zbEOpmeCnjjQeVuZ289YoC7WL1q2h8bFezrcyyE=; b=VSzyiuNd14DuqEzLOPhH/kFeWvxIVCXqly26KVx1GVQiRzsFl510ujWK7F2NLI+bQH 6yfVhAh4HbBA7vTC6CzjUnI6aVtU//YDtI89OK6AN6hFMty4OUOTUhAiK2z4wXZTUcJN /DOPXyHttGiQyI40DkbM1Yvb5JawpUXkAS3PdmIgXmQ7ir9VumuEm4xSXHU6wOWI2sWO Lo+IHulB2/UGZxJR1AQZ8qyuvW3sZAXVAoQ8Vd/xeFTTOqnkp4A7kBNqhmHk6B5XPejU Hir49hKpmRRaU/pgXpe8ScvzJUnLZ2NGWavVXaU1N6G09LUffDaorJkeVX+t7ePMC4W7 5+RA== X-Received: by 10.112.128.226 with SMTP id nr2mr11555932lbb.17.1389668361837; Mon, 13 Jan 2014 18:59:21 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.6.68 with HTTP; Mon, 13 Jan 2014 18:58:38 -0800 (PST) In-Reply-To: References: Date: Tue, 14 Jan 2014 11:58:38 +0900 X-Google-Sender-Auth: SiWDagIGYjtv1EzGd6YHUsglzfw Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b3a84c210225604efe5610a Subject: Re: PostgreSQL lo_lseek64()/etc support. From: yohgaki@ohgaki.net (Yasuo Ohgaki) --047d7b3a84c210225604efe5610a Content-Type: text/plain; charset=UTF-8 On Mon, Jan 13, 2014 at 6:48 PM, Yasuo Ohgaki wrote: > PostgreSQL 9.3 has support for 2GB+ large object support via > new APIs. e.g. lo_lseek64(), lo_tell64() > > I've made patch that supports new 64bit large object APIs. > > https://gist.github.com/yohgaki/35b12a48ac6332633e60 > > It adds new functions pg_lo_seek64(), pg_lo_tell64, pg_lo_truncate64(). > However, these new functions are not mandatory. It could be made to use > php.ini setting which specifies libpq API is used by > pg_lo_seek()/pg_lo_tell()/ > pg_lo_truncate(). > > libpq's lo_lseek(), lo_tell() will be legacy and unused APIs in the long > run. > Therefore, it may be better to change API to be used according to php.ini > setting. e.g. When pgsql.server_version=9.3 (or greater), use lo_*64() > if it's available. > > Pros. > - No additional API exposed. > - No legacy API in the future. > - Old code can extend capability w/o code change. > - No additional user code is required to detect and switch API. > - No query is required to detect PostgreSQL server version when > php.ini based switch is used. > > Cons. > - Additional php.ini that specifies server version. > > Even though I've made patch that simply exposes new libpq APIs, > patch that has php.ini switch is better. IMO. > > Any comments? > If there aren't any objections, I'll create and commit patch that uses > php.ini to change pg_lo_*() behavior. > > Note about libpq's lo_*64() APIs: > These APIs returns -1(failure) always if server version is less than > PostgreSQL 9.3. > > Note for 32bit platforms: > Since PHP int is 32bit int, 64bit support could be used but it's limited > by 32bit int. > I've made better patch for this. https://gist.github.com/yohgaki/dbae821c49d6531d9345 It does not require additional php.ini and use proper API for large object. (It has 32bit int issue on 32bit platforms, but this is different issue like file IO) Any comments? I'll test it against older PostgreSQL and if there aren't problem, I'll commit this to 5.6 and up in a few days. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --047d7b3a84c210225604efe5610a--