Skip to content
Snippets Groups Projects
Commit c61e418b authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Added some debug-output if PIKE_SQL_DEBUG is defined.

Rev: lib/modules/Sql.pmod/sql.pike:1.7
parent c9fba686
No related branches found
No related tags found
No related merge requests found
/* /*
* $Id: sql.pike,v 1.6 1997/04/23 00:30:26 grubba Exp $ * $Id: sql.pike,v 1.7 1997/06/08 18:44:56 grubba Exp $
* *
* Implements the generic parts of the SQL-interface * Implements the generic parts of the SQL-interface
* *
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
//. //.
//. File: sql.pike //. File: sql.pike
//. RCSID: $Id: sql.pike,v 1.6 1997/04/23 00:30:26 grubba Exp $ //. RCSID: $Id: sql.pike,v 1.7 1997/06/08 18:44:56 grubba Exp $
//. Author: Henrik Grubbström (grubba@infovav.se) //. Author: Henrik Grubbström (grubba@infovav.se)
//. //.
//. Synopsis: Implements the generic parts of the SQL-interface. //. Synopsis: Implements the generic parts of the SQL-interface.
...@@ -32,7 +32,7 @@ object master_sql; ...@@ -32,7 +32,7 @@ object master_sql;
//. > host //. > host
//. object - Use this object to access the SQL-database. //. object - Use this object to access the SQL-database.
//. string - Use any available database server on this host. //. string - Use any available database server on this host.
//. If "" or 0, access through UNIX-domain socket. //. If "" or 0, access through UNIX-domain socket or similar.
//. > database //. > database
//. Select this database. //. Select this database.
//. > user //. > user
...@@ -63,19 +63,38 @@ void create(void|string|object host, void|string db, ...@@ -63,19 +63,38 @@ void create(void|string|object host, void|string db,
err = catch { err = catch {
program p = Sql[program_name]; program p = Sql[program_name];
if (password && password != "") { if (p) {
master_sql = p(host||"", db||"", user||"", password); array err2 = catch {
} else if (user && user != "") { if (password && password != "") {
master_sql = p(host||"", db||"", user); master_sql = p(host||"", db||"", user||"", password);
} else if (db && db != "") { } else if (user && user != "") {
master_sql = p(host||"", db); master_sql = p(host||"", db||"", user);
} else if (host && host != "") { } else if (db && db != "") {
master_sql = p(host); master_sql = p(host||"", db);
} else if (host && host != "") {
master_sql = p(host);
} else {
master_sql = p();
}
return;
};
#ifdef PIKE_SQL_DEBUG
if (err2) {
Stdio.stderr->write(sprintf("Sql.sql(): Failed to connect using module Sql.%s\n",
program_name));
}
} else { } else {
master_sql = p(); Stdio.stderr->write(sprintf("Sql.sql(): Failed to index module Sql.%s\n",
program_name));
#endif /* PIKE_SQL_DEBUG */
} }
return;
}; };
#ifdef PIKE_SQL_DEBUG
if (err) {
Stdio.stderr->write(sprintf("Sql.sql(): Failed to compile module Sql.%s\n",
program_name));
}
#endif /* PIKE_SQL_DEBUG */
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment