From sandhyar@amiindia.co.in Thu Sep 1 13:33:20 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8AE84D8A06 for ; Thu, 1 Sep 2005 10:33:20 -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 12781-03 for ; Thu, 1 Sep 2005 13:33:17 +0000 (GMT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by svr1.postgresql.org (Postfix) with ESMTP id AE928D89F6 for ; Thu, 1 Sep 2005 10:33:10 -0300 (ADT) Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by svr4.postgresql.org (Postfix) with ESMTP id AF89E5AF32E for ; Thu, 1 Sep 2005 12:10:08 +0000 (GMT) Received: from amiindiahjwbgh ([10.0.0.205]) (authenticated bits=0) by venus.amiindia.co.in (8.12.10/8.12.11) with ESMTP id j81AXFI6006924; Thu, 1 Sep 2005 16:03:18 +0530 Message-ID: <01ad01c5aee1$dd839570$cd00000a@amiindiahjwbgh> From: "sandhya" To: "postgre" Cc: "sandhya" Subject: Reg:Connection Object Date: Thu, 1 Sep 2005 16:12:17 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01AA_01C5AF0F.ECA82560" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.063 required=5 tests=[AWL=-0.015, FORGED_RCVD_HELO=0.05, HTML_60_70=0.027, HTML_MESSAGE=0.001] X-Spam-Level: X-Archive-Number: 200509/1 X-Sequence-Number: 18738 This is a multi-part message in MIME format. ------=_NextPart_000_01AA_01C5AF0F.ECA82560 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, How to pass connection object across the functions.So that there is = no need for me to connect to postgres database in each and every = function. For Ex:If i have say 3 functions: One function i use to connect to the database. In the other function, if i want to creat a table ...I need this = persistant connection object which holds the details of the dbname and = user etc. Pls..help me in solving this. Thank you very much Regards, Sandhya R ------=_NextPart_000_01AA_01C5AF0F.ECA82560 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
    How to pass = connection object=20 across the functions.So that there is no need for me to connect to = postgres=20 database in each and every function.
 
For Ex:If i have say 3 = functions:
 
One function i use to connect to the=20 database.
 
In the other function, if i want to = creat a table=20 ...I need this persistant connection object which holds the details of = the=20 dbname and user etc.
 
Pls..help me in solving = this.
Thank you very much
 
Regards,
Sandhya R
------=_NextPart_000_01AA_01C5AF0F.ECA82560-- From mike@fuhr.org Thu Sep 1 13:46:54 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3B031D8A5E for ; Thu, 1 Sep 2005 10:46:54 -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 16574-01 for ; Thu, 1 Sep 2005 13:46:50 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id BC5C8D8A16 for ; Thu, 1 Sep 2005 10:46:43 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j81Dkbbg027583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Sep 2005 07:46:40 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j81DkaOL027691; Thu, 1 Sep 2005 07:46:36 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j81DkXtR027690; Thu, 1 Sep 2005 07:46:33 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 1 Sep 2005 07:46:33 -0600 From: Michael Fuhr To: sandhya Cc: postgre Subject: Re: Reg:Connection Object Message-ID: <20050901134633.GA27624@winnie.fuhr.org> References: <01ad01c5aee1$dd839570$cd00000a@amiindiahjwbgh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01ad01c5aee1$dd839570$cd00000a@amiindiahjwbgh> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200509/3 X-Sequence-Number: 18740 On Thu, Sep 01, 2005 at 04:12:17PM +0530, sandhya wrote: > How to pass connection object across the functions.So that there > is no need for me to connect to postgres database in each and every > function. What functions? You didn't say what language you're using, nor whether you're writing client-side code or server-side code. BTW, this thread seems off-topic for pgsql-admin because it doesn't concern PostgreSQL administration. You're more likely to get help in pgsql-interfaces or pgsql-general, or in one of the more specific lists like pgsql-jdbc or pgsql-php if you're using one of those interfaces. -- Michael Fuhr From sandhyar@amiindia.co.in Fri Sep 2 04:19:40 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 720D3D7152 for ; Fri, 2 Sep 2005 01:19:40 -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 64493-10 for ; Fri, 2 Sep 2005 04:19:34 +0000 (GMT) Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by svr1.postgresql.org (Postfix) with ESMTP id 85769D711E for ; Fri, 2 Sep 2005 01:19:19 -0300 (ADT) Received: from amiindiahjwbgh ([10.0.0.205]) (authenticated bits=0) by venus.amiindia.co.in (8.12.10/8.12.11) with ESMTP id j824H1PA002962; Fri, 2 Sep 2005 09:47:02 +0530 Message-ID: <003501c5af76$78257690$cd00000a@amiindiahjwbgh> From: "sandhya" To: "Michael Fuhr" , "Askar Zaidi" Cc: "postgre" References: <01ad01c5aee1$dd839570$cd00000a@amiindiahjwbgh> <20050901134633.GA27624@winnie.fuhr.org> Subject: Re: Reg:Connection Object Date: Fri, 2 Sep 2005 09:56:19 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.049 required=5 tests=[AWL=-0.001, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200509/10 X-Sequence-Number: 18747 I am using normal C-Functions,In one function i will make connection with the database.This connection object i need to get in my all other functions where i will do the other operations like creating a table ,altering a table in their respective functions.So..There is no need for me to ask the user to pass the user ,password,database name in all other functions.Pls suggest me -Sandhya ----- Original Message ----- From: "Michael Fuhr" To: "sandhya" Cc: "postgre" Sent: Thursday, September 01, 2005 7:16 PM Subject: Re: [ADMIN] Reg:Connection Object > On Thu, Sep 01, 2005 at 04:12:17PM +0530, sandhya wrote: > > How to pass connection object across the functions.So that there > > is no need for me to connect to postgres database in each and every > > function. > > What functions? You didn't say what language you're using, nor > whether you're writing client-side code or server-side code. > > BTW, this thread seems off-topic for pgsql-admin because it doesn't > concern PostgreSQL administration. You're more likely to get help > in pgsql-interfaces or pgsql-general, or in one of the more specific > lists like pgsql-jdbc or pgsql-php if you're using one of those > interfaces. > > -- > Michael Fuhr From mike@fuhr.org Fri Sep 2 05:27:30 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 74161D6E64 for ; Fri, 2 Sep 2005 02:27:30 -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 26332-04 for ; Fri, 2 Sep 2005 05:27:25 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 02B8AD6D8A for ; Fri, 2 Sep 2005 02:27:24 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j825OEWV028307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Sep 2005 23:27:18 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j825HDmC059825; Thu, 1 Sep 2005 23:17:13 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j825GDJ8059822; Thu, 1 Sep 2005 23:16:13 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 1 Sep 2005 23:16:13 -0600 From: Michael Fuhr To: sandhya Cc: Askar Zaidi , postgre Subject: Re: Reg:Connection Object Message-ID: <20050902051613.GB59734@winnie.fuhr.org> References: <01ad01c5aee1$dd839570$cd00000a@amiindiahjwbgh> <20050901134633.GA27624@winnie.fuhr.org> <003501c5af76$78257690$cd00000a@amiindiahjwbgh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003501c5af76$78257690$cd00000a@amiindiahjwbgh> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200509/11 X-Sequence-Number: 18748 On Fri, Sep 02, 2005 at 09:56:19AM +0530, sandhya wrote: > I am using normal C-Functions,In one function i will make connection with > the database.This connection object i need to get in my all other functions > where i will do the other operations like creating a table ,altering a table > in their respective functions.So..There is no need for me to ask the user to > pass the user ,password,database name in all other functions.Pls suggest me Do you mean you're writing C code using libpq? If so, why can't you just pass the PGconn * as another argument to your functions? Or use a global variable (although some programmers would consider that bad style)? It's not clear what difficulties you're having. -- Michael Fuhr From sandhyar@amiindia.co.in Fri Sep 2 05:42:55 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BAD98D6F3A for ; Fri, 2 Sep 2005 02:42:55 -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 57581-02 for ; Fri, 2 Sep 2005 05:42:50 +0000 (GMT) Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by svr1.postgresql.org (Postfix) with ESMTP id DFDE2D6E15 for ; Fri, 2 Sep 2005 02:42:45 -0300 (ADT) Received: from amiindiahjwbgh ([10.0.0.205]) (authenticated bits=0) by venus.amiindia.co.in (8.12.10/8.12.11) with ESMTP id j825eZPA015514; Fri, 2 Sep 2005 11:10:35 +0530 Message-ID: <005901c5af82$23e95270$cd00000a@amiindiahjwbgh> From: "sandhya" To: "Michael Fuhr" Cc: "Askar Zaidi" , "postgre" References: <01ad01c5aee1$dd839570$cd00000a@amiindiahjwbgh> <20050901134633.GA27624@winnie.fuhr.org> <003501c5af76$78257690$cd00000a@amiindiahjwbgh> <20050902051613.GB59734@winnie.fuhr.org> Subject: Re: Reg:Connection Object Date: Fri, 2 Sep 2005 11:19:53 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.049 required=5 tests=[AWL=-0.001, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200509/12 X-Sequence-Number: 18749 In case of multiple users what will happen? Each must have different connection objects right! ----- Original Message ----- From: "Michael Fuhr" To: "sandhya" Cc: "Askar Zaidi" ; "postgre" Sent: Friday, September 02, 2005 10:46 AM Subject: Re: [ADMIN] Reg:Connection Object > On Fri, Sep 02, 2005 at 09:56:19AM +0530, sandhya wrote: > > I am using normal C-Functions,In one function i will make connection with > > the database.This connection object i need to get in my all other functions > > where i will do the other operations like creating a table ,altering a table > > in their respective functions.So..There is no need for me to ask the user to > > pass the user ,password,database name in all other functions.Pls suggest me > > Do you mean you're writing C code using libpq? If so, why can't > you just pass the PGconn * as another argument to your functions? > Or use a global variable (although some programmers would consider > that bad style)? It's not clear what difficulties you're having. > > -- > Michael Fuhr From mike@fuhr.org Fri Sep 2 05:59:10 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 83A20D711E for ; Fri, 2 Sep 2005 02:59:10 -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 76938-04 for ; Fri, 2 Sep 2005 05:59:08 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 814C8D6FF3 for ; Fri, 2 Sep 2005 02:59:06 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j825wvBS028421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Sep 2005 23:59:00 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j825wu0f060226; Thu, 1 Sep 2005 23:58:56 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j825wtna060225; Thu, 1 Sep 2005 23:58:55 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 1 Sep 2005 23:58:55 -0600 From: Michael Fuhr To: sandhya Cc: Askar Zaidi , postgre Subject: Re: Reg:Connection Object Message-ID: <20050902055855.GA60139@winnie.fuhr.org> References: <01ad01c5aee1$dd839570$cd00000a@amiindiahjwbgh> <20050901134633.GA27624@winnie.fuhr.org> <003501c5af76$78257690$cd00000a@amiindiahjwbgh> <20050902051613.GB59734@winnie.fuhr.org> <005901c5af82$23e95270$cd00000a@amiindiahjwbgh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <005901c5af82$23e95270$cd00000a@amiindiahjwbgh> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 required=5 tests=[AWL=0.005] X-Spam-Level: X-Archive-Number: 200509/13 X-Sequence-Number: 18750 On Fri, Sep 02, 2005 at 11:19:53AM +0530, sandhya wrote: > In case of multiple users what will happen? > Each must have different connection objects right! That's why global variables are bad. But what's wrong with passing a PGconn * to various functions? If that's a problem in your application then please explain why; it's still not clear what difficulties you're having. Perhaps it would help if you posted a simple but complete example program that shows what you're trying to do. As I mentioned before, this thread is off-topic for pgsql-admin; it would be more appropriate in pgsql-interfaces or pgsql-general. -- Michael Fuhr From manikandanc@pervasive-postgres.com Fri Sep 2 07:57:15 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 85EE7D7672 for ; Fri, 2 Sep 2005 04:57:15 -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 54486-05 for ; Fri, 2 Sep 2005 07:57:12 +0000 (GMT) Received: from ausimss.pervasive.com (ausimss.pervasive.com [66.45.103.246]) by svr1.postgresql.org (Postfix) with ESMTP id 08756D7384 for ; Fri, 2 Sep 2005 04:57:10 -0300 (ADT) Received: from ausbayes2.aus.pervasive.com ([172.16.8.6]) by ausimss.pervasive.com with InterScan Messaging Security Suite; Fri, 02 Sep 2005 02:57:09 -0500 Received: from blrmail2.aus.pervasive.com ([10.3.16.65]) by ausbayes2.aus.pervasive.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 2 Sep 2005 02:57:08 -0500 Content-class: urn:content-classes:message Subject: Re: Reg:Connection Object MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Fri, 2 Sep 2005 13:27:06 +0530 Message-ID: X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [ADMIN] Reg:Connection Object Thread-Index: AcWvhan6RcNVG3LlSwq9erwN75/XHwADtzow From: "Manikandan C" To: "sandhya" Cc: "Askar Zaidi" , "postgre" X-OriginalArrivalTime: 02 Sep 2005 07:57:08.0960 (UTC) FILETIME=[EB1E1E00:01C5AF93] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200509/14 X-Sequence-Number: 18751 I hope, U can have a structure that have members as the "user name" and = the "Connection object". Whenever a new connection is made, U can create = instances of this structure. Based on the user name, you can pass the = appropriate instance to the function. Hope this will help you. Is this what you want? Regards, Mani -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Michael Fuhr Sent: Friday, September 02, 2005 11:29 AM To: sandhya Cc: Askar Zaidi; postgre Subject: Re: [ADMIN] Reg:Connection Object On Fri, Sep 02, 2005 at 11:19:53AM +0530, sandhya wrote: > In case of multiple users what will happen? > Each must have different connection objects right! That's why global variables are bad. But what's wrong with passing a PGconn * to various functions? If that's a problem in your application then please explain why; it's still not clear what difficulties you're having. Perhaps it would help if you posted a simple but complete example program that shows what you're trying to do. As I mentioned before, this thread is off-topic for pgsql-admin; it would be more appropriate in pgsql-interfaces or pgsql-general. --=20 Michael Fuhr ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster