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

Got rid of some circular references.

Rev: lib/modules/Sql.pmod/sql.pike:1.33
Rev: lib/modules/Sql.pmod/sql_util.pmod:1.1
parent 56164c41
No related branches found
No related tags found
No related merge requests found
...@@ -78,6 +78,7 @@ testfont binary ...@@ -78,6 +78,7 @@ testfont binary
/lib/modules/Sql.pmod/postgres.pike foreign_ident /lib/modules/Sql.pmod/postgres.pike foreign_ident
/lib/modules/Sql.pmod/sql.pike foreign_ident /lib/modules/Sql.pmod/sql.pike foreign_ident
/lib/modules/Sql.pmod/sql_result.pike foreign_ident /lib/modules/Sql.pmod/sql_result.pike foreign_ident
/lib/modules/Sql.pmod/sql_util.pmod foreign_ident
/lib/modules/Stdio.pmod foreign_ident /lib/modules/Stdio.pmod foreign_ident
/lib/modules/Stdio.pmod/Readline.pike foreign_ident /lib/modules/Stdio.pmod/Readline.pike foreign_ident
/lib/modules/Stdio.pmod/Terminfo.pmod foreign_ident /lib/modules/Stdio.pmod/Terminfo.pmod foreign_ident
......
/* /*
* $Id: sql.pike,v 1.32 1999/07/01 02:16:00 per Exp $ * $Id: sql.pike,v 1.33 1999/07/01 20:13:40 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.32 1999/07/01 02:16:00 per Exp $ //. RCSID: $Id: sql.pike,v 1.33 1999/07/01 20:13:40 grubba Exp $
//. Author: Henrik Grubbstrm (grubba@idonex.se) //. Author: Henrik Grubbstrm (grubba@idonex.se)
//. //.
//. Synopsis: Implements the generic parts of the SQL-interface. //. Synopsis: Implements the generic parts of the SQL-interface.
...@@ -35,11 +35,7 @@ int case_convert; ...@@ -35,11 +35,7 @@ int case_convert;
//. - quote //. - quote
//. Quote a string so that it can safely be put in a query. //. Quote a string so that it can safely be put in a query.
//. > s - String to quote. //. > s - String to quote.
function(string:string) quote = lambda (string s) function(string:string) quote = .sql_util.quote;
{
// This lambda is overridden from master_sql in create().
return(replace(s, "\'", "\'\'"));
};
//. - encode_time //. - encode_time
//. Converts a system time value to an appropriately formatted time //. Converts a system time value to an appropriately formatted time
...@@ -258,15 +254,13 @@ void create(void|string|object host, void|string db, ...@@ -258,15 +254,13 @@ void create(void|string|object host, void|string db,
} }
} }
function fallback =
lambda () {throw_error ("Function not supported in this database.");};
if (master_sql->quote) quote = master_sql->quote; if (master_sql->quote) quote = master_sql->quote;
encode_time = master_sql->encode_time || fallback; encode_time = master_sql->encode_time || .sql_util.fallback;
decode_time = master_sql->decode_time || fallback; decode_time = master_sql->decode_time || .sql_util.fallback;
encode_date = master_sql->encode_date || fallback; encode_date = master_sql->encode_date || .sql_util.fallback;
decode_date = master_sql->decode_date || fallback; decode_date = master_sql->decode_date || .sql_util.fallback;
encode_datetime = master_sql->encode_datetime || fallback; encode_datetime = master_sql->encode_datetime || .sql_util.fallback;
decode_datetime = master_sql->decode_datetime || fallback; decode_datetime = master_sql->decode_datetime || .sql_util.fallback;
} }
static private array(mapping(string:mixed)) res_obj_to_array(object res_obj) static private array(mapping(string:mixed)) res_obj_to_array(object res_obj)
......
/*
* $Id: sql_util.pmod,v 1.1 1999/07/01 20:13:41 grubba Exp $
*
* Some SQL utility functions.
* They are kept here to avoid circular references.
*
* Henrik Grubbström 1999-07-01
*/
//.
//. File: sql_util.pmod
//. RCSID: $Id: sql_util.pmod,v 1.1 1999/07/01 20:13:41 grubba Exp $
//. Author: Henrik Grubbström (grubba@idonex.se)
//.
//. Synopsis: Some SQL utility functions
//.
//. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//.
//. These functions are kept here mainly to avoid circular references.
//.
#define throw_error(X) throw(({ (X), backtrace() }))
//. - quote
//. Quote a string so that it can safely be put in a query.
//. > s - String to quote.
string quote(string s)
{
return(replace(s, "\'", "\'\'"));
}
//. - fallback
//. Throw an error in case an unimplemented function is called.
void fallback(void)
{
throw_error ("Function not supported in this database.");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment