6375f22000-03-26Francesco Chemolli /* * Sybase driver for the Pike programming language. * By Francesco Chemolli <kinkie@roxen.com> 10/12/1999
52510a2002-01-15Martin Nilsson  *
a59c792010-11-02Martin Stjernholm  * $Id$
6375f22000-03-26Francesco Chemolli  * */
a580e12000-09-27Fredrik Hübinette (Hubbe) #pike __REAL_VERSION__
a20af62000-09-26Fredrik Hübinette (Hubbe) 
a59c792010-11-02Martin Stjernholm // Cannot dump this since the #if constant(...) check below may depend // on the presence of system libs at runtime. constant dont_dump_program = 1;
6f7b202004-04-16Henrik Grubbström (Grubba) #if constant(sybase.sybase)
6375f22000-03-26Francesco Chemolli  inherit sybase.sybase:mo; #define THROW(X) throw(({X+"\n",backtrace()})) /* * Deprecated. Use connect(host,db,user,pass) instead. */ void select_db(string db) { mo::big_query("use "+db); } /* * Deprecated. Use an SQL command instead. */ void create_db (string dbname) { mo::big_query("create database "+dbname); } /* * Deprecated. Use an SQL command instead. */ 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,
1dc3fb2008-01-09Martin Stjernholm  void|string _pass) { string pass = _pass; _pass = "CENSORED";
6375f22000-03-26Francesco Chemolli  mo::create(host||"",db||"",user||"",pass||""); if (db && stringp(db) && sizeof(db)) { mo::big_query("use "+db); } }
6458a72000-04-29Francesco Chemolli int|object big_query(string q, mapping(string|int:mixed)|void bindings) { if (!bindings) return ::big_query(q);
d7bd0e2003-12-31Martin Nilsson  return ::big_query(.sql_util.emulate_bindings(q,bindings,this));
6458a72000-04-29Francesco Chemolli }
ffaf452004-04-14Martin Nilsson #else constant this_program_does_not_exist=1;
6375f22000-03-26Francesco Chemolli #endif