<div dir="ltr"><p class=""><span style="font-family:'Courier New'">I have written
postgerSql connectivity code in clang plugin as shown below.<br>
<br>
class PrintFunctionNamesAction : public PluginASTAction {<br>
      protected:<br>
            ASTConsumer
*CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {<br>
            PGconn          *conn;<br>
            PGresult        *res;<br>
            int             rec_count;<br>
            int             row;<br>
            int             col;<br>
 <br>
 <br>
 <br>
         conn =
PQconnectdb("dbname=a host=localhost user=user
password=user123");<br>
 <br>
         if (PQstatus(conn) ==
CONNECTION_BAD) {<br>
                 puts("We were
unable to connect to the database");<br>
                 //break;<br>
         }<br>
 <br>
         res = PQexec(conn,<br>
                 "update people set
phonenumber=\'8983194618\' where id=3");<br>
 <br>
         res = PQexec(conn,<br>
                 "select
lastname,firstname,phonenumber from people order by id");<br>
 <br>
         if (PQresultStatus(res) !=
PGRES_TUPLES_OK) {<br>
                puts("We did not get
any data!");<br>
                 //break;<br>
         }<br>
 <br>
         rec_count =
PQntuples(res);<br>
 <br>
         printf("We received %d
records.\n", rec_count);<br>
        
puts("==========================");<br>
 <br>
         for (row=0; row<rec_count;
row++) {<br>
                 for (col=0; col<3;
col++) {<br>
                        
printf("%s\t", PQgetvalue(res, row, col));<br>
                 }<br>
                
puts("");<br>
         }<br>
 <br>
        
puts("==========================");<br>
 <br>
         PQclear(res);<br>
 <br>
         PQfinish(conn);<br>
    return new
PrintFunctionsConsumer();<br>
  }<br>
<br>
It does not give any compile time error; but I am getting the following error
ar run time.<br>
<br>
clang++ -cc1 -load ../../../../Release+Asserts/lib/libPrintFunctionNames.so
-plugin print-fns -plugin-arg-print-fns -lpq test.cpp<br>
PrintFunctionNames arg = -lpq<br>
clang++: symbol lookup error: ../../../../Release+Asserts/lib/libPrintFunctionNames.so:
undefined symbol: PQconnectdb<br>
<br>
<br>
 </span></p></div>