Skip to content
Snippets Groups Projects
Select Git revision
  • 699effbb1bb7c4de198d2a13587ea0f36f0dc92d
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

PikeObjects.pmod

Blame
  • sybase.pike 2.29 KiB
    /*
     * Sybase driver for the Pike programming language.
     * By Francesco Chemolli <kinkie@roxen.com> 10/12/1999
     *
     */
    
    #pike __REAL_VERSION__
    #require constant(sybase.sybase)
    
    // Cannot dump this since the #require check may depend on the
    // presence of system libs at runtime.
    constant dont_dump_program = 1;
    
    inherit sybase.sybase:mo;
    #define THROW(X) throw(({X+"\n",backtrace()}))
    
    
    /*
     * Deprecated. Use connect(host,db,user,pass) instead.
     */
    __deprecated__ void select_db(string db)
    {
      mo::big_query("use "+db);
    }
    
    /*
     * Deprecated. Use an SQL command instead.
     */
    __deprecated__ void create_db (string dbname) {
      mo::big_query("create database "+dbname);
    }
    
    /*
     * Deprecated. Use an SQL command instead.
     */
    __deprecated__ void drop_db (string dbname) {
      mo::big_query("drop database "+dbname);
    }
    
    void shutdown() {
      catch { //there _will_ be an error. It's just that we don't care about it.
        mo::big_query("shutdown");
      };
    }
    
    string server_info () {
      return "sybase/10.X or 11.X";
    }
    
    /*
     * Unimplemented. Anyone knows Transact-SQL well enough?
     * maybe we could use the connection properties otherwise (CS_HOSTNAME)
     */
    string host_info() {
      return "unknown";
    }
    
    /*
     * Unimplemented. Anyone knows Transact-SQL well enough?
     */
    array(string) list_dbs(string|void wild) {
      THROW("Unsupported");
    }
    
    /*
     * Unimplemented. PLEASE tell me somebody knows how to do this.
     * There MUST be some system stored procedure...
     */
    array(string) list_tables(string|void wild) {
      THROW("Unsupported");
    }
    
    /*
     * Unimplemented.
     */
    array(string) list_fields(string|void wild) {
      THROW("Unsupported");
    }
    
    int num_rows() {
      THROW("Unsupported by the DB server");
    }
    
    void seek(int skipthismany) {
      if (skipthismany<0)
        THROW("Negative skips are not supported");
      if (!skipthismany)
        return;
      while (skipthismany && fetch_row()){
        skipthismany--;
      }
    }
    
    void create(void|string host, void|string db, void|string user,
    	    void|string _pass, void|mapping options) {
      string pass = _pass;
      _pass = "CENSORED";
      mo::create(host||"",db||"",user||"",pass||"",options);
      if (db && stringp(db) && sizeof(db)) {
        mo::big_query("use "+db);
      }
    }
    
    int|object big_query(string q, mapping(string|int:mixed)|void bindings) {
      if (!bindings)
        return ::big_query(q);
      return ::big_query(.sql_util.emulate_bindings(q,bindings,this));
    }