Branch: Tag:

2014-11-10

2014-11-10 01:52:29 by Stephen R. van den Berg <srb@cuci.nl>

Stricter types.

296:    ? !!reconnected : -1;   }    - final protected object getsocket(void|int nossl) { + final protected .pgsql_util.PGassist getsocket(void|int nossl) {    return .pgsql_util.PGassist(this,qportals,(int)nossl);   }   
310:   //! through the generic SQL-interface.   void cancelquery() {    PD("CancelRequest\n"); -  object lcon=getsocket(1); +  .pgsql_util.PGassist lcon=getsocket(1);    lcon->add_int32(16)->add_int32(PG_PROTOCOL(1234,5678))    ->add_int32(backendpid)->add(cancelsecret)->sendcmd(flushsend);    lcon->close();   #ifdef PG_DEBUGMORE    PD("Closetrace %O\n",backtrace());   #endif -  object plugbuffer=c->start(1); -  foreach(qportals->peek_array();;object portal) +  .pgsql_util.PGassist plugbuffer=c->start(1); +  foreach(qportals->peek_array();;int|.pgsql_util.pgsql_result portal)    if(objectp(portal))    portal->_closeportal(plugbuffer);    plugbuffer->sendcmd(sendout);
544:    runcallback(backendpid,"_reconnect","");   }    - protected array(string) showbindings(object portal) { + protected array(string) showbindings(.pgsql_util.pgsql_result portal) {    array(string) msgs=({});    array from;    if(portal && (from = portal._params)) {
569:    msgresponse.L||"")});   }    - protected void storetiming(object portal) { + protected void storetiming(.pgsql_util.pgsql_result portal) {    mapping(string:mixed) tp=portal._tprepared;    tp.trun=gethrtime()-tp.trunstart;    m_delete(tp,"trunstart");
584:    }   }    - final void _processloop(object ci) { + final void _processloop(.pgsql_util.PGassist ci) {    int terminating=0;    int|.pgsql_util.pgsql_result portal;    mixed err;    { -  object plugbuffer=Stdio.Buffer()->add_int32(PG_PROTOCOL(3,0)); +  Stdio.Buffer plugbuffer=Stdio.Buffer()->add_int32(PG_PROTOCOL(3,0));    if(user)    plugbuffer->add("user\0")->add(user)->add_int8(0);    if(database)
1241:   //! through the generic SQL-interface.   void close() {    cancelquery(); -  if(c) -  c->sendterminate(); +  c?->sendterminate();    c=0;   }   
1278:    _delayederror=err;   }    - protected int reconnect(void|int force,void|object tt) { + protected int reconnect(void|int force) {    PD("(Re)connect\n");    if(!force) {    Thread.MutexKey lock=waitforauth->lock();
1546:   //! If specified, list only those databases matching it.   array(string) list_dbs (void|string glob) {    array row,ret=({}); -  object res=big_query("SELECT d.datname " +  .pgsql_util.pgsql_result res=big_query("SELECT d.datname "    "FROM pg_database d "    "WHERE d.datname ILIKE :glob "    "ORDER BY d.datname",
1564:   //! If specified, list only the tables with matching names.   array(string) list_tables (void|string glob) {    array row,ret=({}); // This query might not work on PostgreSQL 7.4 -  object res=big_query( // due to missing schemasupport +  .pgsql_util.pgsql_result res=big_query( // due to missing schemasupport    "SELECT CASE WHEN 'public'=n.nspname THEN '' ELSE n.nspname||'.' END "    " ||c.relname AS name "    "FROM pg_catalog.pg_class c "
1625:       sscanf(table||"*", "%s.%s", schema, table);    -  object res = big_typed_query( +  .pgsql_util.pgsql_result res = big_typed_query(    "SELECT a.attname, a.atttypid, t.typname, a.attlen, "    " c.relhasindex, c.relhaspkey, CAST(c.reltuples AS BIGINT) AS reltuples, "    " (c.relpages "
1731:    return trbackendst(backendstatus);   }    - final inline void closestatement(object plugbuffer,string oldprep) { + final inline void closestatement( +  .pgsql_util.PGassist|.pgsql_util.PGplugbuffer plugbuffer,string oldprep) {    .pgsql_util.closestatement(plugbuffer,oldprep);   }   
1791:   //! @seealso   //! @[big_typed_query()], @[Sql.Sql], @[Sql.sql_result],   //! @[Sql.Sql()->query()], @[Sql.pgsql_util.pgsql_result] - object big_query(string q,void|mapping(string|int:mixed) bindings, + .pgsql_util.pgsql_result big_query(string q, +  void|mapping(string|int:mixed) bindings,    void|int _alltyped) {    throwdelayederror(this);    string preparedname="";
1905:    tstart=gethrtime();    } else // pgsql_result autoassigns to portal    tp=UNDEFINED; -  object portal; +  .pgsql_util.pgsql_result portal;    portal=.pgsql_util.pgsql_result(this,c,q,    portalbuffersize,_alltyped,from,forcetext);    portal._tprepared=tp;
1966:   //!   //! @seealso   //! @[big_query()], @[big_typed_query()], @[Sql.Sql], @[Sql.sql_result] - object streaming_query(string q,void|mapping(string|int:mixed) bindings) { + .pgsql_util.pgsql_result streaming_query(string q, +  void|mapping(string|int:mixed) bindings) {    return big_query(q,bindings);   }   
1975:   //!   //! @seealso   //! @[big_query()], @[Sql.Sql], @[Sql.sql_result] - object big_typed_query(string q,void|mapping(string|int:mixed) bindings) { + .pgsql_util.pgsql_result big_typed_query(string q, +  void|mapping(string|int:mixed) bindings) {    return big_query(q,bindings,1);   }