3709192002-03-20Martin Nilsson #pike __REAL_VERSION__
36d2b82001-09-06Martin Nilsson //! The SQL module is a unified interface between pike and all //! its supported databases. The parts of this module that is //! usuable for all normal uses is the @[Sql] class and the //! @[sql_result] class. //! //! @example //! string people_in_group(string group) { //! Sql.Sql db = Sql.Sql("mysql://localhost/testdb"); //! return db->query("SELECT name FROM users WHERE " //! "group=%s", group)->name * ","; //! }
dbe50e2009-11-09Henrik Grubbström (Grubba) 
3700122010-11-23Martin Stjernholm //! @ignore // Use getters and Val-> to ensure dynamic resolving in case the // values in Val.pmod are replaced. program `->Null() {return Val->Null;} Val.Null `->NULL() {return Val->null;} //! @endignore
dbe50e2009-11-09Henrik Grubbström (Grubba) 
e796b22011-01-07Henrik Grubbström (Grubba) //! @class Null //! Class used to implement the SQL NULL value. //!
9a3d002011-01-09Henrik Grubbström (Grubba) //! @deprecated Val.Null
e796b22011-01-07Henrik Grubbström (Grubba) //! //! @seealso
83045c2011-03-05Martin Stjernholm //! @[Val.Null], @[Val.null]
e796b22011-01-07Henrik Grubbström (Grubba)  //! @endclass
3700122010-11-23Martin Stjernholm //! @decl Val.Null NULL; //!
e796b22011-01-07Henrik Grubbström (Grubba) //! The SQL NULL value. //! //! @deprecated Val.null //! //! @seealso //! @[Val.null]
840eaa2015-10-07Henrik Grubbström (Grubba)  //! Redact the password (if any) from an Sql-url. //! //! @param sql_url //! Sql-url possibly containing an unredacted password. //! //! @returns //! Returns the same Sql-url but with the password (if any) //! replaced by the string @expr{"CENSORED"@}. string censor_sql_url(string sql_url) { array(string) a = sql_url/"://"; string prot = a[0]; string host = a[1..] * "://"; a = host/"@"; if (sizeof(a) > 1) { host = a[-1]; a = (a[..<1] * "@")/":"; string user = a[0]; if (sizeof(a) > 1) { sql_url = prot + "://" + user + ":CENSORED@" + host; } } return sql_url; }