Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

winmain.cpp File Reference

#include "stlhelper.h"
#include <config-win.h>
#include <mysql.h>
#include <libmysqlwrapped.h>
#include <stdio.h>
#include <windows.h>
#include <shellapi.h>
#include "resource.h"
#include <socket_include.h>
#include <SocketHandler.h>
#include <HttpGetSocket.h>
#include <process.h>
#include "MinderSocket.h"
#include <commctrl.h>
#include "MyErrlog.h"
#include "MyApp.h"

Include dependency graph for winmain.cpp:

Include dependency graph

Go to the source code of this file.

Defines

#define STL_USING_MAP
#define STL_USING_STRING
#define STL_USING_VECTOR
#define STL_USING_LIST

Functions

int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)


Define Documentation

#define STL_USING_LIST
 

Definition at line 25 of file winmain.cpp.

#define STL_USING_MAP
 

File ......... winmain.cpp Published .... 2004-09-27

Definition at line 22 of file winmain.cpp.

#define STL_USING_STRING
 

Definition at line 23 of file winmain.cpp.

#define STL_USING_VECTOR
 

Definition at line 24 of file winmain.cpp.


Function Documentation

int APIENTRY WinMain HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpCmdLine,
int  nCmdShow
 

Definition at line 49 of file winmain.cpp.

References MyApp::Init().

00050 { 00051 const char *server_groups[] = {"test_libmysqld_SERVER","embedded","server",NULL}; 00052 /* 00053 const char *server_argv[] = {"main", 00054 "--datadir=.", 00055 "--set-variable=key_buffer_size=32M"}; 00056 int server_argc = sizeof(server_argv) / sizeof(char *); 00057 */ 00058 // 00059 { 00060 int i; 00061 char *argv[10]; 00062 char temp_path[1000]; 00063 ::GetTempPath(1000, temp_path); 00064 00065 for (i = 0; i < 10; i++) 00066 argv[i] = NULL; 00067 00068 argv[0] = new char[100]; 00069 strcpy(argv[0], "fd.exe"); 00070 argv[1] = new char[1000]; 00071 sprintf(argv[1], "--datadir=%s", temp_path); 00072 argv[2] = new char[100]; 00073 strcpy(argv[2], "--language=."); 00074 argv[3] = new char[100]; 00075 strcpy(argv[3], "--skip-innodb"); 00076 argv[4] = new char[100]; 00077 strcpy(argv[4], "--set-variable=key_buffer_size=8M"); 00078 argv[5] = new char[100]; 00079 strcpy(argv[5], "--set-variable=sort_buffer_size=1M"); 00080 00081 int argc = 6; 00082 if (mysql_server_init(argc, argv, (char **)server_groups)) 00083 { 00084 ::MessageBox(NULL, "mysql_server_init() failed", "MySQL", MB_OK); 00085 return -1; 00086 } 00087 00088 // 00089 if (!mysql_thread_safe()) 00090 { 00091 ::MessageBox(NULL, "You are using a non thread safe libmysqld", "Warning", MB_OK); 00092 } 00093 00094 // Database instances get their own scope, not one must live when we call 00095 // mysql_server_end() below 00096 { 00097 MyErrlog log; 00098 { 00099 Database db("fd",&log); 00100 if (!db.Connected()) 00101 { 00102 // Create a temporary Database and create our 'finder' database 00103 Database db("",&log); 00104 Query q(db); 00105 00106 if (!q.Connected()) 00107 { 00108 ::MessageBox(NULL, "Not connected", "Query", MB_OK); 00109 } 00110 00111 q.execute("create database fd"); 00112 q.execute("use fd"); 00113 00114 // database was created, now create tables then exit 00115 q.execute("CREATE TABLE category (" 00116 " num int(11) NOT NULL auto_increment," 00117 " name varchar(255) default NULL," 00118 " PRIMARY KEY (num)" 00119 ") TYPE=MyISAM;"); 00120 00121 q.execute("CREATE TABLE item (" 00122 " num int(11) NOT NULL auto_increment," 00123 " typ enum('File','URL') NOT NULL default 'File'," 00124 " category int(11) NOT NULL default '0'," 00125 " name varchar(255)," 00126 " data mediumtext NOT NULL," 00127 " sz integer," 00128 " sha1 char(40)," 00129 " PRIMARY KEY (num)," 00130 " KEY typ (typ,category)," 00131 " KEY category (category)," 00132 " UNIQUE(sz,sha1)" 00133 ") TYPE=MyISAM;"); 00134 00135 q.execute("CREATE TABLE linkitemtag (" 00136 " item int(11) NOT NULL default '0'," 00137 " tag int(11) NOT NULL default '0'," 00138 " PRIMARY KEY (item,tag)," 00139 " KEY tag (tag)" 00140 ") TYPE=MyISAM;"); 00141 00142 q.execute("CREATE TABLE tag (" 00143 " num int(11) NOT NULL auto_increment," 00144 " name varchar(255) default NULL," 00145 " PRIMARY KEY (num)" 00146 ") TYPE=MyISAM;"); 00147 00148 } // if (!db.Connected) 00149 } 00150 // Start application 00151 { 00152 Database db("fd", &log); 00153 // database update scope 00154 { 00155 Query q(db); 00156 } // end of database update scope 00157 MyApp app(hInstance, hPrevInstance, db); 00158 app.Init(lpCmdLine, nCmdShow); 00159 } 00160 } // scope of mysql connections 00161 mysql_server_end(); 00162 00163 // clean up 00164 for (i = 0; i < 10; i++) 00165 { 00166 if (argv[i]) 00167 delete[] argv[i]; 00168 } 00169 } 00170 00171 return 0; 00172 }


Generated on Thu Feb 10 22:42:40 2005 for Distributed URL Classification Tool by doxygen 1.3.7