Roxen.git/
server/
base_server/
roxen.pike
Branch:
Tag:
Non-build tags
All tags
No tags
2000-12-30
2000-12-30 07:17:13 by Per Hedbor <ph@opera.com>
49e9ad1a4c5a44f83d732c0cf7a8fc93b5846622 (
37
lines) (+
29
/-
8
)
[
Show
|
Annotate
]
Branch:
5.2
Better messages, and a warning if the mysql is too old
Rev: server/base_server/roxen.pike:1.595
4:
// Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others. // ABS and suicide systems contributed freely by Francesco Chemolli
-
constant cvs_version="$Id: roxen.pike,v 1.
594
2000/12/30 07:
02
:
56
per Exp $";
+
constant cvs_version="$Id: roxen.pike,v 1.
595
2000/12/30 07:
17
:
13
per Exp $";
// Used when running threaded to find out which thread is the backend thread, // for debug purposes only.
87:
void start_mysql() { int st = gethrtime();
+
Sql.sql db;
+
report_notice( "Starting mysql ... ");
-
if(
!catch( connect
_
to_my_mysql
(
0, "mysql"
)
) )
+
void
connected
_
ok
(
int
was
)
{
-
report_notice("
Done
[%.1fms]\n", (gethrtime()-st)/1000.0);
+
string version = db->query( "SELECT VERSION() as v" )[0]->v;
+
report_notice("
%s
%s
[%.1fms]\n",
+
(
was?"Was running":"Done"),
+
version, (
gethrtime()-st)/1000.0);
+
if( (float)version < 3.23 )
+
report_notice( "Warning: This is a very old Mysql. "
+
"Please use 3.23.*\n");
+
};
+
+
if( !catch( db = connect_to_my_mysql( 0, "mysql" ) ) )
+
{
+
connected_ok(1);
return; }
125:
report_fatal("\nFailed to start mysql. Aborting\n"); exit(1); }
-
if( !catch( connect_to_my_mysql( 0, "mysql" ) ) )
+
if( !catch(
db =
connect_to_my_mysql( 0, "mysql" ) ) )
{
-
report
_
notice
(
"Done [%.1fms]\n", (gethrtime()-st)/1000.
0);
+
connected
_
ok
(0);
return; } }
2083:
db->query( "DELETE FROM "+name+ " WHERE id='"+q+"'" ); } }
+
catch
+
{
+
// Old versions of Mysql lacks OPTIMIZE. Not that we support
+
// them, really, but it might be nice not to throw an error, at
+
// least.
db->query( "OPTIMIZE TABLE "+name+"_data\n"); db->query( "OPTIMIZE TABLE "+name+"_meta\n");
-
+
};
db->query( "select RELEASE_LOCK('"+name+"')" ); }
3218:
argv -= ({ 0 }); argc = sizeof(argv);
+
start_mysql();
+
add_constant( "roxen.fonts", (fonts = ((program)"base_server/fonts.pike")()) );
3227:
set_locale();
-
start_mysql();
+
#if efun(syslog) init_logger();