diff --git a/lib/modules/Sql.pmod/Sql.pike b/lib/modules/Sql.pmod/Sql.pike
index 2b323af6c6ff2f094ebb6c5aac5d08e1e7f8a55a..f8540482ceffa864eb22ad96c9b90249ba53386a 100644
--- a/lib/modules/Sql.pmod/Sql.pike
+++ b/lib/modules/Sql.pmod/Sql.pike
@@ -1,5 +1,5 @@
 /*
- * $Id: Sql.pike,v 1.64 2003/04/07 17:17:31 nilsson Exp $
+ * $Id: Sql.pike,v 1.65 2003/04/22 18:02:30 nilsson Exp $
  *
  * Implements the generic parts of the SQL-interface
  *
@@ -10,7 +10,7 @@
 
 //! Implements those functions that need not be present in all SQL-modules.
 
-#define throw_error(X)	throw(({ (X), backtrace() }))
+#define ERROR(X ...)	predef::error(X)
 
 //! Object to use for the actual SQL-queries.
 object master_sql;
@@ -134,8 +134,8 @@ void create(void|string|object host, void|string|mapping(string:int|string) db,
     master_sql = host;
     if ((user && user != "") || (password && password != "") ||
 	(options && sizeof(options))) {
-      throw_error("Sql.sql(): Only the database argument is supported when "
-		  "first argument is an object\n");
+      ERROR("Only the database argument is supported when "
+	    "first argument is an object\n");
     }
     if (db && db != "") {
       master_sql->select_db(db);
@@ -202,13 +202,12 @@ void create(void|string|object host, void|string|mapping(string:int|string) db,
     }
 
     if (!program_name) {
-      throw_error("Sql.Sql(): No protocol specified.\n");
+      ERROR("No protocol specified.\n");
     }
     /* Don't call ourselves... */
     if ((sizeof(program_name / "_result") != 1) ||
 	(lower_case(program_name[..2]) == "sql")) {
-      throw_error(sprintf("Sql.Sql(): Unsupported protocol: %O\n",
-			  program_name));
+      ERROR("Unsupported protocol: %O\n", program_name);
     }
 
 
@@ -231,8 +230,7 @@ void create(void|string|object host, void|string|mapping(string:int|string) db,
 	master_sql = p();
       }
     } else {
-      throw_error(sprintf("Sql.sql(): Failed to index module Sql.%s\n",
-			  program_name));
+      ERROR("Failed to index module Sql.%s\n", program_name);
     }
   }
 
@@ -325,7 +323,7 @@ private array(string|mapping(string|int:mixed)) handle_extraargs(string query, a
       b[args[j]] = s;
       continue;
     }
-    throw_error("Wrong type to query argument #"+(j+1)+"\n");
+    ERROR("Wrong type to query argument #"+(j+1)+"\n");
   }
   return ({sprintf(query,@args), b});
 }
@@ -444,7 +442,7 @@ void shutdown()
   if (functionp(master_sql->shutdown)) {
     master_sql->shutdown();
   } else {
-    throw_error("sql->shutdown(): Not supported by this database\n");
+    ERROR("Not supported by this database\n");
   }
 }
 
diff --git a/lib/modules/Sql.pmod/rsql.pike b/lib/modules/Sql.pmod/rsql.pike
index 6b859a763d3fb225d33c97e4d2209cd9bb8f2ee0..857d6198e241bfb399dc7bb13499ebbf53e2b136 100644
--- a/lib/modules/Sql.pmod/rsql.pike
+++ b/lib/modules/Sql.pmod/rsql.pike
@@ -5,7 +5,6 @@
 #define RSQL_PORT 3994
 #define RSQL_VERSION 1
 
-
 #if constant(thread_create)
 #define LOCK object key=mutex->lock()
 #define UNLOCK destruct(key)
@@ -15,6 +14,7 @@ static private object(Thread.Mutex) mutex = Thread.Mutex();
 #define UNLOCK
 #endif
 
+#define ERROR(X ...) predef::error(X)
 
 static object(Stdio.File) sock;
 static int seqno = 0;
