Skip site navigation (1) Skip section navigation (2)

C Function Problems

From: Screech <screech(at)screech(dot)org>
To: "This is \"Need to Know\" Information": ;
Subject: C Function Problems
Date: 1998-07-20 01:24:50
Message-ID: (view raw or whole thread)
Lists: pgsql-interfaces
I've managed to track down what I think is the source of this error (which
I've posted about a couple of times):

CREATE FUNCTION gen_username (char16, char16) RETURNS char16
  AS '/usr/local/src/gen_username/' LANGUAGE 'c';

insert into auth_table values
   (gen_username ('Smith', 'Joe'), 'John Smith');

ERROR:  Load of file /usr/local/src/gen_username/ failed: Unable to
resolve symbol

If I remove all of my code, and simply return the char16 the system is
expecting, the code compiles and loads correctly.  This indicates that my
linking procedures are correct.  The code that seems to kill the loading
(I added bits and pieces until the load failed) is the snippet that
connects to the DB:

  PGconn *connection;

  connection = PQsetdb ("localhost", "", "", "", "screech");

This code causes it to fail every time.  My question is this:  is it
permissible to connect to the DB in such manner from a function that will
be loaded?  If not, how does one accomplish such a feat (is it possible)?
The function needs to check to see if a string exists in a table before it
returns its results.  TIA...

 Jason Lee                                             screech(at)screech(dot)org
 So many times we believe that our lives will go to waste unless strive to
 achieve so many things out of haste.  Sometimes we run too fast, when God
 is asking us to crawl.  He who is faithful minding less shall be given to
                               rule over all

pgsql-interfaces by date

Next:From: Stephan KleinowskiDate: 1998-07-20 06:21:30
Subject: (no subject)
Previous:From: Herouth MaozDate: 1998-07-19 10:40:00
Subject: Re: Autoincrement

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group