Roxen.git
/
server
/
base_server
/
module.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/base_server/module.pike:1:
// This file is part of Roxen WebServer. // Copyright © 1996 - 2001, Roxen IS.
-
// $Id: module.pike,v 1.
117
2001/
06
/
30
15
:
44
:
04
mast
Exp $
+
// $Id: module.pike,v 1.
118
2001/
07
/
31
07
:
42
:
56
per
Exp $
#include <module_constants.h> #include <module.h> #include <request_trace.h> constant __pragma_save_parent__ = 1; inherit "basic_defvar"; mapping(string:array(int)) error_log=([]);
Roxen.git/server/base_server/module.pike:372:
//! cache_table = get_my_table( "cache", ({ //! "id INT UNSIGNED AUTO_INCREMENT", //! "data BLOB", //! }) ); //! @} //! //! In the second form, the whole table defenition is instead sent as //! a string. The cases where the name is not included (the third and //! fourth form) is equivalent to the first two cases with the name "" //!
-
//! If the table does not exist in the datbase, it is created.
If it
-
//! exists, but it's defenition is different, the table will be
-
//! altered with a ALTER TABLE call to conform to the defenition. This
-
//! might not work if the database the table resides in is not a MySQL
-
//! database (normally it is, but it's possible, using @[set_my_db],
-
//! to change this).
+
//! If the table does not exist in the datbase, it is created.
//!
-
+
// If it exists, but it's defenition is different, the table will be
+
// altered with a ALTER TABLE call to conform to the defenition. This
+
// might not work if the database the table resides in is not a MySQL
+
// database (normally it is, but it's possible, using @[set_my_db],
+
// to change this).
+
//
//! @note This function may not be called from create { if( !defenition ) { defenition = name; name = ""; } else if(strlen(name)) name = "_"+name;
Roxen.git/server/base_server/module.pike:418:
if( error ) { if( strlen( name ) ) name = " "+name; report_notice( "Failed to create table"+name+": "+ describe_error( error ) ); return 0; } return res; }
-
-
-
// Update defenition if it has changed. For now, always update.
-
// This might be a tad ineffective if this function is called
-
// often, but mysql at least seems to ignore ALTER TABLE calls
-
// when the defenition has not changed.
-
mixed error =
-
catch
-
{
-
get_my_sql()->query( "ALTER TABLE "+res+" ("+defenition+")" );
-
};
-
if( error )
-
{
-
if( strlen( name ) )
-
name = " for "+name;
-
report_notice( "Failed to update table defenition"+name+": "+
-
describe_error( error ) );
-
}
+
//
// Update defenition if it has changed. For now, always update.
+
//
// This might be a tad ineffective if this function is called
+
//
// often, but mysql at least seems to ignore ALTER TABLE calls
+
//
// when the defenition has not changed.
+
//
mixed error =
+
//
catch
+
//
{
+
//
get_my_sql()->query( "ALTER TABLE "+res+" ("+defenition+")" );
+
//
};
+
//
if( error )
+
//
{
+
//
if( strlen( name ) )
+
//
name = " for "+name;
+
//
report_notice( "Failed to update table defenition"+name+": "+
+
//
describe_error( error ) );
+
//
}
return res; } string my_db = "shared"; void set_my_db( string to ) //! Select the database in which tables will be created with //! get_my_table, and also the one that will be returned by //! @[get_my_sql] {