Skip to content
Snippets Groups Projects
Select Git revision
  • 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.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
  • v8.0.1964
40 results

dsn.pike

Blame
  • dsn.pike 1.22 KiB
    /*
     * Glue for the ODBC-module
     *
     * Carl Grubbström 2005-01-26
     */
    
    #pike __REAL_VERSION__
    #require constant(Odbc.odbc)
    
    // Cannot dump this since the #require check below depend on the
    // presence of system libs at runtime.
    constant dont_dump_program = 1;
    
    inherit Odbc.odbc;
    
    void create(string|void host, string|void db, string|void user,
    	    string|void password, mapping(string:int|string)|void options)
    {
      // FIXME: Quoting?
      string connectstring="";
      if(user)
        connectstring+="uid="+user+";";
      if(password)
        connectstring+="pwd="+password+";";
      if(host)
        if(sizeof(host)>0)
          connectstring+="dsn="+host+";";
      if(db)
        if(sizeof(db)>0)
        {
          if (has_suffix(lower_case(db), ".dsn")) // check if file is a dsn file
            connectstring+="filedsn="+db+";";
          else
            connectstring+="dbq="+db+";";
        }
      if(mappingp(options))
      {
        foreach(indices(options),string ind)
        {
          connectstring+=ind+"="+options[ind]+";";
        }
      }
      ::create_dsn(connectstring);
    }
    
    int|object big_query(object|string q, mapping(string|int:mixed)|void bindings)
    {  
      if (!bindings)
        return ::big_query(q);
      return ::big_query(.sql_util.emulate_bindings(q, bindings, this));
    }
    
    constant list_dbs = Odbc.list_dbs;