pike.git / lib / modules / Sql.pmod / pgsql.pike

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:112:    string res=UNDEFINED;    switch(type) {    case 'O':    res=sprintf(DRIVERNAME"(%s@%s:%d/%s,%d,%d)",    user,_host,_port,database,c&&c->socket?->query_fd(),backendpid);    break;    }    return res;   }    - //! @decl void create() - //! @decl void create(string host, void|string database, void|string user,@ - //! void|string password, void|mapping(string:mixed) options) - //! +    //! With no arguments, this function initialises (reinitialises if a   //! connection has been set up previously) a connection to the   //! PostgreSQL backend. Since PostgreSQL requires a database to be   //! selected, it will try to connect to the default database. The   //! connection may fail however, for a variety of reasons; in this case   //! the most likely reason is because you don't have sufficient privileges   //! to connect to that database. So use of this particular syntax is   //! discouraged.   //!   //! @param host
pike.git/lib/modules/Sql.pmod/pgsql.pike:273:   //!   //! @seealso   //! @[ping()]   /*semi*/final int is_open() {    catch {    return c->socket->is_open();    };    return 0;   }    - //! @decl int ping() - //! +    //! Check whether the connection is alive.   //!   //! @returns   //! Returns one of the following:   //! @int   //! @value 0   //! Everything ok.   //! @value 1   //! The connection has reconnected automatically.   //! @value -1
pike.git/lib/modules/Sql.pmod/pgsql.pike:1262:    ERROR(msg+"\n");    }    _runtimeparameter=([]);    _unnamedportalmux=Thread.Mutex();    unnamedstatement=Thread.Mutex();    readyforquery_cb=force?reconnect_cb:connect_cb;    _portalsinflight=0;    return 1;   }    - //! @decl void reload() - //! +    //! For PostgreSQL this function performs the same function as @[resync()].   //!   //! @seealso   //! @[resync()], @[cancelquery()]   /*semi*/final void reload() {    resync();   }      private void reset_dbsession() {    big_query("ROLLBACK");
pike.git/lib/modules/Sql.pmod/pgsql.pike:1295:    }    Thread.Thread(reset_dbsession); // Urgently and deadlockfree    }   }      private void sendsync() {    _readyforquerycount++;    c->start()->sendcmd(SYNCSEND);   }    - //! @decl void resync() - //! +    //! Resyncs the database session; typically used to make sure the session is   //! not still in a dangling transaction.   //!   //! If called while the connection is in idle state, the function is   //! lightweight and briefly touches base with the database server to   //! make sure client and server are in sync.   //!   //! If issued while inside a transaction, it will rollback the transaction,   //! close all open cursors, drop all temporary tables and reset all   //! session variables to their default values.
pike.git/lib/modules/Sql.pmod/pgsql.pike:1686:   }      private inline string int2hex(int i) {    return String.int2hex(i);   }      private inline void throwdelayederror(object parent) {    .pgsql_util.throwdelayederror(parent);   }    - //! @decl Sql.pgsql_util.sql_result big_query(string query) - //! @decl Sql.pgsql_util.sql_result big_query(string query, mapping bindings) - //! +    //! This is the only provided interface which allows you to query the   //! database. If you wish to use the simpler @[Sql.Sql()->query()] function,   //! you need to use the @[Sql.Sql] generic SQL-object.   //!   //! Bindings are supported natively straight across the network.   //! Special bindings supported are:   //! @mapping   //! @member int ":_cache"   //! Forces caching on or off for the query at hand.   //! @member int ":_text"
pike.git/lib/modules/Sql.pmod/pgsql.pike:1893:    } else {    object plugbuffer;    if(!sizeof(preparedname) || !tp || !tp.preparedname) {    if(!sizeof(preparedname))    preparedname=    (portal._unnamedstatementkey=    (syncparse?unnamedstatement->lock:unnamedstatement->trylock)(1))    ? "" : PTSTMTPREFIX+int2hex(ptstmtcount++);    else if(syncparse)    portal._unnamedstatementkey=unnamedstatement->lock(1); +  PD("Parse statement %O=%O\n",preparedname,q); +  plugbuffer=c->start()->add_int8('P') +  ->add_hstring(({preparedname,0,q,"\0\0\0"}),4,4) + #if 0    // Even though the protocol doesn't require the Parse command to be    // followed by a flush, it makes a VERY noticeable difference in    // performance if it is omitted; seems like a flaw in the PostgreSQL    // server v8.3.3    // In v8.4 and later, things speed up slightly when it is omitted. -  PD("Parse statement %O=%O\n",preparedname,q); -  plugbuffer=c->start()->add_int8('P') -  ->add_hstring(({preparedname,0,q,"\0\0\0"}),4,4); //->add(PGFLUSH); +  ->add(PGFLUSH) + #endif +  ;    }    portal._preparedname=preparedname;    if(!tp || !tp.datatypeoid) {    PD("Describe statement %O\n",preparedname);    (plugbuffer||c->start())->add_int8('D')    ->add_hstring(({'S',preparedname,0}),4,4)->sendcmd(FLUSHSEND,portal);    } else {    if(plugbuffer)    plugbuffer->sendcmd(KEEP);   #ifdef PG_STATS