@@ -28,21 +28,19 @@ static void low_reconnect()
   if(sock)
     destruct(sock);
   if(!losock->connect(host, port|RSQL_PORT))
-    throw(({"Can't connect to "+host+(port? ":"+port:"")+": "+
-	    strerror(losock->errno())+"\n", backtrace()}));
-  if(8!=losock->write(sprintf("RSQL%4c", RSQL_VERSION)) ||
+    ERROR("Can't connect to "+host+(port? ":"+port:"")+": "+
+	  strerror(losock->errno())+"\n");
+  if(8!=losock->write("RSQL%4c", RSQL_VERSION) ||
      losock->read(4) != "SQL!") {
     destruct(losock);
-    throw(({"Initial handshake error on "+host+(port? ":"+port:"")+"\n",
-	    backtrace()}));    
+    ERROR("Initial handshake error on "+host+(port? ":"+port:"")+"\n");
   }
   sock = losock;
   if(!do_request('L', ({user,pw}), 1)) {
     sock = 0;
     if(losock)
       destruct(losock);
-    throw(({"Login refused on "+host+(port? ":"+port:"")+"\n",
-	    backtrace()}));        
+    ERROR("Login refused on "+host+(port? ":"+port:"")+"\n");
   }
 }
 
@@ -62,11 +60,11 @@ static mixed do_request(int cmd, mixed|void arg, int|void noreconnect)
   if(!sock)
     if(noreconnect) {
       UNLOCK;
-      throw(({"No connection\n", backtrace()}));
+      ERROR("No connection\n");
     } else
       low_reconnect();
   arg = (arg? encode_value(arg) : "");
-  sock->write(sprintf("?<%c>%4c%4c%s", cmd, ++seqno, sizeof(arg), arg));
+  sock->write("?<%c>%4c%4c%s", cmd, ++seqno, sizeof(arg), arg);
   string res;
   int rlen;
   if((res = sock->read(12)) && sizeof(res)==12 &&
@@ -77,21 +75,21 @@ static mixed do_request(int cmd, mixed|void arg, int|void noreconnect)
       destruct(sock);
       UNLOCK;
       if(noreconnect)
-	throw(({"RSQL Phase error, disconnected\n", backtrace()}));
+	ERROR("RSQL Phase error, disconnected\n");
       else return do_request(cmd, arg, 1);
     }
     UNLOCK;
     rdat = (sizeof(rdat)? decode_value(rdat):0);
     switch(res[0]) {
     case '.': return rdat;
-    case '!': throw(rdat);
+    case '!': ERROR(rdat);
     }
-    throw(({"Internal error\n", backtrace()}));    
+    ERROR("Internal error\n");
   } else {
     destruct(sock);
     UNLOCK;
     if(noreconnect)
-      throw(({"RSQL Phase error, disconnected\n", backtrace()}));
+      ERROR("RSQL Phase error, disconnected\n");
     else return do_request(cmd, arg, 1);
   }
 }
diff --git a/lib/modules/Sql.pmod/sql_util.pmod b/lib/modules/Sql.pmod/sql_util.pmod
index 60e1e87f6db4ab356ea2301a2b3895c68199478a..238f50f3cb43fd18cfece1538a48853a900021c8 100644
--- a/lib/modules/Sql.pmod/sql_util.pmod
+++ b/lib/modules/Sql.pmod/sql_util.pmod
@@ -1,5 +1,5 @@
 /*
- * $Id: sql_util.pmod,v 1.10 2001/12/04 14:42:42 nilsson Exp $
+ * $Id: sql_util.pmod,v 1.11 2003/04/22 18:02:53 nilsson Exp $
  *
  * Some SQL utility functions.
  * They are kept here to avoid circular references.
@@ -23,7 +23,7 @@ string quote(string s)
 //! Throw an error in case an unimplemented function is called.
 void fallback()
 {
-  throw(({ "Function not supported in this database.", backtrace() }));
+  error( "Function not supported in this database." );
 }
 
 //! Build a raw SQL query, given the cooked query and the variable bindings