From 7311cbe7dee5980d921ec43177fd268783eb18e2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 Jun 2002 17:26:11 +0300 Subject: Updated windows files (VC++ files and winmysqladmin). Portability fixes. Removed compiler warnings. VC++Files/client/mysql.dsp: Updated to 4.0.2 VC++Files/client/mysqladmin.dsp: Updated to 4.0.2 VC++Files/client/mysqlclient.dsp: Updated to 4.0.2 VC++Files/client/mysqldump.dsp: Updated to 4.0.2 VC++Files/client/mysqlimport.dsp: Updated to 4.0.2 VC++Files/client/mysqlshow.dsp: Updated to 4.0.2 VC++Files/innobase/innobase.dsp: Updated to 4.0.2 VC++Files/libmysql/libmySQL.dsp: Updated to 4.0.2 VC++Files/libmysqltest/myTest.dsp: Updated to 4.0.2 VC++Files/merge/merge.dsp: Updated to 4.0.2 VC++Files/myisam/myisam.dsp: Updated to 4.0.2 VC++Files/mysql.dsw: Updated to 4.0.2 VC++Files/mysqlbinlog/mysqlbinlog.dsp: Updated to 4.0.2 VC++Files/mysqlcheck/mysqlcheck.dsp: Updated to 4.0.2 VC++Files/mysqlmanager/MySqlManager.dsp: Updated to 4.0.2 VC++Files/mysys/mysys.dsp: Updated to 4.0.2 VC++Files/pack_isam/pack_isam.dsp: Updated to 4.0.2 VC++Files/perror/perror.dsp: Updated to 4.0.2 VC++Files/replace/replace.dsp: Updated to 4.0.2 VC++Files/sql/mysqld.dsp: Updated to 4.0.2 VC++Files/test1/test1.dsp: Updated to 4.0.2 VC++Files/thr_insert_test/thr_insert_test.dsp: Updated to 4.0.2 VC++Files/thr_test/thr_test.dsp: Updated to 4.0.2 VC++Files/vio/vio.dsp: Updated to 4.0.2 VC++Files/zlib/zlib.dsp: Updated to 4.0.2 include/config-win.h: Added isnan() and finite() include/myisam.h: Move thr_xxx functions to myisam_priv.h myisam/mi_check.c: Portability fix. myisam/mi_locking.c: Comment cleanup myisam/myisamchk.c: Removed compiler warning myisam/myisamdef.h: Added thr_xxx functions myisam/sort.c: Portability fix sql/field.cc: Portability fix sql/sql_insert.cc: R --- VC++Files/bdb/bdb.dsp | 707 +++++++ VC++Files/client/mysql.dsp | 3 +- VC++Files/client/mysqladmin.dsp | 3 +- VC++Files/client/mysqlclient.dsp | 44 +- VC++Files/client/mysqldump.dsp | 5 +- VC++Files/client/mysqlimport.dsp | 5 +- VC++Files/client/mysqlshow.dsp | 5 +- VC++Files/innobase/innobase.dsp | 25 + VC++Files/libmysql/libmySQL.dsp | 19 +- VC++Files/libmysqld/examples/test_libmysqld.dsp | 66 + VC++Files/libmysqld/libmysqld.dsp | 405 ++++ VC++Files/libmysqltest/myTest.dsp | 3 +- VC++Files/libmysqltest/mytest.c | 170 ++ VC++Files/merge/merge.dsp | 8 - VC++Files/myisam/myisam.dsp | 8 - VC++Files/mysql.dsw | 126 ++ VC++Files/mysqlbinlog/mysqlbinlog.dsp | 2 +- VC++Files/mysqlcheck/mysqlcheck.dsp | 8 +- VC++Files/mysqldemb/mysqldemb.dsp | 392 ++++ VC++Files/mysqlmanager/MySqlManager.dsp | 3 +- VC++Files/mysqlserver/mysqlserver.dsp | 84 + VC++Files/mysqlshutdown/mysqlshutdown.c | 198 ++ VC++Files/mysqlwatch/mysqlwatch.c | 745 +++++++ VC++Files/mysys/mysys.dsp | 47 +- VC++Files/pack_isam/pack_isam.dsp | 3 +- VC++Files/perror/perror.dsp | 4 +- VC++Files/replace/replace.dsp | 3 +- VC++Files/sql/mysqld.dsp | 13 +- VC++Files/test1/test1.dsp | 3 +- VC++Files/thr_insert_test/thr_insert_test.dsp | 4 +- VC++Files/thr_test/thr_test.dsp | 3 +- VC++Files/vio/vio.dsp | 2 +- VC++Files/winmysqladmin/db.cpp | 80 + VC++Files/winmysqladmin/db.h | 32 + VC++Files/winmysqladmin/images/Goahead.ico | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/HELP.ICO | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/INFO.ICO | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/Info.bmp | Bin 0 -> 644 bytes VC++Files/winmysqladmin/images/MYINI.ICO | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/Myini.bmp | Bin 0 -> 644 bytes VC++Files/winmysqladmin/images/Noentry.ico | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/SETUP.BMP | Bin 0 -> 86878 bytes VC++Files/winmysqladmin/images/Setup 16.bmp | Bin 0 -> 86880 bytes VC++Files/winmysqladmin/images/Table.ico | Bin 0 -> 1078 bytes VC++Files/winmysqladmin/images/Working.ico | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/database.ico | Bin 0 -> 1078 bytes VC++Files/winmysqladmin/images/find.ico | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/green.ico | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/help.bmp | Bin 0 -> 644 bytes VC++Files/winmysqladmin/images/initsetup.cpp | 42 + VC++Files/winmysqladmin/images/killdb.ico | Bin 0 -> 1078 bytes VC++Files/winmysqladmin/images/logo.ico | Bin 0 -> 2022 bytes VC++Files/winmysqladmin/images/multitrg.ico | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/mysql-07.bmp | Bin 0 -> 9618 bytes VC++Files/winmysqladmin/images/mysql-17.bmp | Bin 0 -> 3806 bytes VC++Files/winmysqladmin/images/mysql.BMP | Bin 0 -> 8760 bytes VC++Files/winmysqladmin/images/red.ico | Bin 0 -> 766 bytes VC++Files/winmysqladmin/images/red22.BMP | Bin 0 -> 2104 bytes VC++Files/winmysqladmin/images/see.bmp | Bin 0 -> 644 bytes VC++Files/winmysqladmin/initsetup.cpp | 40 + VC++Files/winmysqladmin/initsetup.h | 38 + VC++Files/winmysqladmin/main.cpp | 2529 +++++++++++++++++++++++ VC++Files/winmysqladmin/main.h | 314 +++ VC++Files/winmysqladmin/mysql.h | 293 +++ VC++Files/winmysqladmin/mysql_com.h | 242 +++ VC++Files/winmysqladmin/mysql_version.h | 20 + VC++Files/winmysqladmin/winmysqladmin.cpp | 38 + VC++Files/zlib/zlib.dsp | 3 +- 68 files changed, 6691 insertions(+), 96 deletions(-) create mode 100644 VC++Files/bdb/bdb.dsp create mode 100644 VC++Files/libmysqld/examples/test_libmysqld.dsp create mode 100644 VC++Files/libmysqld/libmysqld.dsp create mode 100644 VC++Files/libmysqltest/mytest.c create mode 100644 VC++Files/mysqldemb/mysqldemb.dsp create mode 100644 VC++Files/mysqlserver/mysqlserver.dsp create mode 100644 VC++Files/mysqlshutdown/mysqlshutdown.c create mode 100644 VC++Files/mysqlwatch/mysqlwatch.c create mode 100644 VC++Files/winmysqladmin/db.cpp create mode 100644 VC++Files/winmysqladmin/db.h create mode 100644 VC++Files/winmysqladmin/images/Goahead.ico create mode 100644 VC++Files/winmysqladmin/images/HELP.ICO create mode 100644 VC++Files/winmysqladmin/images/INFO.ICO create mode 100644 VC++Files/winmysqladmin/images/Info.bmp create mode 100644 VC++Files/winmysqladmin/images/MYINI.ICO create mode 100644 VC++Files/winmysqladmin/images/Myini.bmp create mode 100644 VC++Files/winmysqladmin/images/Noentry.ico create mode 100644 VC++Files/winmysqladmin/images/SETUP.BMP create mode 100644 VC++Files/winmysqladmin/images/Setup 16.bmp create mode 100644 VC++Files/winmysqladmin/images/Table.ico create mode 100644 VC++Files/winmysqladmin/images/Working.ico create mode 100644 VC++Files/winmysqladmin/images/database.ico create mode 100644 VC++Files/winmysqladmin/images/find.ico create mode 100644 VC++Files/winmysqladmin/images/green.ico create mode 100644 VC++Files/winmysqladmin/images/help.bmp create mode 100644 VC++Files/winmysqladmin/images/initsetup.cpp create mode 100644 VC++Files/winmysqladmin/images/killdb.ico create mode 100644 VC++Files/winmysqladmin/images/logo.ico create mode 100644 VC++Files/winmysqladmin/images/multitrg.ico create mode 100644 VC++Files/winmysqladmin/images/mysql-07.bmp create mode 100644 VC++Files/winmysqladmin/images/mysql-17.bmp create mode 100644 VC++Files/winmysqladmin/images/mysql.BMP create mode 100644 VC++Files/winmysqladmin/images/red.ico create mode 100644 VC++Files/winmysqladmin/images/red22.BMP create mode 100644 VC++Files/winmysqladmin/images/see.bmp create mode 100644 VC++Files/winmysqladmin/initsetup.cpp create mode 100644 VC++Files/winmysqladmin/initsetup.h create mode 100644 VC++Files/winmysqladmin/main.cpp create mode 100644 VC++Files/winmysqladmin/main.h create mode 100644 VC++Files/winmysqladmin/mysql.h create mode 100644 VC++Files/winmysqladmin/mysql_com.h create mode 100644 VC++Files/winmysqladmin/mysql_version.h create mode 100644 VC++Files/winmysqladmin/winmysqladmin.cpp (limited to 'VC++Files') diff --git a/VC++Files/bdb/bdb.dsp b/VC++Files/bdb/bdb.dsp new file mode 100644 index 00000000000..bed306fc3d0 --- /dev/null +++ b/VC++Files/bdb/bdb.dsp @@ -0,0 +1,707 @@ +# Microsoft Developer Studio Project File - Name="bdb" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=bdb - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "bdb.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "bdb.mak" CFG="bdb - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "bdb - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "bdb - Win32 Max" (based on "Win32 (x86) Static Library") +!MESSAGE "bdb - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "bdb - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /I "../bdb/build_win32" /I "../bdb/include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c +# SUBTRACT CPP /Fr +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"..\lib_debug\bdb.lib" + +!ELSEIF "$(CFG)" == "bdb - Win32 Max" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "bdb___Win32_Max" +# PROP BASE Intermediate_Dir "bdb___Win32_Max" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "bdb___Win32_Max" +# PROP Intermediate_Dir "bdb___Win32_Max" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /I "../bdb/build_win32" /I "../bdb/include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c +# SUBTRACT BASE CPP /Fr +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../bdb/include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fo"mysys___Win32_Max/" /Fd"mysys___Win32_Max/" /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\lib_debug\bdb.lib" +# ADD LIB32 /nologo /out:"..\lib_release\bdb.lib" + +!ELSEIF "$(CFG)" == "bdb - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "bdb___Win32_Release" +# PROP BASE Intermediate_Dir "bdb___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "bdb___Win32_Release" +# PROP Intermediate_Dir "bdb___Win32_Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../bdb/include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fo"mysys___Win32_Max/" /Fd"mysys___Win32_Max/" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../bdb/build_win32" /I "../bdb/include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /Fo"mysys___Win32_Max/" /Fd"mysys___Win32_Max/" /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\lib_release\bdb.lib" +# ADD LIB32 /nologo /out:"..\lib_release\bdb.lib" + +!ENDIF + +# Begin Target + +# Name "bdb - Win32 Debug" +# Name "bdb - Win32 Max" +# Name "bdb - Win32 Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\btree\bt_compare.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_conv.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_curadj.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_cursor.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_delete.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_method.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_open.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_put.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_rec.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_reclaim.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_recno.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_rsearch.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_search.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_split.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_stat.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_upgrade.c +# End Source File +# Begin Source File + +SOURCE=.\btree\bt_verify.c +# End Source File +# Begin Source File + +SOURCE=.\btree\btree_auto.c +# End Source File +# Begin Source File + +SOURCE=.\db\crdel_auto.c +# End Source File +# Begin Source File + +SOURCE=.\db\crdel_rec.c +# End Source File +# Begin Source File + +SOURCE=.\cxx\cxx_app.cpp +# End Source File +# Begin Source File + +SOURCE=.\cxx\cxx_except.cpp +# End Source File +# Begin Source File + +SOURCE=.\cxx\cxx_lock.cpp +# End Source File +# Begin Source File + +SOURCE=.\cxx\cxx_log.cpp +# End Source File +# Begin Source File + +SOURCE=.\cxx\cxx_mpool.cpp +# End Source File +# Begin Source File + +SOURCE=.\cxx\cxx_table.cpp +# End Source File +# Begin Source File + +SOURCE=.\cxx\cxx_txn.cpp +# End Source File +# Begin Source File + +SOURCE=.\db\db.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_am.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_auto.c +# End Source File +# Begin Source File + +SOURCE=.\common\db_byteorder.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_cam.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_conv.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_dispatch.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_dup.c +# End Source File +# Begin Source File + +SOURCE=.\common\db_err.c +# End Source File +# Begin Source File + +SOURCE=.\common\db_getlong.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_iface.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_join.c +# End Source File +# Begin Source File + +SOURCE=.\common\db_log2.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_meta.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_method.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_overflow.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_pr.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_rec.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_reclaim.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_ret.c +# End Source File +# Begin Source File + +SOURCE=.\env\db_salloc.c +# End Source File +# Begin Source File + +SOURCE=.\env\db_shash.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_upg.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_upg_opd.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_vrfy.c +# End Source File +# Begin Source File + +SOURCE=.\db\db_vrfyutil.c +# End Source File +# Begin Source File + +SOURCE=.\dbm\dbm.c +# End Source File +# Begin Source File + +SOURCE=.\env\env_method.c +# End Source File +# Begin Source File + +SOURCE=.\env\env_open.c +# End Source File +# Begin Source File + +SOURCE=.\env\env_recover.c +# End Source File +# Begin Source File + +SOURCE=.\env\env_region.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_auto.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_conv.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_dup.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_func.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_meta.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_method.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_page.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_rec.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_reclaim.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_stat.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_upgrade.c +# End Source File +# Begin Source File + +SOURCE=.\hash\hash_verify.c +# End Source File +# Begin Source File + +SOURCE=.\hsearch\hsearch.c +# End Source File +# Begin Source File + +SOURCE=.\lock\lock.c +# End Source File +# Begin Source File + +SOURCE=.\lock\lock_conflict.c +# End Source File +# Begin Source File + +SOURCE=.\lock\lock_deadlock.c +# End Source File +# Begin Source File + +SOURCE=.\lock\lock_method.c +# End Source File +# Begin Source File + +SOURCE=.\lock\lock_region.c +# End Source File +# Begin Source File + +SOURCE=.\lock\lock_stat.c +# End Source File +# Begin Source File + +SOURCE=.\lock\lock_util.c +# End Source File +# Begin Source File + +SOURCE=.\log\log.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_archive.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_auto.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_compare.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_findckp.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_get.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_method.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_put.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_rec.c +# End Source File +# Begin Source File + +SOURCE=.\log\log_register.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_alloc.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_bh.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_fget.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_fopen.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_fput.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_fset.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_method.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_region.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_register.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_stat.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_sync.c +# End Source File +# Begin Source File + +SOURCE=.\mp\mp_trickle.c +# End Source File +# Begin Source File + +SOURCE=.\mutex\mut_tas.c +# End Source File +# Begin Source File + +SOURCE=.\mutex\mutex.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_abs.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_alloc.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_dir.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_errno.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_fid.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_finit.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_fsync.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_handle.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_map.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_method.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_oflags.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_open.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_region.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_rename.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_root.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_rpath.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_rw.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_seek.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_sleep.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_spin.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_stat.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_tmpdir.c +# End Source File +# Begin Source File + +SOURCE=.\os_win32\os_type.c +# End Source File +# Begin Source File + +SOURCE=.\os\os_unlink.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_auto.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_conv.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_files.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_method.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_open.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_rec.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_stat.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_upgrade.c +# End Source File +# Begin Source File + +SOURCE=.\qam\qam_verify.c +# End Source File +# Begin Source File + +SOURCE=.\clib\strcasecmp.c +# End Source File +# Begin Source File + +SOURCE=.\txn\txn.c +# End Source File +# Begin Source File + +SOURCE=.\txn\txn_auto.c +# End Source File +# Begin Source File + +SOURCE=.\txn\txn_rec.c +# End Source File +# Begin Source File + +SOURCE=.\txn\txn_region.c +# End Source File +# Begin Source File + +SOURCE=.\common\util_log.c +# End Source File +# Begin Source File + +SOURCE=.\common\util_sig.c +# End Source File +# Begin Source File + +SOURCE=.\xa\xa.c +# End Source File +# Begin Source File + +SOURCE=.\xa\xa_db.c +# End Source File +# Begin Source File + +SOURCE=.\xa\xa_map.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# End Target +# End Project diff --git a/VC++Files/client/mysql.dsp b/VC++Files/client/mysql.dsp index 1cefdd2b67b..4c9819bacde 100644 --- a/VC++Files/client/mysql.dsp +++ b/VC++Files/client/mysql.dsp @@ -68,8 +68,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/client/mysqladmin.dsp b/VC++Files/client/mysqladmin.dsp index 82794da57cb..278bcdae8b0 100644 --- a/VC++Files/client/mysqladmin.dsp +++ b/VC++Files/client/mysqladmin.dsp @@ -67,8 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/client/mysqlclient.dsp b/VC++Files/client/mysqlclient.dsp index 376febc6d36..5e3fbcd060e 100644 --- a/VC++Files/client/mysqlclient.dsp +++ b/VC++Files/client/mysqlclient.dsp @@ -65,8 +65,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_TLS" /FD /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe @@ -172,18 +171,6 @@ SOURCE=..\libmysql\get_password.c # End Source File # Begin Source File -SOURCE=..\mysys\getopt.c -# End Source File -# Begin Source File - -SOURCE=..\mysys\getopt1.c -# End Source File -# Begin Source File - -SOURCE=..\mysys\getvar.c -# End Source File -# Begin Source File - SOURCE=..\strings\int2str.c # End Source File # Begin Source File @@ -232,6 +219,19 @@ SOURCE=..\mysys\mf_iocache.c # End Source File # Begin Source File +SOURCE=..\mysys\mf_iocache2.c + +!IF "$(CFG)" == "mysqlclient - Win32 Release" + +!ELSEIF "$(CFG)" == "mysqlclient - Win32 Debug" + +# ADD CPP /Od + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=..\mysys\mf_loadpath.c # End Source File # Begin Source File @@ -292,6 +292,14 @@ SOURCE=..\mysys\my_fstream.c # End Source File # Begin Source File +SOURCE=..\mysys\my_gethostbyname.c +# End Source File +# Begin Source File + +SOURCE=..\mysys\my_getopt.c +# End Source File +# Begin Source File + SOURCE=..\mysys\my_getwd.c # End Source File # Begin Source File @@ -368,6 +376,10 @@ SOURCE=..\mysys\my_thr_init.c # End Source File # Begin Source File +SOURCE=..\mysys\my_vsnprintf.c +# End Source File +# Begin Source File + SOURCE=..\mysys\my_wincond.c # End Source File # Begin Source File @@ -468,6 +480,10 @@ SOURCE=..\strings\strxmov.c # End Source File # Begin Source File +SOURCE=..\strings\strxnmov.c +# End Source File +# Begin Source File + SOURCE=..\mysys\thr_mutex.c # End Source File # Begin Source File diff --git a/VC++Files/client/mysqldump.dsp b/VC++Files/client/mysqldump.dsp index dcf1c1435a6..448ba126153 100644 --- a/VC++Files/client/mysqldump.dsp +++ b/VC++Files/client/mysqldump.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -67,8 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/client/mysqlimport.dsp b/VC++Files/client/mysqlimport.dsp index f10c1f90f58..5de3b68dd4e 100644 --- a/VC++Files/client/mysqlimport.dsp +++ b/VC++Files/client/mysqlimport.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -68,8 +68,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/client/mysqlshow.dsp b/VC++Files/client/mysqlshow.dsp index dd0fc09c70f..329f128d1b6 100644 --- a/VC++Files/client/mysqlshow.dsp +++ b/VC++Files/client/mysqlshow.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -67,8 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp index 5159d513e87..c3084bfa799 100644 --- a/VC++Files/innobase/innobase.dsp +++ b/VC++Files/innobase/innobase.dsp @@ -20,6 +20,7 @@ CFG=innobase - Win32 Max !MESSAGE "innobase - Win32 Max" (based on "Win32 (x86) Static Library") !MESSAGE "innobase - Win32 Max nt" (based on "Win32 (x86) Static Library") !MESSAGE "innobase - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "innobase - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project @@ -98,6 +99,29 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:"..\lib_release\innobase-nt.lib" # ADD LIB32 /nologo /out:"..\lib_debug\innodb.lib" +!ELSEIF "$(CFG)" == "innobase - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "innobase___Win32_Release" +# PROP BASE Intermediate_Dir "innobase___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "innobase___Win32_Release" +# PROP Intermediate_Dir "innobase___Win32_Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../innobase/include" /I "../include" /D "NDEBUG" /D "_LIB" /D "_WIN32" /D "WIN32" /D "_MBCS" /D "MYSQL_SERVER" /YX /FD /c +# ADD BASE RSC /l 0x416 /d "NDEBUG" +# ADD RSC /l 0x416 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo /out:"..\lib_release\innodb.lib" +# ADD LIB32 /nologo /out:"..\lib_release\innodb.lib" + !ENDIF # Begin Target @@ -105,6 +129,7 @@ LIB32=link.exe -lib # Name "innobase - Win32 Max" # Name "innobase - Win32 Max nt" # Name "innobase - Win32 Debug" +# Name "innobase - Win32 Release" # Begin Source File SOURCE=.\btr\btr0btr.c diff --git a/VC++Files/libmysql/libmySQL.dsp b/VC++Files/libmysql/libmySQL.dsp index 9ea68943a97..14587260d60 100644 --- a/VC++Files/libmysql/libmySQL.dsp +++ b/VC++Files/libmysql/libmySQL.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /O2 /I "." /I "..\include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "." /I "..\include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_TLS" /D "USE_OLD_FUNCTIONS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 @@ -76,8 +76,7 @@ PostBuild_Cmds=copy release\libmysql.lib ..\lib_release # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "." /I "..\include" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "." /I "..\include" /D "_DEBUG" /D "_WINDOWS" /D "SAFE_MUTEX" /D "USE_TLS" /D "USE_OLD_FUNCTIONS" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -92,7 +91,7 @@ LINK32=link.exe # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Desc=Move DLL export lib -PostBuild_Cmds=copy ..\lib_debug\libmysql.dll C:\winnt\system32 copy debug\libmysql.lib ..\lib_debug +PostBuild_Cmds=copy debug\libmysql.lib ..\lib_debug # End Special Build Tool !ENDIF @@ -283,6 +282,10 @@ SOURCE=..\mysys\my_fstream.c # End Source File # Begin Source File +SOURCE=..\mysys\my_gethostbyname.c +# End Source File +# Begin Source File + SOURCE=..\mysys\my_getwd.c # End Source File # Begin Source File @@ -351,6 +354,10 @@ SOURCE=..\mysys\my_thr_init.c # End Source File # Begin Source File +SOURCE=..\mysys\my_vsnprintf.c +# End Source File +# Begin Source File + SOURCE=..\mysys\my_wincond.c # End Source File # Begin Source File @@ -439,6 +446,10 @@ SOURCE=..\strings\strxmov.c # End Source File # Begin Source File +SOURCE=..\strings\strxnmov.c +# End Source File +# Begin Source File + SOURCE=..\mysys\thr_mutex.c # End Source File # Begin Source File diff --git a/VC++Files/libmysqld/examples/test_libmysqld.dsp b/VC++Files/libmysqld/examples/test_libmysqld.dsp new file mode 100644 index 00000000000..35d9689266d --- /dev/null +++ b/VC++Files/libmysqld/examples/test_libmysqld.dsp @@ -0,0 +1,66 @@ +# Microsoft Developer Studio Project File - Name="test_libmysqld" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=test_libmysqld - Win32 Release +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "test_libmysqld.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "test_libmysqld.mak" CFG="test_libmysqld - Win32 Release" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "test_libmysqld - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "DBUG_OFF" /FR /YX /FD /c +# ADD BASE RSC /l 0x416 /d "NDEBUG" +# ADD RSC /l 0x416 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBCMTD" /out:"Release/mysql-server.exe" +# Begin Target + +# Name "test_libmysqld - Win32 Release" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\client\mysql.cpp +# End Source File +# End Group +# Begin Source File + +SOURCE=..\..\lib_release\libmysqld.lib +# End Source File +# End Target +# End Project diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp new file mode 100644 index 00000000000..34574dd4f2f --- /dev/null +++ b/VC++Files/libmysqld/libmysqld.dsp @@ -0,0 +1,405 @@ +# Microsoft Developer Studio Project File - Name="libmysqld" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=libmysqld - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libmysqld.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libmysqld.mak" CFG="libmysqld - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libmysqld - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "libmysqld - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libmysqld - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /FR /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x416 /d "NDEBUG" +# ADD RSC /l 0x416 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_release\vio.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /dll /machine:I386 /out:"../lib_release/libmysqld.dll" /implib:"../lib_release/libmysqld.lib" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "libmysqld - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "libmysqld___Win32_Debug" +# PROP BASE Intermediate_Dir "libmysqld___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMYSQLD_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MT /W3 /Gm /Zi /Od /I "../include" /I "../sql" /I "../regex" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x416 /d "_DEBUG" +# ADD RSC /l 0x416 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\merge.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib ..\lib_debug\vio.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"LIBCMTD" /out:"../lib_debug/libmysqld.dll" /implib:"../lib_debug/libmysqld.lib" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "libmysqld - Win32 Release" +# Name "libmysqld - Win32 Debug" +# Begin Source File + +SOURCE=..\sql\convert.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\derror.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysql\errmsg.c +# End Source File +# Begin Source File + +SOURCE=..\sql\field.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\field_conv.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\filesort.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysql\get_password.c +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_berkeley.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_heap.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_innodb.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_isammrg.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_myisam.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_myisammrg.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\handler.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\hash_filo.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\hostname.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\init.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_buff.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_cmpfunc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_create.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_func.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_strfunc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_sum.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_timefunc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_uniq.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\key.cpp +# End Source File +# Begin Source File + +SOURCE=.\lib_load.cpp +# End Source File +# Begin Source File + +SOURCE=.\lib_sql.cpp +# End Source File +# Begin Source File + +SOURCE=.\libmysqld.c +# End Source File +# Begin Source File + +SOURCE=.\libmysqld.def +# End Source File +# Begin Source File + +SOURCE=..\sql\lock.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\log.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\log_event.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\mf_iocache.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\mini_client.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\net_pkg.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\net_serv.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\opt_ft.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\opt_range.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\opt_sum.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysql\password.c +# End Source File +# Begin Source File + +SOURCE=..\sql\procedure.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\records.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\repl_failsafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\slave.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_acl.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_analyse.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_base.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_cache.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_class.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_crypt.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_db.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_delete.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_do.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_handler.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_insert.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_lex.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_list.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_manager.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_map.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_parse.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_rename.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_repl.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_select.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_show.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_string.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_table.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_test.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_udf.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_union.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_update.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_yacc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\table.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\thr_malloc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\time.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\uniques.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\unireg.cpp +# End Source File +# End Target +# End Project diff --git a/VC++Files/libmysqltest/myTest.dsp b/VC++Files/libmysqltest/myTest.dsp index fec250e7a40..74f7b8ae48e 100644 --- a/VC++Files/libmysqltest/myTest.dsp +++ b/VC++Files/libmysqltest/myTest.dsp @@ -67,8 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "..\include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /Fr /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "..\include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/libmysqltest/mytest.c b/VC++Files/libmysqltest/mytest.c new file mode 100644 index 00000000000..9c6818ecf6c --- /dev/null +++ b/VC++Files/libmysqltest/mytest.c @@ -0,0 +1,170 @@ +/*C4*/ +/****************************************************************/ +/* Author: Jethro Wright, III TS : 3/ 4/1998 9:15 */ +/* Date: 02/18/1998 */ +/* mytest.c : do some testing of the libmySQL.DLL.... */ +/* */ +/* History: */ +/* 02/18/1998 jw3 also sprach zarathustra.... */ +/****************************************************************/ + + +#include +#include +#include + +#include + +#define DEFALT_SQL_STMT "SELECT * FROM db" +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif + + +/******************************************************** +** +** main :- +** +********************************************************/ + +int +main( int argc, char * argv[] ) +{ + + char szSQL[ 200 ], aszFlds[ 25 ][ 25 ], szDB[ 50 ] ; + const char *pszT; + int i, j, k, l, x ; + MYSQL * myData ; + MYSQL_RES * res ; + MYSQL_FIELD * fd ; + MYSQL_ROW row ; + + //....just curious.... + printf( "sizeof( MYSQL ) == %d\n", sizeof( MYSQL ) ) ; + if ( argc == 2 ) + { + strcpy( szDB, argv[ 1 ] ) ; + strcpy( szSQL, DEFALT_SQL_STMT ) ; + if (!strcmp(szDB,"--debug")) + { + strcpy( szDB, "mysql" ) ; + printf("Some mysql struct information (size and offset):\n"); + printf("net:\t%3d %3d\n",sizeof(myData->net),offsetof(MYSQL,net)); + printf("host:\t%3d %3d\n",sizeof(myData->host),offsetof(MYSQL,host)); + printf("port:\t%3d %3d\n",sizeof(myData->port),offsetof(MYSQL,port)); + printf("protocol_version:\t%3d %3d\n",sizeof(myData->protocol_version), + offsetof(MYSQL,protocol_version)); + printf("thread_id:\t%3d %3d\n",sizeof(myData->thread_id), + offsetof(MYSQL,thread_id)); + printf("affected_rows:\t%3d %3d\n",sizeof(myData->affected_rows), + offsetof(MYSQL,affected_rows)); + printf("packet_length:\t%3d %3d\n",sizeof(myData->packet_length), + offsetof(MYSQL,packet_length)); + printf("status:\t%3d %3d\n",sizeof(myData->status), + offsetof(MYSQL,status)); + printf("fields:\t%3d %3d\n",sizeof(myData->fields), + offsetof(MYSQL,fields)); + printf("field_alloc:\t%3d %3d\n",sizeof(myData->field_alloc), + offsetof(MYSQL,field_alloc)); + printf("free_me:\t%3d %3d\n",sizeof(myData->free_me), + offsetof(MYSQL,free_me)); + printf("options:\t%3d %3d\n",sizeof(myData->options), + offsetof(MYSQL,options)); + puts(""); + } + } + else if ( argc > 2 ) { + strcpy( szDB, argv[ 1 ] ) ; + strcpy( szSQL, argv[ 2 ] ) ; + } + else { + strcpy( szDB, "mysql" ) ; + strcpy( szSQL, DEFALT_SQL_STMT ) ; + } + //.... + + if ( (myData = mysql_init((MYSQL*) 0)) && + mysql_real_connect( myData, NULL, NULL, NULL, NULL, MYSQL_PORT, + NULL, 0 ) ) + { + if ( mysql_select_db( myData, szDB ) < 0 ) { + printf( "Can't select the %s database !\n", szDB ) ; + mysql_close( myData ) ; + return 2 ; + } + } + else { + printf( "Can't connect to the mysql server on port %d !\n", + MYSQL_PORT ) ; + mysql_close( myData ) ; + return 1 ; + } + //.... + if ( ! mysql_query( myData, szSQL ) ) { + res = mysql_store_result( myData ) ; + i = (int) mysql_num_rows( res ) ; l = 1 ; + printf( "Query: %s\nNumber of records found: %ld\n", szSQL, i ) ; + //....we can get the field-specific characteristics here.... + for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ ) + strcpy( aszFlds[ x ], fd->name ) ; + //.... + while ( row = mysql_fetch_row( res ) ) { + j = mysql_num_fields( res ) ; + printf( "Record #%ld:-\n", l++ ) ; + for ( k = 0 ; k < j ; k++ ) + printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ], + (((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ; + puts( "==============================\n" ) ; + } + mysql_free_result( res ) ; + } + else printf( "Couldn't execute %s on the server !\n", szSQL ) ; + //.... + puts( "==== Diagnostic info ====" ) ; + pszT = mysql_get_client_info() ; + printf( "Client info: %s\n", pszT ) ; + //.... + pszT = mysql_get_host_info( myData ) ; + printf( "Host info: %s\n", pszT ) ; + //.... + pszT = mysql_get_server_info( myData ) ; + printf( "Server info: %s\n", pszT ) ; + //.... + res = mysql_list_processes( myData ) ; l = 1 ; + if (res) + { + for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ ) + strcpy( aszFlds[ x ], fd->name ) ; + while ( row = mysql_fetch_row( res ) ) { + j = mysql_num_fields( res ) ; + printf( "Process #%ld:-\n", l++ ) ; + for ( k = 0 ; k < j ; k++ ) + printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ], + (((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ; + puts( "==============================\n" ) ; + } + } + else + { + printf("Got error %s when retreiving processlist\n",mysql_error(myData)); + } + //.... + res = mysql_list_tables( myData, "%" ) ; l = 1 ; + for ( x = 0 ; fd = mysql_fetch_field( res ) ; x++ ) + strcpy( aszFlds[ x ], fd->name ) ; + while ( row = mysql_fetch_row( res ) ) { + j = mysql_num_fields( res ) ; + printf( "Table #%ld:-\n", l++ ) ; + for ( k = 0 ; k < j ; k++ ) + printf( " Fld #%d (%s): %s\n", k + 1, aszFlds[ k ], + (((row[k]==NULL)||(!strlen(row[k])))?"NULL":row[k])) ; + puts( "==============================\n" ) ; + } + //.... + pszT = mysql_stat( myData ) ; + puts( pszT ) ; + //.... + mysql_close( myData ) ; + return 0 ; + +} diff --git a/VC++Files/merge/merge.dsp b/VC++Files/merge/merge.dsp index cb6042e6b68..70c0ce87d6b 100644 --- a/VC++Files/merge/merge.dsp +++ b/VC++Files/merge/merge.dsp @@ -92,10 +92,6 @@ SOURCE=.\mrg_create.c # End Source File # Begin Source File -SOURCE=.\mrg_def.h -# End Source File -# Begin Source File - SOURCE=.\mrg_delete.c # End Source File # Begin Source File @@ -134,9 +130,5 @@ SOURCE=.\mrg_static.c SOURCE=.\mrg_update.c # End Source File -# Begin Source File - -SOURCE=.\mrgdef.h -# End Source File # End Target # End Project diff --git a/VC++Files/myisam/myisam.dsp b/VC++Files/myisam/myisam.dsp index 5c13f5eb206..8346cddbc54 100644 --- a/VC++Files/myisam/myisam.dsp +++ b/VC++Files/myisam/myisam.dsp @@ -89,10 +89,6 @@ SOURCE=.\ft_boolean_search.c # End Source File # Begin Source File -SOURCE=.\ft_eval.c -# End Source File -# Begin Source File - SOURCE=.\ft_nlq_search.c # End Source File # Begin Source File @@ -101,10 +97,6 @@ SOURCE=.\ft_parser.c # End Source File # Begin Source File -SOURCE=.\ft_search.c -# End Source File -# Begin Source File - SOURCE=.\ft_static.c # End Source File # Begin Source File diff --git a/VC++Files/mysql.dsw b/VC++Files/mysql.dsw index 7713b28d978..6a7ec7a57dd 100644 --- a/VC++Files/mysql.dsw +++ b/VC++Files/mysql.dsw @@ -117,6 +117,54 @@ Package=<4> ############################################################################### +Project: "libmysqld"=".\libmysqld\libmysqld.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name bdb + End Project Dependency + Begin Project Dependency + Project_Dep_Name dbug + End Project Dependency + Begin Project Dependency + Project_Dep_Name heap + End Project Dependency + Begin Project Dependency + Project_Dep_Name innobase + End Project Dependency + Begin Project Dependency + Project_Dep_Name myisam + End Project Dependency + Begin Project Dependency + Project_Dep_Name myisammrg + End Project Dependency + Begin Project Dependency + Project_Dep_Name mysys + End Project Dependency + Begin Project Dependency + Project_Dep_Name regex + End Project Dependency + Begin Project Dependency + Project_Dep_Name strings + End Project Dependency + Begin Project Dependency + Project_Dep_Name vio + End Project Dependency + Begin Project Dependency + Project_Dep_Name zlib + End Project Dependency + Begin Project Dependency + Project_Dep_Name merge + End Project Dependency +}}} + +############################################################################### + Project: "merge"=".\merge\merge.dsp" - Package Owner=<4> Package=<5> @@ -396,6 +444,18 @@ Package=<4> ############################################################################### +Project: "mysqldemb"=".\mysqldemb\mysqldemb.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "mysqldump"=".\client\mysqldump.dsp" - Package Owner=<4> Package=<5> @@ -426,6 +486,54 @@ Package=<4> ############################################################################### +Project: "mysqlserver"=".\mysqlserver\mysqlserver.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name zlib + End Project Dependency + Begin Project Dependency + Project_Dep_Name bdb + End Project Dependency + Begin Project Dependency + Project_Dep_Name dbug + End Project Dependency + Begin Project Dependency + Project_Dep_Name heap + End Project Dependency + Begin Project Dependency + Project_Dep_Name innobase + End Project Dependency + Begin Project Dependency + Project_Dep_Name merge + End Project Dependency + Begin Project Dependency + Project_Dep_Name myisam + End Project Dependency + Begin Project Dependency + Project_Dep_Name myisammrg + End Project Dependency + Begin Project Dependency + Project_Dep_Name mysqldemb + End Project Dependency + Begin Project Dependency + Project_Dep_Name mysys + End Project Dependency + Begin Project Dependency + Project_Dep_Name regex + End Project Dependency + Begin Project Dependency + Project_Dep_Name strings + End Project Dependency +}}} + +############################################################################### + Project: "mysqlshow"=".\client\mysqlshow.dsp" - Package Owner=<4> Package=<5> @@ -582,6 +690,24 @@ Package=<4> ############################################################################### +Project: "test_libmysqld"=".\libmysqld\examples\test_libmysqld.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name libmysqld + End Project Dependency + Begin Project Dependency + Project_Dep_Name mysqlclient + End Project Dependency +}}} + +############################################################################### + Project: "thr_insert_test"=".\thr_insert_test\thr_insert_test.dsp" - Package Owner=<4> Package=<5> diff --git a/VC++Files/mysqlbinlog/mysqlbinlog.dsp b/VC++Files/mysqlbinlog/mysqlbinlog.dsp index 4145585abc5..a62253b2a2c 100644 --- a/VC++Files/mysqlbinlog/mysqlbinlog.dsp +++ b/VC++Files/mysqlbinlog/mysqlbinlog.dsp @@ -67,7 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/mysqlcheck/mysqlcheck.dsp b/VC++Files/mysqlcheck/mysqlcheck.dsp index 49c3fc2b702..d4b4f5652b7 100644 --- a/VC++Files/mysqlcheck/mysqlcheck.dsp +++ b/VC++Files/mysqlcheck/mysqlcheck.dsp @@ -49,7 +49,7 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/mysqlcheck.exe" /libpath:"..\lib_release\\" !ELSEIF "$(CFG)" == "mysqlcheck - Win32 Debug" @@ -65,15 +65,15 @@ LINK32=link.exe # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "MYSQL_SERVER" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 mysqlclient.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqlcheck.exe" /pdbtype:sept /libpath:"..\lib_debug\\" !ENDIF diff --git a/VC++Files/mysqldemb/mysqldemb.dsp b/VC++Files/mysqldemb/mysqldemb.dsp new file mode 100644 index 00000000000..a637c486574 --- /dev/null +++ b/VC++Files/mysqldemb/mysqldemb.dsp @@ -0,0 +1,392 @@ +# Microsoft Developer Studio Project File - Name="mysqldemb" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=mysqldemb - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "mysqldemb.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "mysqldemb.mak" CFG="mysqldemb - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "mysqldemb - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "mysqldemb - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "mysqldemb - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /YX /FD /c +# ADD BASE RSC /l 0x416 /d "NDEBUG" +# ADD RSC /l 0x416 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "mysqldemb - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "MYSQL_SERVER" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x416 /d "_DEBUG" +# ADD RSC /l 0x416 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "mysqldemb - Win32 Release" +# Name "mysqldemb - Win32 Debug" +# Begin Source File + +SOURCE=..\sql\convert.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\derror.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysql\errmsg.c +# End Source File +# Begin Source File + +SOURCE=..\sql\field.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\field_conv.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\filesort.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysql\get_password.c +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_berkeley.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_heap.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_innodb.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_isammrg.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_myisam.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\ha_myisammrg.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\handler.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\hash_filo.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\hostname.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\init.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_buff.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_cmpfunc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_create.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_func.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_strfunc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_sum.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_timefunc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\item_uniq.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\key.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysqld\lib_load.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysqld\lib_sql.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysqld\libmysqld.c +# End Source File +# Begin Source File + +SOURCE=..\sql\lock.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\log.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\log_event.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\mf_iocache.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\mini_client.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\net_pkg.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\net_serv.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\opt_ft.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\opt_range.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\opt_sum.cpp +# End Source File +# Begin Source File + +SOURCE=..\libmysql\password.c +# End Source File +# Begin Source File + +SOURCE=..\sql\procedure.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\records.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\repl_failsafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\slave.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_acl.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_analyse.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_base.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_cache.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_class.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_crypt.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_db.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_delete.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_do.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_handler.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_insert.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_lex.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_list.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_manager.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_map.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_parse.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_rename.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_repl.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_select.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_show.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_string.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_table.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_test.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_udf.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_union.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_update.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\sql_yacc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\table.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\thr_malloc.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\time.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\uniques.cpp +# End Source File +# Begin Source File + +SOURCE=..\sql\unireg.cpp +# End Source File +# End Target +# End Project diff --git a/VC++Files/mysqlmanager/MySqlManager.dsp b/VC++Files/mysqlmanager/MySqlManager.dsp index 60ee700b00c..56e1b4a5bf2 100644 --- a/VC++Files/mysqlmanager/MySqlManager.dsp +++ b/VC++Files/mysqlmanager/MySqlManager.dsp @@ -71,8 +71,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /Fr /YX /Yc /Yu +# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /Zi /Od /I "../include" /D "_DEBUG" /D "_WINDOWS" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /o "NUL" /win32 # SUBTRACT MTL /mktyplib203 diff --git a/VC++Files/mysqlserver/mysqlserver.dsp b/VC++Files/mysqlserver/mysqlserver.dsp new file mode 100644 index 00000000000..dda50cd5538 --- /dev/null +++ b/VC++Files/mysqlserver/mysqlserver.dsp @@ -0,0 +1,84 @@ +# Microsoft Developer Studio Project File - Name="mysqlserver" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=mysqlserver - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "mysqlserver.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "mysqlserver.mak" CFG="mysqlserver - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "mysqlserver - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "mysqlserver - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "mysqlserver - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /O2 /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "DBUG_OFF" /D "USE_TLS" /YX /FD /c +# ADD BASE RSC /l 0x416 /d "NDEBUG" +# ADD RSC /l 0x416 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "mysqlserver - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../sql" /I "../bdb/build_win32" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /D "EMBEDDED_LIBRARY" /D "HAVE_INNOBASE_DB" /D "USE_TLS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x416 /d "_DEBUG" +# ADD RSC /l 0x416 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "mysqlserver - Win32 Release" +# Name "mysqlserver - Win32 Debug" +# End Target +# End Project diff --git a/VC++Files/mysqlshutdown/mysqlshutdown.c b/VC++Files/mysqlshutdown/mysqlshutdown.c new file mode 100644 index 00000000000..e770149604d --- /dev/null +++ b/VC++Files/mysqlshutdown/mysqlshutdown.c @@ -0,0 +1,198 @@ +/**************************************************************************** + MySqlShutdown - shutdown MySQL on system shutdown (Win95/98) + ---------------------------------------------------------------------------- + Revision History : + Version Author Date Description + 001.00 Irena 21-12-99 +*****************************************************************************/ +#include + +//----------------------------------------------------------------------- +// Local data +//----------------------------------------------------------------------- +static char szAppName[] = "MySqlShutdown"; +static HINSTANCE hInstance; + +#define MYWM_NOTIFYICON (WM_APP+100) + +//----------------------------------------------------------------------- +// Exported functions +//----------------------------------------------------------------------- +LRESULT CALLBACK MainWindowProc (HWND, UINT, WPARAM, LPARAM); + +//----------------------------------------------------------------------- +// Local functions +//----------------------------------------------------------------------- +static BOOL InitAppClass (HINSTANCE hInstance); + +BOOL TrayMessageAdd(HWND hWnd, DWORD dwMessage) +{ + BOOL res; + HICON hIcon =LoadIcon (hInstance, "MySql"); + char *szTip="MySql Shutdown"; + NOTIFYICONDATA tnd; + + tnd.cbSize = sizeof(NOTIFYICONDATA); + tnd.hWnd = hWnd; + tnd.uID = 101; + + tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; + tnd.uCallbackMessage = MYWM_NOTIFYICON; + tnd.hIcon = hIcon; + strcpy(tnd.szTip, szTip); + res = Shell_NotifyIcon(dwMessage, &tnd); + + if (hIcon) DestroyIcon(hIcon); + + return res; +} + +//----------------------------------------------------------------------- +// Name: WinMain +// Purpose: Main application entry point +//----------------------------------------------------------------------- + +int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow) +{ HWND hWnd; + MSG Msg; + + hInstance=hInst; + // Register application class if needed + if (InitAppClass (hInstance) == FALSE) return (0); + + + hWnd = CreateWindow (szAppName, "MySql", + WS_OVERLAPPEDWINDOW|WS_MINIMIZE, + 0, 0, + GetSystemMetrics(SM_CXSCREEN)/4, + GetSystemMetrics(SM_CYSCREEN)/4, + 0, 0, hInstance, NULL); + + if(!hWnd) + { + return (0); + } + ShowWindow (hWnd, SW_HIDE); + UpdateWindow (hWnd); + while (GetMessage (&Msg, 0, 0, 0)) + { TranslateMessage (&Msg); + DispatchMessage (&Msg); + } + return ((int) (Msg.wParam)); +} + +//----------------------------------------------------------------------- +// Name: InitAppClass +// Purpose: Register the main application window class +//----------------------------------------------------------------------- +static BOOL InitAppClass (HINSTANCE hInstance) +{ + WNDCLASS cls; + + if (GetClassInfo (hInstance, szAppName, &cls) == 0) + { + cls.style = CS_HREDRAW | CS_VREDRAW ;; + cls.lpfnWndProc = (WNDPROC) MainWindowProc; + cls.cbClsExtra = 0; + cls.cbWndExtra = sizeof(HWND); + cls.hInstance = hInstance; + cls.hIcon = LoadIcon (hInstance, "MySql"); + cls.hCursor = LoadCursor (NULL, IDC_ARROW); + cls.hbrBackground = GetStockObject (WHITE_BRUSH) ; + cls.lpszMenuName = 0; //szAppName; + cls.lpszClassName = szAppName; + return RegisterClass (&cls); + } + return (TRUE); +} +//----------------------------------------------------------------------- +// Name: MainWindowProc +// Purpose: Window procedure for main application window. +//----------------------------------------------------------------------- +LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT Msg,WPARAM wParam, LPARAM lParam) +{ + static RECT rect ; + HDC hdc ; + PAINTSTRUCT ps ; + static BOOL bShutdown=FALSE; + + switch (Msg) + { + case WM_CREATE: + TrayMessageAdd(hWnd, NIM_ADD); + return TRUE; +/*************** + case WM_SYSCOMMAND: + if(wParam==SC_CLOSE) + { HANDLE hEventShutdown; + + bShutdown=TRUE; + InvalidateRect(hWnd,NULL,TRUE); + ShowWindow (hWnd, SW_NORMAL); + UpdateWindow(hWnd); + hEventShutdown=OpenEvent(EVENT_MODIFY_STATE, 0, "MySqlShutdown"); + if(hEventShutdown) + { + SetEvent(hEventShutdown); + CloseHandle(hEventShutdown); + Sleep(1000); + MessageBox(hWnd,"Shutdown", "MySql", MB_OK); + } + TrayMessageAdd(hWnd, NIM_DELETE); + } + break; +**************/ + case WM_DESTROY: + TrayMessageAdd(hWnd, NIM_DELETE); + PostQuitMessage (0); + return 0; + case WM_SIZE: + GetClientRect (hWnd, &rect) ; + return 0 ; + + case WM_PAINT: + hdc = BeginPaint (hWnd, &ps) ; + if(bShutdown) + DrawText (hdc, "MySql shutdown in progress...", + -1, &rect, DT_WORDBREAK) ; + EndPaint (hWnd, &ps) ; + return 0 ; + case WM_QUERYENDSESSION: //Shutdown MySql + { HANDLE hEventShutdown; + + bShutdown=TRUE; + InvalidateRect(hWnd,NULL,TRUE); + ShowWindow (hWnd, SW_NORMAL); + UpdateWindow(hWnd); + hEventShutdown=OpenEvent(EVENT_MODIFY_STATE, 0, "MySqlShutdown"); + if(hEventShutdown) + { + SetEvent(hEventShutdown); + CloseHandle(hEventShutdown); + Sleep(1000); + MessageBox(hWnd,"Shutdown", "MySql", MB_OK); + } + } + return 1; + + case MYWM_NOTIFYICON: + switch (lParam) + { + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + ShowWindow(hWnd, SW_SHOWNORMAL); + SetForegroundWindow(hWnd); // make us come to the front + break; + default: + break; + } + break; + + } + return DefWindowProc (hWnd, Msg, wParam, lParam); +} + + +// ----------------------- The end ------------------------------------------ + + diff --git a/VC++Files/mysqlwatch/mysqlwatch.c b/VC++Files/mysqlwatch/mysqlwatch.c new file mode 100644 index 00000000000..2aba6814869 --- /dev/null +++ b/VC++Files/mysqlwatch/mysqlwatch.c @@ -0,0 +1,745 @@ +/**************************************************************************** + MySqlWatch - WinNT service program MySQL + - Re-start MySql server in case of failure +*****************************************************************************/ +#include +#include +#include +#include +#include + + +// name of the executable +#define SZAPPNAME "mysqlwatch" +// internal name of the service +#define SZSERVICENAME "MySqlWatch" +// displayed name of the service +#define SZSERVICEDISPLAYNAME "MySqlWatch" +// list of service dependencies - "dep1\0dep2\0\0" +#define SZDEPENDENCIES "" + + + +VOID ServiceStart(DWORD dwArgc, LPTSTR *lpszArgv); +VOID ServiceStop(void); +BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint); +void AddToMessageLog(LPTSTR lpszMsg); + +// internal variables +SERVICE_STATUS ssStatus; // current status of the service +SERVICE_STATUS_HANDLE sshStatusHandle; +DWORD dwErr = 0; +BOOL bDebug = FALSE; +TCHAR szErr[256]; + +// internal function prototypes +void WINAPI service_ctrl(DWORD dwCtrlCode); +void WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv); +void CmdInstallService(void); +void CmdRemoveService(void); +void CmdDebugService(int argc, char **argv); +BOOL WINAPI ControlHandler ( DWORD dwCtrlType ); +LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize ); + +// +// FUNCTION: main +// +// PURPOSE: entrypoint for service +// +// PARAMETERS: +// argc - number of command line arguments +// argv - array of command line arguments +// +// RETURN VALUE: +// none +// +// COMMENTS: +// main() either performs the command line task, or +// call StartServiceCtrlDispatcher to register the +// main service thread. When the this call returns, +// the service has stopped, so exit. +// +void main(int argc, char **argv) +{ + SERVICE_TABLE_ENTRY dispatchTable[] = + { + { TEXT(SZSERVICENAME), (LPSERVICE_MAIN_FUNCTION)service_main }, + { NULL, NULL } + }; + + if ( (argc > 1) && + ((*argv[1] == '-') || (*argv[1] == '/')) ) + { + if ( stricmp( "install", argv[1]+1 ) == 0 ) + { + CmdInstallService(); + } + else if ( stricmp( "remove", argv[1]+1 ) == 0 ) + { + CmdRemoveService(); + } + else if ( stricmp( "debug", argv[1]+1 ) == 0 ) + { + bDebug = TRUE; + CmdDebugService(argc, argv); + } + else + { + goto dispatch; + } + exit(0); + } + + // if it doesn't match any of the above parameters + // the service control manager may be starting the service + // so we must call StartServiceCtrlDispatcher + dispatch: + // this is just to be friendly + printf( "%s -install to install the service\n", SZAPPNAME ); + printf( "%s -remove to remove the service\n", SZAPPNAME ); + printf( "%s -debug to run as a console app for debugging\n", SZAPPNAME ); + printf( "\nStartServiceCtrlDispatcher being called.\n" ); + printf( "This may take several seconds. Please wait.\n" ); + + if (!StartServiceCtrlDispatcher(dispatchTable)) + AddToMessageLog(TEXT("StartServiceCtrlDispatcher failed.")); +} + + + +// +// FUNCTION: service_main +// +// PURPOSE: To perform actual initialization of the service +// +// PARAMETERS: +// dwArgc - number of command line arguments +// lpszArgv - array of command line arguments +// +// RETURN VALUE: +// none +// +// COMMENTS: +// This routine performs the service initialization and then calls +// the user defined ServiceStart() routine to perform majority +// of the work. +// +void WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv) +{ + + // register our service control handler: + // + sshStatusHandle = RegisterServiceCtrlHandler( TEXT(SZSERVICENAME), service_ctrl); + + if (!sshStatusHandle) + goto cleanup; + + // SERVICE_STATUS members that don't change in example + // + ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + ssStatus.dwServiceSpecificExitCode = 0; + + + // report the status to the service control manager. + // + if (!ReportStatusToSCMgr( + SERVICE_START_PENDING, // service state + NO_ERROR, // exit code + 3000)) // wait hint + goto cleanup; + + + ServiceStart( dwArgc, lpszArgv ); + +cleanup: + + // try to report the stopped status to the service control manager. + // + if (sshStatusHandle) + ReportStatusToSCMgr( + SERVICE_STOPPED, + dwErr, + 0); + + return; +} + + + +// +// FUNCTION: service_ctrl +// +// PURPOSE: This function is called by the SCM whenever +// ControlService() is called on this service. +// +// PARAMETERS: +// dwCtrlCode - type of control requested +// +// RETURN VALUE: +// none +// +// COMMENTS: +// +void WINAPI service_ctrl(DWORD dwCtrlCode) +{ + // Handle the requested control code. + // + switch(dwCtrlCode) + { + // Stop the service. + // + case SERVICE_CONTROL_STOP: + ssStatus.dwCurrentState = SERVICE_STOP_PENDING; + ServiceStop(); + break; + + // Update the service status. + // + case SERVICE_CONTROL_INTERROGATE: + break; + + // invalid control code + // + default: + break; + + } + + ReportStatusToSCMgr(ssStatus.dwCurrentState, NO_ERROR, 0); + +} + + + +// +// FUNCTION: ReportStatusToSCMgr() +// +// PURPOSE: Sets the current status of the service and +// reports it to the Service Control Manager +// +// PARAMETERS: +// dwCurrentState - the state of the service +// dwWin32ExitCode - error code to report +// dwWaitHint - worst case estimate to next checkpoint +// +// RETURN VALUE: +// TRUE - success +// FALSE - failure +// +// COMMENTS: +// +BOOL ReportStatusToSCMgr(DWORD dwCurrentState, + DWORD dwWin32ExitCode, + DWORD dwWaitHint) +{ + static DWORD dwCheckPoint = 1; + BOOL fResult = TRUE; + + + if ( !bDebug ) // when debugging we don't report to the SCM + { + if (dwCurrentState == SERVICE_START_PENDING) + ssStatus.dwControlsAccepted = 0; + else + ssStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP; + + ssStatus.dwCurrentState = dwCurrentState; + ssStatus.dwWin32ExitCode = dwWin32ExitCode; + ssStatus.dwWaitHint = dwWaitHint; + + if ( ( dwCurrentState == SERVICE_RUNNING ) || + ( dwCurrentState == SERVICE_STOPPED ) ) + ssStatus.dwCheckPoint = 0; + else + ssStatus.dwCheckPoint = dwCheckPoint++; + + + // Report the status of the service to the service control manager. + // + if (!(fResult = SetServiceStatus( sshStatusHandle, &ssStatus))) { + AddToMessageLog(TEXT("SetServiceStatus")); + } + } + return fResult; +} + + + +// +// FUNCTION: AddToMessageLog(LPTSTR lpszMsg) +// +// PURPOSE: Allows any thread to log an error message +// +// PARAMETERS: +// lpszMsg - text for message +// +// RETURN VALUE: +// none +// +// COMMENTS: +// +void AddToMessageLog(LPTSTR lpszMsg) +{ + TCHAR szMsg[256]; + HANDLE hEventSource; + LPTSTR lpszStrings[2]; + + + if ( !bDebug ) + { + dwErr = GetLastError(); + + // Use event logging to log the error. + // + hEventSource = RegisterEventSource(NULL, TEXT(SZSERVICENAME)); + + _stprintf(szMsg, TEXT("%s error: %d"), TEXT(SZSERVICENAME), dwErr); + lpszStrings[0] = szMsg; + lpszStrings[1] = lpszMsg; + + if (hEventSource != NULL) { + ReportEvent(hEventSource, // handle of event source + EVENTLOG_ERROR_TYPE, // event type + 0, // event category + 0, // event ID + NULL, // current user's SID + 2, // strings in lpszStrings + 0, // no bytes of raw data + lpszStrings, // array of error strings + NULL); // no raw data + + DeregisterEventSource(hEventSource); + } + } +} + + + + +/////////////////////////////////////////////////////////////////// +// +// The following code handles service installation and removal +// + + +// +// FUNCTION: CmdInstallService() +// +// PURPOSE: Installs the service +// +// PARAMETERS: +// none +// +// RETURN VALUE: +// none +// +// COMMENTS: +// +void CmdInstallService() +{ + SC_HANDLE schService; + SC_HANDLE schSCManager; + + TCHAR szPath[512]; + + if ( GetModuleFileName( NULL, szPath, 512 ) == 0 ) + { + _tprintf(TEXT("Unable to install %s - %s\n"), TEXT(SZSERVICEDISPLAYNAME), GetLastErrorText(szErr, 256)); + return; + } + + schSCManager = OpenSCManager( + NULL, // machine (NULL == local) + NULL, // database (NULL == default) + SC_MANAGER_ALL_ACCESS // access required + ); + if ( schSCManager ) + { + schService = CreateService( + schSCManager, // SCManager database + TEXT(SZSERVICENAME), // name of service + TEXT(SZSERVICEDISPLAYNAME), // name to display + SERVICE_ALL_ACCESS, // desired access + SERVICE_WIN32_OWN_PROCESS, // service type + SERVICE_DEMAND_START, // start type + SERVICE_ERROR_NORMAL, // error control type + szPath, // service's binary + NULL, // no load ordering group + NULL, // no tag identifier + TEXT(SZDEPENDENCIES), // dependencies + NULL, // LocalSystem account + NULL); // no password + + if ( schService ) + { + _tprintf(TEXT("%s installed.\n"), TEXT(SZSERVICEDISPLAYNAME) ); + CloseServiceHandle(schService); + } + else + { + _tprintf(TEXT("CreateService failed - %s\n"), GetLastErrorText(szErr, 256)); + } + + CloseServiceHandle(schSCManager); + } + else + _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); +} + + + +// +// FUNCTION: CmdRemoveService() +// +// PURPOSE: Stops and removes the service +// +// PARAMETERS: +// none +// +// RETURN VALUE: +// none +// +// COMMENTS: +// +void CmdRemoveService() +{ + SC_HANDLE schService; + SC_HANDLE schSCManager; + + schSCManager = OpenSCManager( + NULL, // machine (NULL == local) + NULL, // database (NULL == default) + SC_MANAGER_ALL_ACCESS // access required + ); + if ( schSCManager ) + { + schService = OpenService(schSCManager, TEXT(SZSERVICENAME), SERVICE_ALL_ACCESS); + + if (schService) + { + // try to stop the service + if ( ControlService( schService, SERVICE_CONTROL_STOP, &ssStatus ) ) + { + _tprintf(TEXT("Stopping %s."), TEXT(SZSERVICEDISPLAYNAME)); + Sleep( 1000 ); + + while( QueryServiceStatus( schService, &ssStatus ) ) + { + if ( ssStatus.dwCurrentState == SERVICE_STOP_PENDING ) + { + _tprintf(TEXT(".")); + Sleep( 1000 ); + } + else + break; + } + + if ( ssStatus.dwCurrentState == SERVICE_STOPPED ) + _tprintf(TEXT("\n%s stopped.\n"), TEXT(SZSERVICEDISPLAYNAME) ); + else + _tprintf(TEXT("\n%s failed to stop.\n"), TEXT(SZSERVICEDISPLAYNAME) ); + + } + + // now remove the service + if( DeleteService(schService) ) + _tprintf(TEXT("%s removed.\n"), TEXT(SZSERVICEDISPLAYNAME) ); + else + _tprintf(TEXT("DeleteService failed - %s\n"), GetLastErrorText(szErr,256)); + + + CloseServiceHandle(schService); + } + else + _tprintf(TEXT("OpenService failed - %s\n"), GetLastErrorText(szErr,256)); + + CloseServiceHandle(schSCManager); + } + else + _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); +} + + + + + +// +// FUNCTION: CmdRestartService() +// +// PURPOSE: Stops and removes the service +// +// PARAMETERS: +// none +// +// RETURN VALUE: +// none +// +// COMMENTS: +// +void CmdRestartService(char *szServiceName) +{ + SC_HANDLE schService; + SC_HANDLE schSCManager; + + schSCManager = OpenSCManager( + NULL, // machine (NULL == local) + NULL, // database (NULL == default) + SC_MANAGER_ALL_ACCESS // access required + ); + if ( schSCManager ) + { + schService = OpenService(schSCManager, TEXT(szServiceName), SERVICE_ALL_ACCESS); + if (schService) + { + if(! ControlService( schService, SERVICE_CONTROL_INTERROGATE, &ssStatus ) ) + //if(QueryServiceStatus( schService, &ssStatus )==0) + { + if(GetLastError()==ERROR_SERVICE_NOT_ACTIVE) + { + + //AddToMessageLog(TEXT("Start service...")); + StartService( schService, 0,NULL); + } + else + { ; + //AddToMessageLog(TEXT("QueryService...")); + //AddToMessageLog(TEXT(GetLastErrorText(szErr,256))); + } + } + CloseServiceHandle(schService); + } + else + { _tprintf(TEXT("OpenService failed - %s\n"), GetLastErrorText(szErr,256)); + AddToMessageLog(TEXT("OpenService...")); + AddToMessageLog(TEXT(GetLastErrorText(szErr,256))); + + } + CloseServiceHandle(schSCManager); + } + else + { _tprintf(TEXT("OpenSCManager failed - %s\n"), GetLastErrorText(szErr,256)); + AddToMessageLog(TEXT("OpenSCMManager..")); + + } +} + + + + +/////////////////////////////////////////////////////////////////// +// +// The following code is for running the service as a console app +// + + +// +// FUNCTION: CmdDebugService(int argc, char ** argv) +// +// PURPOSE: Runs the service as a console application +// +// PARAMETERS: +// argc - number of command line arguments +// argv - array of command line arguments +// +// RETURN VALUE: +// none +// +// COMMENTS: +// +void CmdDebugService(int argc, char ** argv) +{ + DWORD dwArgc; + LPTSTR *lpszArgv; + +#ifdef UNICODE + lpszArgv = CommandLineToArgvW(GetCommandLineW(), &(dwArgc) ); +#else + dwArgc = (DWORD) argc; + lpszArgv = argv; +#endif + + _tprintf(TEXT("Debugging %s.\n"), TEXT(SZSERVICEDISPLAYNAME)); + + SetConsoleCtrlHandler( ControlHandler, TRUE ); + + ServiceStart( dwArgc, lpszArgv ); +} + + +// +// FUNCTION: ControlHandler ( DWORD dwCtrlType ) +// +// PURPOSE: Handled console control events +// +// PARAMETERS: +// dwCtrlType - type of control event +// +// RETURN VALUE: +// True - handled +// False - unhandled +// +// COMMENTS: +// +BOOL WINAPI ControlHandler ( DWORD dwCtrlType ) +{ + switch( dwCtrlType ) + { + case CTRL_BREAK_EVENT: // use Ctrl+C or Ctrl+Break to simulate + case CTRL_C_EVENT: // SERVICE_CONTROL_STOP in debug mode + _tprintf(TEXT("Stopping %s.\n"), TEXT(SZSERVICEDISPLAYNAME)); + ServiceStop(); + return TRUE; + break; + + } + return FALSE; +} + +// +// FUNCTION: GetLastErrorText +// +// PURPOSE: copies error message text to string +// +// PARAMETERS: +// lpszBuf - destination buffer +// dwSize - size of buffer +// +// RETURN VALUE: +// destination buffer +// +// COMMENTS: +// +LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize ) +{ + DWORD dwRet; + LPTSTR lpszTemp = NULL; + + dwRet = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY, + NULL, + GetLastError(), + LANG_NEUTRAL, + (LPTSTR)&lpszTemp, + 0, + NULL ); + + // supplied buffer is not long enough + if ( !dwRet || ( (long)dwSize < (long)dwRet+14 ) ) + lpszBuf[0] = TEXT('\0'); + else + { + lpszTemp[lstrlen(lpszTemp)-2] = TEXT('\0'); //remove cr and newline character + _stprintf( lpszBuf, TEXT("%s (0x%x)"), lpszTemp, GetLastError() ); + } + + if ( lpszTemp ) + LocalFree((HLOCAL) lpszTemp ); + + return lpszBuf; +} + +//------------------------------------------------- +// this event is signalled when the +// service should end +//------------------------------------------------- +HANDLE hServerStopEvent = NULL; + + +//------------------------------------------------- +// FUNCTION: ServiceStart +// +// PURPOSE: Actual code of the service +// that does the work. +//------------------------------------------------- +void ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv) +{ + DWORD dwWait,dwTimeout=1000*60*1; + + if (!ReportStatusToSCMgr( + SERVICE_START_PENDING, // service state + NO_ERROR, // exit code + 3000)) // wait hint + goto cleanup; + + // create the event object. The control handler function signals + // this event when it receives the "stop" control code. + // + hServerStopEvent = CreateEvent( + NULL, // no security attributes + TRUE, // manual reset event + FALSE, // not-signalled + NULL); // no name + + if ( hServerStopEvent == NULL) goto cleanup; + + + // report the status to the service control manager. + // + if (!ReportStatusToSCMgr( + SERVICE_START_PENDING, // service state + NO_ERROR, // exit code + 3000)) // wait hint + goto cleanup; + + + + // report the status to the service control manager. + // + if (!ReportStatusToSCMgr( + SERVICE_START_PENDING, // service state + NO_ERROR, // exit code + 3000)) // wait hint + goto cleanup; + + + + // report the status to the service control manager. + // + if (!ReportStatusToSCMgr( + SERVICE_RUNNING, // service state + NO_ERROR, // exit code + 0)) // wait hint + goto cleanup; + + // + // End of initialization + // Service is now running, perform work until shutdown + // + + while ( 1 ) + { + + dwWait = WaitForSingleObject( hServerStopEvent, dwTimeout); + if(dwWait==WAIT_FAILED) + { + AddToMessageLog(TEXT("Error in WaitForSingleObject")); + break; + } + else if(dwWait==WAIT_TIMEOUT) + { + CmdRestartService("MySql"); + } + else + { break; //shutdown + } + + } + + cleanup: + + if (hServerStopEvent) + CloseHandle(hServerStopEvent); + +} + + +//------------------------------------------------- +// FUNCTION: ServiceStop +// +// PURPOSE: Stops the service +//------------------------------------------------- +void ServiceStop() +{ + if ( hServerStopEvent ) + SetEvent(hServerStopEvent); +} +//-the end ---------------------------------------- diff --git a/VC++Files/mysys/mysys.dsp b/VC++Files/mysys/mysys.dsp index eb467e55892..7a0087b68d6 100644 --- a/VC++Files/mysys/mysys.dsp +++ b/VC++Files/mysys/mysys.dsp @@ -66,8 +66,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c -# SUBTRACT CPP /Fr +# ADD CPP /nologo /G6 /MTd /W3 /Zi /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe @@ -142,23 +141,15 @@ SOURCE=.\errors.c # End Source File # Begin Source File -SOURCE=.\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\getopt1.c -# End Source File -# Begin Source File - -SOURCE=.\getvar.c +SOURCE=.\hash.c # End Source File # Begin Source File -SOURCE=.\hash.c +SOURCE=.\list.c # End Source File # Begin Source File -SOURCE=.\list.c +SOURCE=.\md5.c # End Source File # Begin Source File @@ -210,10 +201,6 @@ SOURCE=.\mf_pack.c # End Source File # Begin Source File -SOURCE=.\mf_pack2.c -# End Source File -# Begin Source File - SOURCE=.\mf_path.c # End Source File # Begin Source File @@ -242,7 +229,7 @@ SOURCE=.\mf_soundex.c # End Source File # Begin Source File -SOURCE=.\mf_stripp.c +SOURCE=.\mf_strip.c # End Source File # Begin Source File @@ -262,6 +249,10 @@ SOURCE=.\mulalloc.c # End Source File # Begin Source File +SOURCE=.\my_aes.c +# End Source File +# Begin Source File + SOURCE=.\my_alarm.c # End Source File # Begin Source File @@ -322,6 +313,14 @@ SOURCE=.\my_fstream.c # End Source File # Begin Source File +SOURCE=.\my_gethostbyname.c +# End Source File +# Begin Source File + +SOURCE=.\my_getopt.c +# End Source File +# Begin Source File + SOURCE=.\my_getwd.c # End Source File # Begin Source File @@ -438,6 +437,10 @@ SOURCE=.\my_wincond.c # End Source File # Begin Source File +SOURCE=.\my_winsem.c +# End Source File +# Begin Source File + SOURCE=.\my_winthread.c # End Source File # Begin Source File @@ -462,10 +465,18 @@ SOURCE=.\raid.cpp # End Source File # Begin Source File +SOURCE=.\rijndael.c +# End Source File +# Begin Source File + SOURCE=.\safemalloc.c # End Source File # Begin Source File +SOURCE=.\sha1.c +# End Source File +# Begin Source File + SOURCE=.\string.c # End Source File # Begin Source File diff --git a/VC++Files/pack_isam/pack_isam.dsp b/VC++Files/pack_isam/pack_isam.dsp index 20c832c96d0..036dcd9a2ca 100644 --- a/VC++Files/pack_isam/pack_isam.dsp +++ b/VC++Files/pack_isam/pack_isam.dsp @@ -66,8 +66,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../isam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /Fr +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../isam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/perror/perror.dsp b/VC++Files/perror/perror.dsp index 439fcef1547..2b720ace3e7 100644 --- a/VC++Files/perror/perror.dsp +++ b/VC++Files/perror/perror.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" diff --git a/VC++Files/replace/replace.dsp b/VC++Files/replace/replace.dsp index 011b62d08ec..54584151418 100644 --- a/VC++Files/replace/replace.dsp +++ b/VC++Files/replace/replace.dsp @@ -67,8 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x40b /d "_DEBUG" # ADD RSC /l 0x40b /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index ec4722d7f27..a84af8adedc 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -71,8 +71,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /I "../regex" /I "../bdb/build_win32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /FD /c -# SUBTRACT CPP /Fr /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../regex" /I "../bdb/build_win32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "USE_SYMDIR" /D "SIGNAL_WITH_VIO_CLOSE" /D "HAVE_DLOPEN" /FD /c # ADD BASE RSC /l 0x410 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -286,7 +285,7 @@ SOURCE=.\ha_heap.cpp # End Source File # Begin Source File -SOURCE=.\ha_innobase.cpp +SOURCE=.\ha_innodb.cpp # End Source File # Begin Source File @@ -615,10 +614,6 @@ SOURCE=.\log_event.cpp # End Source File # Begin Source File -SOURCE=.\md5.c -# End Source File -# Begin Source File - SOURCE=.\mf_iocache.cpp !IF "$(CFG)" == "mysqld - Win32 Release" @@ -927,6 +922,10 @@ SOURCE=.\sql_delete.cpp # End Source File # Begin Source File +SOURCE=.\sql_do.cpp +# End Source File +# Begin Source File + SOURCE=.\sql_handler.cpp # End Source File # Begin Source File diff --git a/VC++Files/test1/test1.dsp b/VC++Files/test1/test1.dsp index 50a165e3e4d..ffa5fd4d7ed 100644 --- a/VC++Files/test1/test1.dsp +++ b/VC++Files/test1/test1.dsp @@ -67,8 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/thr_insert_test/thr_insert_test.dsp b/VC++Files/thr_insert_test/thr_insert_test.dsp index 770125ab65b..91274e6817a 100644 --- a/VC++Files/thr_insert_test/thr_insert_test.dsp +++ b/VC++Files/thr_insert_test/thr_insert_test.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MT /W3 /GX- /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX- /ZI /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /I "../" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" diff --git a/VC++Files/thr_test/thr_test.dsp b/VC++Files/thr_test/thr_test.dsp index 7256f8da2fa..495d7280808 100644 --- a/VC++Files/thr_test/thr_test.dsp +++ b/VC++Files/thr_test/thr_test.dsp @@ -68,8 +68,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Gm /ZI /Od /I "../include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /Fr /YX +# ADD CPP /nologo /G6 /MTd /W3 /Gm /Zi /Od /I "../include" /D "__WIN32__" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x40b /d "_DEBUG" # ADD RSC /l 0x40b /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/vio/vio.dsp b/VC++Files/vio/vio.dsp index d4b77aad391..7c6ecb47e5d 100644 --- a/VC++Files/vio/vio.dsp +++ b/VC++Files/vio/vio.dsp @@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Zi /Od /I "../include" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe diff --git a/VC++Files/winmysqladmin/db.cpp b/VC++Files/winmysqladmin/db.cpp new file mode 100644 index 00000000000..6e796856a7e --- /dev/null +++ b/VC++Files/winmysqladmin/db.cpp @@ -0,0 +1,80 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "db.h" +#include "main.h" +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" +Tdbfrm *dbfrm; +//--------------------------------------------------------------------------- +__fastcall Tdbfrm::Tdbfrm(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall Tdbfrm::SpeedButton2Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- +void __fastcall Tdbfrm::SpeedButton1Click(TObject *Sender) +{ + if (VerDBName()) + { + if (!Form1->CreatingDB()) + { + Form1->OutRefresh(); + Edit1->Text = ""; + Application->MessageBox("The database was created", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + } + } + + + + + +} +//--------------------------------------------------------------------------- +bool __fastcall Tdbfrm::VerDBName() +{ + String temp = Edit1->Text; + if (Edit1->Text.IsEmpty()) + { + Application->MessageBox("The name of the Database is Empty", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + return false; + } + + if (temp.Length() > 64) + { + Application->MessageBox("The name of the Database can't have more than 64 characters ", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + return false; + } + + for (int j = 1; j <= temp.Length(); j++) + { + if (temp[j] == ' ') + { + Application->MessageBox("The name of the Database can't have blank spaces ", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + return false; + } + else if (temp[j] == '/') + { + Application->MessageBox("The name of the Database can't have frontslash (/)", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + return false; + } + else if (temp[j] == '\\') + { + Application->MessageBox("The name of the Database can't have backslash (\\)", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + return false; + } + else if (temp[j] == '.') + { + Application->MessageBox("The name of the Database can't have periods", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + return false; + } + } + return true; +} +//--------------------------------------------------------------------------- diff --git a/VC++Files/winmysqladmin/db.h b/VC++Files/winmysqladmin/db.h new file mode 100644 index 00000000000..f7ab87351ea --- /dev/null +++ b/VC++Files/winmysqladmin/db.h @@ -0,0 +1,32 @@ +//--------------------------------------------------------------------------- +#ifndef dbH +#define dbH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class Tdbfrm : public TForm +{ +__published: // IDE-managed Components + TImage *Image1; + TLabel *Label1; + TLabel *Label2; + TEdit *Edit1; + TSpeedButton *SpeedButton1; + TSpeedButton *SpeedButton2; + void __fastcall SpeedButton2Click(TObject *Sender); + void __fastcall SpeedButton1Click(TObject *Sender); +private: // User declarations + bool __fastcall VerDBName(); +public: // User declarations + __fastcall Tdbfrm(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern PACKAGE Tdbfrm *dbfrm; +//--------------------------------------------------------------------------- +#endif diff --git a/VC++Files/winmysqladmin/images/Goahead.ico b/VC++Files/winmysqladmin/images/Goahead.ico new file mode 100644 index 00000000000..8241c90e2a2 Binary files /dev/null and b/VC++Files/winmysqladmin/images/Goahead.ico differ diff --git a/VC++Files/winmysqladmin/images/HELP.ICO b/VC++Files/winmysqladmin/images/HELP.ICO new file mode 100644 index 00000000000..d0cd6d68cce Binary files /dev/null and b/VC++Files/winmysqladmin/images/HELP.ICO differ diff --git a/VC++Files/winmysqladmin/images/INFO.ICO b/VC++Files/winmysqladmin/images/INFO.ICO new file mode 100644 index 00000000000..e3afa8cf52c Binary files /dev/null and b/VC++Files/winmysqladmin/images/INFO.ICO differ diff --git a/VC++Files/winmysqladmin/images/Info.bmp b/VC++Files/winmysqladmin/images/Info.bmp new file mode 100644 index 00000000000..58f729fb1fd Binary files /dev/null and b/VC++Files/winmysqladmin/images/Info.bmp differ diff --git a/VC++Files/winmysqladmin/images/MYINI.ICO b/VC++Files/winmysqladmin/images/MYINI.ICO new file mode 100644 index 00000000000..428ed8e92b0 Binary files /dev/null and b/VC++Files/winmysqladmin/images/MYINI.ICO differ diff --git a/VC++Files/winmysqladmin/images/Myini.bmp b/VC++Files/winmysqladmin/images/Myini.bmp new file mode 100644 index 00000000000..e743a1b9b32 Binary files /dev/null and b/VC++Files/winmysqladmin/images/Myini.bmp differ diff --git a/VC++Files/winmysqladmin/images/Noentry.ico b/VC++Files/winmysqladmin/images/Noentry.ico new file mode 100644 index 00000000000..27f2211f56c Binary files /dev/null and b/VC++Files/winmysqladmin/images/Noentry.ico differ diff --git a/VC++Files/winmysqladmin/images/SETUP.BMP b/VC++Files/winmysqladmin/images/SETUP.BMP new file mode 100644 index 00000000000..c5794e5ac00 Binary files /dev/null and b/VC++Files/winmysqladmin/images/SETUP.BMP differ diff --git a/VC++Files/winmysqladmin/images/Setup 16.bmp b/VC++Files/winmysqladmin/images/Setup 16.bmp new file mode 100644 index 00000000000..e17b06155fb Binary files /dev/null and b/VC++Files/winmysqladmin/images/Setup 16.bmp differ diff --git a/VC++Files/winmysqladmin/images/Table.ico b/VC++Files/winmysqladmin/images/Table.ico new file mode 100644 index 00000000000..4469a915b7f Binary files /dev/null and b/VC++Files/winmysqladmin/images/Table.ico differ diff --git a/VC++Files/winmysqladmin/images/Working.ico b/VC++Files/winmysqladmin/images/Working.ico new file mode 100644 index 00000000000..72faedbbfc5 Binary files /dev/null and b/VC++Files/winmysqladmin/images/Working.ico differ diff --git a/VC++Files/winmysqladmin/images/database.ico b/VC++Files/winmysqladmin/images/database.ico new file mode 100644 index 00000000000..9689aa88361 Binary files /dev/null and b/VC++Files/winmysqladmin/images/database.ico differ diff --git a/VC++Files/winmysqladmin/images/find.ico b/VC++Files/winmysqladmin/images/find.ico new file mode 100644 index 00000000000..2e0f96c52f9 Binary files /dev/null and b/VC++Files/winmysqladmin/images/find.ico differ diff --git a/VC++Files/winmysqladmin/images/green.ico b/VC++Files/winmysqladmin/images/green.ico new file mode 100644 index 00000000000..ef53cd87994 Binary files /dev/null and b/VC++Files/winmysqladmin/images/green.ico differ diff --git a/VC++Files/winmysqladmin/images/help.bmp b/VC++Files/winmysqladmin/images/help.bmp new file mode 100644 index 00000000000..76c6a90d2d8 Binary files /dev/null and b/VC++Files/winmysqladmin/images/help.bmp differ diff --git a/VC++Files/winmysqladmin/images/initsetup.cpp b/VC++Files/winmysqladmin/images/initsetup.cpp new file mode 100644 index 00000000000..d0dd15b059c --- /dev/null +++ b/VC++Files/winmysqladmin/images/initsetup.cpp @@ -0,0 +1,42 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "initsetup.h" +#include "main.h" +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" +TForm2 *Form2; +//--------------------------------------------------------------------------- +__fastcall TForm2::TForm2(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::BitBtn1Click(TObject *Sender) +{ +if ((Edit1->Text).IsEmpty() || (Edit2->Text).IsEmpty()) + Application->MessageBox("Fill the User name and Password text boxs ", "Winmysqladmin 1.0", MB_OK |MB_ICONINFORMATION); + else + { + if(Form1->ForceConnection()) + if(Form1->ForceMySQLInit()) + { + Form1->CreateMyIniFile(); + Form1->CreatingShortCut(); + } + Close(); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::BitBtn2Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::SpeedButton1Click(TObject *Sender) +{ + Application->HelpCommand(HELP_FINDER,0); +} +//--------------------------------------------------------------------------- diff --git a/VC++Files/winmysqladmin/images/killdb.ico b/VC++Files/winmysqladmin/images/killdb.ico new file mode 100644 index 00000000000..9689aa88361 Binary files /dev/null and b/VC++Files/winmysqladmin/images/killdb.ico differ diff --git a/VC++Files/winmysqladmin/images/logo.ico b/VC++Files/winmysqladmin/images/logo.ico new file mode 100644 index 00000000000..9409cad72b6 Binary files /dev/null and b/VC++Files/winmysqladmin/images/logo.ico differ diff --git a/VC++Files/winmysqladmin/images/multitrg.ico b/VC++Files/winmysqladmin/images/multitrg.ico new file mode 100644 index 00000000000..76ffbe29c77 Binary files /dev/null and b/VC++Files/winmysqladmin/images/multitrg.ico differ diff --git a/VC++Files/winmysqladmin/images/mysql-07.bmp b/VC++Files/winmysqladmin/images/mysql-07.bmp new file mode 100644 index 00000000000..dcae23b8813 Binary files /dev/null and b/VC++Files/winmysqladmin/images/mysql-07.bmp differ diff --git a/VC++Files/winmysqladmin/images/mysql-17.bmp b/VC++Files/winmysqladmin/images/mysql-17.bmp new file mode 100644 index 00000000000..0291c804006 Binary files /dev/null and b/VC++Files/winmysqladmin/images/mysql-17.bmp differ diff --git a/VC++Files/winmysqladmin/images/mysql.BMP b/VC++Files/winmysqladmin/images/mysql.BMP new file mode 100644 index 00000000000..ed5c7f9051f Binary files /dev/null and b/VC++Files/winmysqladmin/images/mysql.BMP differ diff --git a/VC++Files/winmysqladmin/images/red.ico b/VC++Files/winmysqladmin/images/red.ico new file mode 100644 index 00000000000..b28288d576e Binary files /dev/null and b/VC++Files/winmysqladmin/images/red.ico differ diff --git a/VC++Files/winmysqladmin/images/red22.BMP b/VC++Files/winmysqladmin/images/red22.BMP new file mode 100644 index 00000000000..a35052afa01 Binary files /dev/null and b/VC++Files/winmysqladmin/images/red22.BMP differ diff --git a/VC++Files/winmysqladmin/images/see.bmp b/VC++Files/winmysqladmin/images/see.bmp new file mode 100644 index 00000000000..72fb2c50ec6 Binary files /dev/null and b/VC++Files/winmysqladmin/images/see.bmp differ diff --git a/VC++Files/winmysqladmin/initsetup.cpp b/VC++Files/winmysqladmin/initsetup.cpp new file mode 100644 index 00000000000..0a25b8cb79c --- /dev/null +++ b/VC++Files/winmysqladmin/initsetup.cpp @@ -0,0 +1,40 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "initsetup.h" +#include "main.h" +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" +TForm2 *Form2; +//--------------------------------------------------------------------------- +__fastcall TForm2::TForm2(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::BitBtn1Click(TObject *Sender) +{ + if ((Edit1->Text).IsEmpty() || (Edit2->Text).IsEmpty()) + Application->MessageBox("Fill the User name and Password text boxs ", "Winmysqladmin 1.0", MB_OK |MB_ICONINFORMATION); + else + { + Form1->GetServerFile(); + Form1->CreateMyIniFile(); + Form1->CreatingShortCut(); + + Close(); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::BitBtn2Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::SpeedButton1Click(TObject *Sender) +{ + Application->HelpCommand(HELP_FINDER,0); +} +//--------------------------------------------------------------------------- diff --git a/VC++Files/winmysqladmin/initsetup.h b/VC++Files/winmysqladmin/initsetup.h new file mode 100644 index 00000000000..28f575198e3 --- /dev/null +++ b/VC++Files/winmysqladmin/initsetup.h @@ -0,0 +1,38 @@ +//--------------------------------------------------------------------------- +#ifndef initsetupH +#define initsetupH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm2 : public TForm +{ +__published: // IDE-managed Components + TImage *Image1; + TLabel *Label1; + TLabel *Label4; + TPanel *Panel1; + TLabel *Label5; + TLabel *Label6; + TLabel *Label2; + TEdit *Edit1; + TEdit *Edit2; + TBitBtn *BitBtn1; + TSpeedButton *SpeedButton1; + TBitBtn *BitBtn2; + void __fastcall BitBtn1Click(TObject *Sender); + void __fastcall BitBtn2Click(TObject *Sender); + void __fastcall SpeedButton1Click(TObject *Sender); +private: // User declarations +public: // User declarations + __fastcall TForm2(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern PACKAGE TForm2 *Form2; +//--------------------------------------------------------------------------- +#endif diff --git a/VC++Files/winmysqladmin/main.cpp b/VC++Files/winmysqladmin/main.cpp new file mode 100644 index 00000000000..6ca29659255 --- /dev/null +++ b/VC++Files/winmysqladmin/main.cpp @@ -0,0 +1,2529 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "main.h" +#include "initsetup.h" +#include "db.h" + +//--------------------------------------------------------------------------- +#pragma package(smart_init) +#pragma resource "*.dfm" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql.h" +#include + +TForm1 *Form1; +bool i_start, NT; +bool IsForce = false; +bool IsVariables = false; +bool IsProcess = false ; +bool IsDatabases = false; +bool new_line = 0; +bool ya = true; +bool yy = true; +bool rinit = false; +AnsiString vpath; +AnsiString vip; +MYSQL_RES *res_1; +static unsigned long q = 0; +bool preport = false; +bool treport = false; +bool ereport = false; +AnsiString mainroot; +bool IsMySQLNode = false; +MYSQL *MySQL; +//--------------------------------------------------------------------------- +__fastcall TForm1::TForm1(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::FormCreate(TObject *Sender) +{ + i_start = true; + IsConnect = false; + if (ParamCount() > 0){ + if (ParamStr(1) == "-h" || ParamStr(1) == "h" ) { + ShowHelp(); Application->Terminate(); } + else if (ParamStr(1) == "-w" || ParamStr(1) == "w") { + i_start = false; ContinueLoad(); } + } + else { + ContinueLoad(); Hide(); GetServerOptions(); } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::DrawItem(TMessage& Msg) +{ + IconDrawItem((LPDRAWITEMSTRUCT)Msg.LParam); + TForm::Dispatch(&Msg); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::MyNotify(TMessage& Msg) +{ + POINT MousePos; + + switch(Msg.LParam) { + case WM_RBUTTONUP: + if (GetCursorPos(&MousePos)){ + PopupMenu1->PopupComponent = Form1; SetForegroundWindow(Handle); + PopupMenu1->Popup(MousePos.x, MousePos.y);} + else Show(); + break; + case WM_LBUTTONUP: + if (GetCursorPos(&MousePos)){ + PopupMenu1->PopupComponent = Form1; SetForegroundWindow(Handle); + PopupMenu1->Popup(MousePos.x, MousePos.y); } + + ToggleState(); + break; + default: + break; } + + TForm::Dispatch(&Msg); +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::TrayMessage(DWORD dwMessage) +{ + NOTIFYICONDATA tnd; + PSTR pszTip; + + pszTip = TipText(); + + tnd.cbSize = sizeof(NOTIFYICONDATA); + tnd.hWnd = Handle; + tnd.uID = IDC_MYICON; + tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; + tnd.uCallbackMessage = MYWM_NOTIFY; + + if (dwMessage == NIM_MODIFY){ + tnd.hIcon = IconHandle(); + if (pszTip)lstrcpyn(tnd.szTip, pszTip, sizeof(tnd.szTip)); + else tnd.szTip[0] = '\0'; } + else { tnd.hIcon = NULL; tnd.szTip[0] = '\0'; } + + return (Shell_NotifyIcon(dwMessage, &tnd)); +} +//--------------------------------------------------------------------------- +HANDLE __fastcall TForm1::IconHandle(void) +{ + + if (!NT){ + if (MySQLSignal()){Image3->Visible = false; Image2->Visible = true; + return (Image2->Picture->Icon->Handle); } + else {Image2->Visible = false; Image3->Visible = true; + return (Image3->Picture->Icon->Handle); } + } + else { + if (TheServiceStatus()){Image3->Visible = false; Image2->Visible = true; + return (Image2->Picture->Icon->Handle); } + + else if (MySQLSignal()){Image3->Visible = false; Image2->Visible = true; + return (Image2->Picture->Icon->Handle); } + else {Image2->Visible = false; Image3->Visible = true; + return (Image3->Picture->Icon->Handle); } + } + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::ToggleState(void) +{ + + TrayMessage(NIM_MODIFY); + if (!NT){ + if (MySQLSignal()){SSW9->Caption = "ShutDown the Server"; + Image3->Visible = false; Image2->Visible = true; } + else {SSW9->Caption = "Start the Server"; + Image2->Visible = false; Image3->Visible = true; } + } + else { + if (TheServiceStart()) { + Standa->Enabled = false; + if (TheServiceStatus()) {RService->Enabled = false; + StopS->Enabled = true; + StopS->Caption = "Stop the Service"; + Image3->Visible = false; + Image2->Visible = true; } + else {RService->Enabled = true; + StopS->Enabled = true; + RService->Caption = "Remove the Service"; + StopS->Caption = "Start the Service"; + Image2->Visible = false; + Image3->Visible = true; } + } + else { + Standa->Enabled = true; + StopS->Enabled = false; + if (MySQLSignal()) { + RService->Enabled = false; + Standa->Caption = "ShutDown the Server Standalone"; + Image3->Visible = false; + Image2->Visible = true; } + + else { + RService->Enabled = true; + RService->Caption = "Install the Service"; + Standa->Caption = "Start the Server Standalone"; + Image2->Visible = false; + Image3->Visible = true; } + + } + + + } + +} +//--------------------------------------------------------------------------- +PSTR __fastcall TForm1::TipText(void) +{ + char* status = StatusLine->SimpleText.c_str(); + return status; + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::WMQueryEndSession(TWMQueryEndSession &msg) +{ + + + if (!NT) { + + if (MySQLSignal()){ + StatusLine->SimpleText = "Shutdown in progress....."; + Show(); Shutd(); msg.Result = 1; } + else { + StatusLine->SimpleText = "The Server already is down......"; + Show(); msg.Result = 1; Close(); } + } + else { + + Show(); + if (!TheServiceStart()) { if (MySQLSignal()) Shutd(); } + msg.Result = 1; + } + +} + +//--------------------------------------------------------------------------- +LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi) +{ + HICON hIcon; + + hIcon = (HICON)LoadImage(g_hinst, MAKEINTRESOURCE(lpdi->CtlID), IMAGE_ICON, + 16, 16, 0); + if (!hIcon) + return(false); + + DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon, + 16, 16, 0, NULL, DI_NORMAL); + + return(true); +} +//--------------------------------------------------------------------------- +AnsiString __fastcall TForm1::TheComputer() +{ + AnsiString theword; + DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; + char szBuf[MAX_COMPUTERNAME_LENGTH + 1]; + szBuf[0] = '\0'; + + GetComputerName(szBuf, &dwSize); + theword = (AnsiString) szBuf; + delete [] szBuf; + return theword; + +} +//--------------------------------------------------------------------------- +AnsiString __fastcall TForm1::TheOS() +{ + AnsiString theword; + OSVERSIONINFO info; + info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&info); + + switch (info.dwPlatformId) + { + case VER_PLATFORM_WIN32s: + NT = false; + theword = "Win32s detected"; + break; + case VER_PLATFORM_WIN32_WINDOWS: + NT = false; + theword = "Win 95 or Win 98 detected"; + break; + case VER_PLATFORM_WIN32_NT: + NT = true; + theword = "Windows NT detected"; + break; + } + return theword; +} +///--------------------------------------------------------------------------- +AnsiString __fastcall TForm1::TheUser() +{ + AnsiString theword; + DWORD dwSize = 0; + + GetUserName(NULL, &dwSize); + + char *szBuf = new char[dwSize]; + szBuf[0] = '\0'; + + GetUserName(szBuf, &dwSize); + theword = (AnsiString) szBuf; + delete [] szBuf; + return theword; + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::TakeIP(void) +{ + WORD wVersionRequested; + WSADATA WSAData; + wVersionRequested = MAKEWORD(1,1); + WSAStartup(wVersionRequested,&WSAData); + + hostent *P; + char s[128]; + in_addr in; + char *P2; + gethostname(s, 128); + P = gethostbyname(s); + + Memo2->Lines->Clear(); + Memo2->Lines->Add((AnsiString)P->h_name); + mainroot = P->h_name; + in.S_un.S_un_b.s_b1 = P->h_addr_list[0][0]; + in.S_un.S_un_b.s_b2 = P->h_addr_list[0][1]; + in.S_un.S_un_b.s_b3 = P->h_addr_list[0][2]; + in.S_un.S_un_b.s_b4 = P->h_addr_list[0][3]; + P2 = inet_ntoa(in); + vip = P2; + mainroot += " ( " + (AnsiString)P2 + " )"; + Memo2->Lines->Add(P2); + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::GetmemStatus(void) +{ + MEMORYSTATUS ms; + ms.dwLength = sizeof(MEMORYSTATUS); + GlobalMemoryStatus(&ms); + + Edit2->Text = AnsiString((double)ms.dwTotalPhys / 1024000.0) + " MB RAM"; +} + +//--------------------------------------------------------------------------- +void __fastcall TForm1::ShowHelp(void) +{ + Application->MessageBox("Usage: WinMySQLadmin.EXE [OPTIONS]\n\n-w Run the tool without start the Server.\n-h Shows this message and exit ", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::ContinueLoad(void) +{ + OS->Text = TheOS(); + Localhost->Text = TheComputer(); + Localuser->Text = TheUser(); + GetmemStatus(); + ClearBox(); + TakeIP(); + MyODBC(); + + + IsMyIniUp(); + + if (!NT) { WinNT->Enabled = false; NtVer->Enabled = false; Win9->Enabled = true; } + else { WinNT->Enabled = true; Win9->Enabled = false; } + + if (i_start) + { + // NT never is started from the prompt + if ((!NT) && (!MySQLSignal())) mysqldstart(); + { + TrayMessage(NIM_MODIFY); + SeekErrFile(); + } + } + Hide(); + +} + +//--------------------------------------------------------------------------- +void __fastcall TForm1::MyODBC(void) +{ + + TRegistry *Registry = new TRegistry(); + Memo3->Lines->Clear(); + + try + { + Registry->RootKey = HKEY_LOCAL_MACHINE; + // the basic data of myodbc + if (Registry->OpenKey("Software\\ODBC\\ODBCINST.INI\\MySQL", false)) + { + Memo3->Lines->Add("Driver Version\t" + Registry->ReadString("DriverODBCVer")); + Memo3->Lines->Add("Driver\t\t" + Registry->ReadString("Driver")); + Memo3->Lines->Add("API Level\t\t" + Registry->ReadString("APILevel")); + Memo3->Lines->Add("Setup\t\t" + Registry->ReadString("Setup")); + Memo3->Lines->Add("SQL Level\t" + Registry->ReadString("SQLLevel")); + } + else + Memo3->Lines->Add("Not Found"); + + } + catch (...) + { + delete Registry; + } + Memo3->Enabled = false; +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::IsMyIniUp(void) +{ + // we see if the my.ini is Up + AnsiString asFileName = FileSearch("my.ini", TheWinDir()); + if (asFileName.IsEmpty()) + { + IsForce = true; + i_start = false; + QuickSearch(); + } + else + { + Memo1->Enabled = true; + Memo1->Lines->Clear(); + FillMyIni(); + GetBaseDir(); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::QuickSearch(void) +{ + AnsiString asFileName = FileSearch("mysql.exe", "c:/mysql/bin"); + if (!asFileName.IsEmpty()) + BaseDir->Text = "c:/mysql"; +} +//--------------------------------------------------------------------------- +AnsiString __fastcall TForm1::TheWinDir() +{ + AnsiString WinDir; + UINT BufferSize = GetWindowsDirectory(NULL,0); + WinDir.SetLength(BufferSize+1); + GetWindowsDirectory(WinDir.c_str(),BufferSize); + char* dirw = WinDir.c_str(); + return dirw ; + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::FillMyIni(void) +{ + Memo1->Lines->LoadFromFile(TheWinDir() + "\\my.ini"); + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::GetBaseDir(void) +{ + + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + char file[_MAX_FNAME]; + char ext[_MAX_EXT]; + + + TIniFile *pIniFile = new + TIniFile(TheWinDir() + "\\my.ini"); + + BaseDir->Text = pIniFile->ReadString("mysqld","basedir","") ; + AnsiString lx = pIniFile->ReadString("WinMySQLadmin","Server","") ; + _splitpath((lx).c_str(),drive,dir,file,ext); + AnsiString lw = (AnsiString) file + ext; + + if ( lw == "mysqld-shareware.exe") {ShareVer->Checked = true;} + if ( lw == "mysqld.exe") {MysqldVer->Checked = true;} + if ( lw == "mysqld-opt.exe") {OptVer->Checked = true;} + if ( lw == "mysqld-nt.exe") {NtVer->Checked = true;} + + delete pIniFile; + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Showme1Click(TObject *Sender) +{ + if(Showme1->Caption == "Show me") { TrayMessage(NIM_DELETE); + Showme1->Caption = "Hide me"; Show(); } + else { TrayMessage(NIM_ADD); TrayMessage(NIM_MODIFY); + Showme1->Caption = "Show me"; Hide(); } +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::MySQLSignal() +{ + HANDLE hEventShutdown; + hEventShutdown=OpenEvent(EVENT_MODIFY_STATE, 0, "MySqlShutdown"); + + if(hEventShutdown) + { + CloseHandle(hEventShutdown); + return true; + } + else + { + CloseHandle(hEventShutdown); + return false; + } + +} + +//--------------------------------------------------------------------------- +bool __fastcall TForm1::mysqldstart() +{ + memset(&pi, 0, sizeof(pi)); + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags |= STARTF_USESHOWWINDOW; + si.wShowWindow |= SW_SHOWNORMAL; + + + TIniFile *pIniFile = new + TIniFile(TheWinDir() + "\\my.ini"); + + if (NT) + vpath = pIniFile->ReadString("WinMySQLadmin","Server","") + " --standalone\0" ; + else + vpath = pIniFile->ReadString("WinMySQLadmin","Server","") + "\0" ; + + if ( ! CreateProcess(0,vpath.c_str(), 0, 0, 0, 0, 0, 0, &si,&pi)) + { + TrayMessage(NIM_MODIFY); + return false; + } + else + { + TrayMessage(NIM_MODIFY); + return true; + + } + +} + +//--------------------------------------------------------------------------- +bool __fastcall TForm1::SeekErrFile() +{ + Memo4->Enabled = true; + Memo4->Lines->Clear(); + AnsiString asFileName = FileSearch("mysql.err", BaseDir->Text + "/data"); + if (!asFileName.IsEmpty()) + { + FName = BaseDir->Text + "/data/mysql.err"; + ifstream in((FName).c_str()); + in.seekg(0, ios::end); + string s, line; + deque v; + deque lines; + streampos sp = in.tellg(); + if (sp <= 1000) + in.seekg(0, ios::beg); + else + { + in.seekg(0, ios::beg); + in.seekg((sp - 1000)); + } + + do { + lines.push_back(line); + }while (getline(in, line)); + + + if( lines.size() <= 15) + { + deque::reverse_iterator r; + for(r = lines.rbegin(); r != lines.rend() ; r++) + { + if (ereport) + Memo5->Lines->Add((*r).c_str()); + Memo4->Lines->Add((*r).c_str()); + + } + } + else + { + int k = 0; + deque::reverse_iterator r; + for(r = lines.rbegin(); r != lines.rend(); r++) + { + if (ereport) + Memo5->Lines->Add((*r).c_str()); + Memo4->Lines->Add((*r).c_str()); + if (++k >= 15) { break;} + } + } + in.close(); + return true; + } + else + return false; + +} + +//--------------------------------------------------------------------------- +void __fastcall TForm1::Timer1Timer(TObject *Sender) +{ + Showme1->Caption = "Show me"; + TrayMessage(NIM_ADD); + TrayMessage(NIM_MODIFY); + Hide(); + if (IsForce) {Form2->Show();} + Timer1->Enabled = false; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::GetServerFile() +{ + + AnsiString FileName; + + if(!NT) { + FileName = FileSearch("mysqld-opt.exe", ExtractFilePath(Application->ExeName)); + if (FileName.IsEmpty()) FileName = FileSearch("mysqld.exe", ExtractFilePath(Application->ExeName)); + if (FileName.IsEmpty()) FileName = FileSearch("mysqld-shareware.exe", ExtractFilePath(Application->ExeName)); + + if (!FileName.IsEmpty()){ + if ( FileName == "mysqld-opt.exe") {OptVer->Checked = true;} + if ( FileName == "mysqld.exe") {MysqldVer->Checked= true;} + if ( FileName == "mysqld-shareware.exe") {ShareVer->Checked= true;} } + + } + else { + + FileName = FileSearch("mysqld-nt.exe", ExtractFilePath(Application->ExeName)); + if (FileName.IsEmpty()) FileName = FileSearch("mysqld.exe", ExtractFilePath(Application->ExeName)); + if (FileName.IsEmpty()) FileName = FileSearch("mysqld-shareware.exe", ExtractFilePath(Application->ExeName)); + + if (!FileName.IsEmpty()) { + if ( FileName == "mysqld-nt.exe") {NtVer->Checked = true;} + if ( FileName == "mysqld.exe") {MysqldVer->Checked= true;} + if ( FileName == "mysqld-shareware.exe") {ShareVer->Checked= true;} } + + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::CreateMyIniFile(void) +{ + char szFileName[6]; + int iFileHandle; + AnsiString jk; + + Memo1->Enabled = true; + Memo1->Lines->Clear(); + strcpy(szFileName,"\\my.ini"); + iFileHandle = FileCreate(TheWinDir() + szFileName ); + + jk = "#This File was made using the WinMySQLadmin 1.0 Tool\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#" + Now() + "\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#Uncomment or Add only the keys that you know how works.\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#Read the MySQL Manual for instructions\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + + jk = "[mysqld]\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "basedir=" + TheDir() + "\n"; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#bind-address=" + vip + "\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#datadir=" + TheDir() + "/data\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#language=" + TheDir() + "/share/your language directory\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#delay-key-write-for-all-tables\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#log-long-format\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#slow query log=#\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#tmpdir=#\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#ansi\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#new\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#port=3306\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#safe\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#skip-name-resolve\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#skip-networking\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#skip-new\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#skip-host-cache\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#set-variable = key_buffer=16M\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#set-variable = max_allowed_packet=1M\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#set-variable = thread_stack=128K\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#set-variable = flush_time=1800\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "[mysqldump]\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#quick\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#set-variable = max_allowed_packet=16M\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "[mysql]\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#no-auto-rehash\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "[isamchk]\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "#set-variable= key=16M\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "[WinMySQLadmin]\n\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + + if (ShareVer->Checked) { jk = "Server=" + TheDir() + "/bin/mysqld-shareware.exe\n\n";} + if (MysqldVer->Checked) {jk = "Server=" + TheDir() + "/bin/mysqld.exe\n\n";} + if (OptVer->Checked) {jk = "Server=" + TheDir() + "/bin/mysqld-opt.exe\n\n";} + if (NtVer->Checked) {jk = "Server=" + TheDir() + "/bin/mysqld-nt.exe\n\n";} + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "user=" + Form2->Edit1->Text + "\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + jk = "password=" + Form2->Edit2->Text + "\n" ; + FileWrite(iFileHandle, (jk).c_str(), (jk).Length()); + + FileClose(iFileHandle); + FillMyIni(); + +} + +//--------------------------------------------------------------------------- +bool __fastcall TForm1::CreatingShortCut() +{ + // Where is The Start Menu in this Machine ? + LPITEMIDLIST pidl; + LPMALLOC pShellMalloc; + char szDir[MAX_PATH + 16]; + AnsiString file; + AnsiString jk = "\\WinMySQLadmin.lnk" ; + + if(SUCCEEDED(SHGetMalloc(&pShellMalloc))) + { + if(SUCCEEDED(SHGetSpecialFolderLocation(NULL, + CSIDL_STARTUP, &pidl))) + { + if(!SHGetPathFromIDList(pidl, szDir)) + { + pShellMalloc->Release(); + pShellMalloc->Free(pidl); + return false; + } + + pShellMalloc->Free(pidl); + } + + pShellMalloc->Release(); + StrCat(szDir, jk.c_str()); + } + + // the create + + IShellLink* pLink; + IPersistFile* pPersistFile; + + if(SUCCEEDED(CoInitialize(NULL))) + { + if(SUCCEEDED(CoCreateInstance(CLSID_ShellLink, NULL, + CLSCTX_INPROC_SERVER, + IID_IShellLink, (void **) &pLink))) + { + + pLink->SetPath((ExtractFilePath(Application->ExeName) + "WinMySQLadmin.exe").c_str()); + pLink->SetDescription("WinMySQLadmin Tool"); + pLink->SetShowCmd(SW_SHOW); + + if(SUCCEEDED(pLink->QueryInterface(IID_IPersistFile, + (void **)&pPersistFile))) + { + + WideString strShortCutLocation(szDir); + pPersistFile->Save(strShortCutLocation.c_bstr(), TRUE); + pPersistFile->Release(); + } + pLink->Release(); + } + + CoUninitialize(); + } + + + return true; +} + +//--------------------------------------------------------------------------- +AnsiString __fastcall TForm1::TheDir() +{ + AnsiString buffer; + char s[_MAX_PATH + 1]; + + StrCopy(s, ( BaseDir->Text).c_str()) ; + + for (int i = 0; s[i] != NULL; i++) + if (s[i] != '\\') + buffer += s[i]; + else + buffer += "/"; + + return buffer; + +} + +//--------------------------------------------------------------------------- +void __fastcall TForm1::SpeedButton1Click(TObject *Sender) +{ + Application->HelpCommand(HELP_FINDER,0); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Timer2Timer(TObject *Sender) +{ + ToggleState(); + +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::TheServiceStart() +{ + bool thatok; + char *SERVICE_NAME = "MySql"; + SC_HANDLE myService, scm; + scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS | GENERIC_WRITE); + if (scm) + { + myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); + if (myService) + thatok = true; + else + thatok = false; + } + CloseServiceHandle(myService); + CloseServiceHandle(scm); + return thatok; +} + +//--------------------------------------------------------------------------- +bool __fastcall TForm1::TheServicePause() +{ + + bool thatok; + char *SERVICE_NAME = "MySql"; + SC_HANDLE myService, scm; + scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); + + if (scm) + { + myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); + if (myService) + { + // stop the service + if (IsConnect) + { + mysql_kill(MySQL,mysql_thread_id(MySQL)); + StatusLine->SimpleText = ""; + q = 0; + } + + + SERVICE_STATUS ss; + thatok = ControlService(myService, + SERVICE_CONTROL_STOP, + &ss); + + } + else + thatok = false; + } + else + thatok = false; + + CloseServiceHandle(myService); + CloseServiceHandle(scm); + return thatok; +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::TheServiceResume() +{ + + bool thatok; + char *SERVICE_NAME = "MySql"; + SC_HANDLE myService, scm; + scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); + + if (scm) + { + myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); + if (myService) + { + // start the service + + thatok = StartService(myService, 0, NULL); + } + else + thatok = false; + } + else + thatok = false; + + CloseServiceHandle(myService); + CloseServiceHandle(scm); + return thatok; +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::TheServiceStatus() +{ + bool thatok; + bool k; + char *SERVICE_NAME = "MySql"; + SC_HANDLE myService, scm; + SERVICE_STATUS ss; + DWORD dwState = 0xFFFFFFFF; + scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); + + if (scm) + { + myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); + if (myService) + { + memset(&ss, 0, sizeof(ss)); + k = QueryServiceStatus(myService,&ss); + if (k) + { + dwState = ss.dwCurrentState; + if (dwState == SERVICE_RUNNING) + thatok = true; + } + else + thatok = false; + } + else + thatok = false; + } + else + thatok = false; + + CloseServiceHandle(myService); + CloseServiceHandle(scm); + return thatok; +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::TheServiceCreate() + +{ + bool thatok; + char *SERVICE_NAME = "MySql"; + char *szFullPath = vpath.c_str(); + SC_HANDLE myService, scm; + scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); + + if (scm) + { myService = CreateService( + scm, + SERVICE_NAME, + SERVICE_NAME, + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, + SERVICE_AUTO_START , + SERVICE_ERROR_NORMAL, + szFullPath, + NULL, + NULL, + NULL, + NULL, + NULL); + + if (myService) + thatok = true; + else + thatok = false; + + } + + CloseServiceHandle(myService); + CloseServiceHandle(scm); + return thatok; + +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Swin9Click(TObject *Sender) +{ + if(Application->MessageBox("Shutdown this tool", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + Close(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SSW9Click(TObject *Sender) +{ + if (MySQLSignal()) + { + if(Application->MessageBox("Shutdown the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + + if (Shutd()) + { + IsConnect = false; + IsVariables = false; + IsProcess = false; + IsDatabases = false; + ya = false; + ClearBox(); + Sleep(500); + TrayMessage(NIM_MODIFY); + + } + else + Application->MessageBox("Fails to Shutdown the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + } + } + else + { + if(Application->MessageBox("Start the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + if (mysqldstart()) + { + TrayMessage(NIM_MODIFY); + ya = true; + } + else + Application->MessageBox("Fails to Start the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + + } + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::ShutDownBoth1Click(TObject *Sender) +{ + if (MySQLSignal()) + { + if(Application->MessageBox("Shutdown the MySQL Server and this tool ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + + if (Shutd()) + Close(); + else + { + Application->MessageBox("Fails to Shutdown the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + + } + } + } + else + if(Application->MessageBox("Shutdown this tool ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + Close(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::ShutDownthisTool1Click(TObject *Sender) +{ + if(Application->MessageBox("Shutdown this tool ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + Close(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::StopSClick(TObject *Sender) +{ + AnsiString theWarning; + theWarning = "Are you sure to stop the Service ?\n\nAll the connections will be loss !" ; + if (TheServiceStatus()) + { + if(Application->MessageBox(theWarning.c_str(), "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + if (TheServicePause()) + { + TrayMessage(NIM_MODIFY); + IsConnect = false; + IsVariables = false; + IsProcess = false; + IsDatabases = false; + ya = false; + ClearBox(); + + } + else + Application->MessageBox("Fails to stop the Service", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + + } + } + else + { + if(Application->MessageBox("Start the Service Manager for the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + if (TheServiceResume()) + { + ya = true; + TrayMessage(NIM_MODIFY); + } + else + Application->MessageBox("Fails to start the Service", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + } + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::RServiceClick(TObject *Sender) +{ + if (TheServiceStart()) + { + if(Application->MessageBox("Remove the MySQL Server service ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + if (!TheServiceRemove()) + Application->MessageBox("Fails to Remove The MySQL Server Service", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + } + } + else + { + if(Application->MessageBox("Install the MySQL Server service ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + if (!TheServerPath()) + Application->MessageBox("Please create first the my.ini setup", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + else + { + if (!TheServiceCreate()) + Application->MessageBox("Fails to Install The MySQL Server Service", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + } + + } + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::StandaClick(TObject *Sender) +{ + if (MySQLSignal()) + { + if(Application->MessageBox("Shutdown the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + if (Shutd()) + { + IsConnect = false; + IsVariables = false; + IsProcess = false; + IsDatabases = false; + ya = false; + ClearBox(); + Sleep(500); + TrayMessage(NIM_MODIFY); + + } + else + Application->MessageBox("Fails to Shutdown the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + } + } + else + { + if(Application->MessageBox("Start the MySQL Server ", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + if (mysqldstart()) + { + StatusLine->SimpleText = ""; + TrayMessage(NIM_MODIFY); + + } + else + Application->MessageBox("Fails to Start the Server", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + } + } +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::Shutd() +{ + // from Irena + HANDLE hEventShutdown; + hEventShutdown=OpenEvent(EVENT_MODIFY_STATE, 0, "MySqlShutdown"); + + if (IsConnect) + { + mysql_kill(MySQL,mysql_thread_id(MySQL)); + mysql_shutdown(MySQL); + StatusLine->SimpleText = ""; + + } + + q = 0; + + + if(hEventShutdown) + { + SetEvent(hEventShutdown); + CloseHandle(hEventShutdown); + TrayMessage(NIM_MODIFY); + IsConnect = false; + return true; + } + else + { + TrayMessage(NIM_MODIFY); + return false; + } + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::ClearBox(void) +{ + + st22->Text = ""; + st23->Text = ""; + st24->Text = ""; + st25->Text = ""; + st26->Text = ""; + st27->Text = ""; + st28->Text = ""; + st29->Text = ""; + Edit3->Text = ""; + Edit4->Text = ""; + Edit5->Text = ""; + Edit6->Text = ""; + +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::TheServiceRemove() +{ + bool thatok; + char *SERVICE_NAME = "MySql"; + SC_HANDLE myService, scm; + scm = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS); + if (scm) + { + myService = OpenService(scm, SERVICE_NAME, SERVICE_ALL_ACCESS); + if (myService) + { + if(DeleteService(myService)) + { + CloseServiceHandle(myService); + CloseServiceHandle(scm); + thatok = true; + } + else + { + CloseServiceHandle(myService); + CloseServiceHandle(scm); + thatok = false; + } + + } + else + { + CloseServiceHandle(myService); + CloseServiceHandle(scm); + thatok = false; + } + } + else + { + thatok = false; + CloseServiceHandle(scm); + } + + return thatok; + +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::TheServerPath() +{ + + TIniFile *pIniFile = new + TIniFile(TheWinDir() + "\\my.ini"); + + vpath = pIniFile->ReadString("WinMySQLadmin","Server","") ; + delete pIniFile; + if (vpath.IsEmpty()) + return false; + else + return true; + +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button5Click(TObject *Sender) +{ + if (!SeekErrFile()) + Application->MessageBox("Fails to find mysql.err", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::IsMySQLInit(void) +{ + AnsiString theCommand; + char *host = NULL,*password=0,*user=0 ; + TIniFile *pIniFile = new + TIniFile(TheWinDir() + "\\my.ini"); + + AnsiString MyUser = pIniFile->ReadString("WinMySQLadmin","user","") ; + AnsiString MyPass = pIniFile->ReadString("WinMySQLadmin","password","") ; + + delete pIniFile; + + + if (!MyUser.IsEmpty() && MyUser.Length() && !MyPass.IsEmpty() && MyPass.Length()) + { + if (!IsConnect) + { + + MySQL = mysql_init(MySQL); + if (mysql_real_connect(MySQL, "localhost",(MyUser).c_str(), (MyPass).c_str() , 0, 0, NULL, 0)) + IsConnect = true; + else + { + if(mysql_real_connect(MySQL,host,user,password , 0, 0, NULL, 0)) + { + IsConnect = true; + theCommand = "GRANT ALL PRIVILEGES ON *.* TO "; + theCommand += "'" + MyUser + "' @localhost IDENTIFIED BY "; + theCommand += "'" + MyPass + "' with GRANT OPTION"; + char* los = theCommand.c_str(); + if(!mysql_query(MySQL, los )) + StatusLine->SimpleText = " "; + } + + } + + } + + } + else + { + if (!IsConnect) + { + MySQL = mysql_init(MySQL); + if(mysql_real_connect(MySQL,host,user,password , 0, 0, NULL, 0)) + IsConnect = true; + } + } +} + +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Timer3Timer(TObject *Sender) +{ + if ((NT) && TheServiceStatus()) {IsMySQLInit(); } + + if ((NT) && !TheServiceStatus() && MySQLSignal()) {IsMySQLInit(); } + + if (!(NT) && MySQLSignal()) {IsMySQLInit(); } + + if (IsConnect) + { + GetServerStatus(); + if (!IsMySQLNode) + GetMainRoot(); + Extended->Enabled = true; + if (!IsProcess && !GetProcess()) + StatusLine->SimpleText = ""; + if (!IsVariables && !GetVariables()) + StatusLine->SimpleText = ""; + Timer3->Interval = 10000; + } + else + Extended->Enabled = false; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::GetServerStatus(void) +{ + + GetExtendedStatus(); + Edit3->Text = mysql_get_server_info(MySQL); + Edit4->Text = mysql_get_host_info(MySQL); + Edit5->Text = mysql_get_client_info(); + Edit6->Text = mysql_get_proto_info(MySQL); + + +} + +//--------------------------------------------------------------------------- +bool __fastcall TForm1::GetProcess() +{ + MYSQL_RES *res; + MYSQL_ROW row; + unsigned int i; + int k = 0; + int therow = 1; + new_line=1; + + StringGrid2->RowCount= 2; + + if (!(res=mysql_list_processes(MySQL))) + { + return false; + } + + while ((row=mysql_fetch_row(res)) != 0) + { + mysql_field_seek(res,0); + StringGrid2->Cells[0][0] = "PID"; + StringGrid2->Cells[1][0] = "User"; + StringGrid2->Cells[2][0] = "Host"; + StringGrid2->Cells[3][0] = "DB"; + StringGrid2->Cells[4][0] = "Command"; + StringGrid2->Cells[5][0] = "Time"; + StringGrid2->Cells[6][0] = "State"; + StringGrid2->Cells[7][0] = "Info"; + for (i=0 ; i < mysql_num_fields(res); i++) + { + + if (k <= 6 ) + { + StringGrid2->Cells[k][therow] = row[i]; + k++; + } + else + { + + StringGrid2->Cells[(k)][therow] = row[i]; + k = 0; + therow++ ; + StringGrid2->RowCount++; + + } + + } + + } + + StringGrid2->RowCount--; + mysql_free_result(res); + StringGrid5->RowCount--; + IsProcess = true; + return true; + +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::GetVariables() +{ + MYSQL_RES *res; + MYSQL_ROW row; + unsigned int i; + int k = 1; + new_line=1; + bool left = true; + AnsiString report; + StringGrid1->RowCount = 2; + if (mysql_query(MySQL,"show variables") || + !(res=mysql_store_result(MySQL))) + { + return false; + } + + while ((row=mysql_fetch_row(res)) != 0) + { + mysql_field_seek(res,0); + + StringGrid1->Cells[0][0] = "Variable Name"; + StringGrid1->Cells[1][0] = "Value"; + + + for (i=0 ; i < mysql_num_fields(res); i++) + { + + if (left) + { + if (treport) + report = GetString(row[i]); + StringGrid1->Cells[0][k++] = row[i]; + left = false; + } + else + { + if (treport) + Memo5->Lines->Add(report + row[i]); + StringGrid1->RowCount++; + StringGrid1->Cells[1][--k] = row[i]; + k++; + left = true; + } + + } + + } + + StringGrid1->RowCount--; + mysql_free_result(res); + IsVariables = true; + return true; +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::nice_time(AnsiString buff) +{ + + unsigned long sec; + unsigned long tmp; + AnsiString mytime; + + sec = StrToInt(buff); + + if (sec >= 3600L*24) + { + tmp=sec/(3600L*24); + sec-=3600L*24*tmp; + + mytime = IntToStr(tmp); + if (tmp > 1) + mytime+= " days "; + else + mytime+= " day "; + + } + + if (sec >= 3600L) + { + tmp=sec/3600L; + sec-=3600L*tmp; + mytime += IntToStr(tmp); + if (tmp > 1) + mytime+= " hours "; + else + mytime+= " hour "; + } + if (sec >= 60) + { + tmp=sec/60; + sec-=60*tmp; + mytime += IntToStr(tmp); + mytime+= " min "; + + } + mytime += IntToStr(sec); + mytime+= " sec "; + st29->Text = mytime ; + return true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Button11Click(TObject *Sender) +{ + if (IsConnect) + { + if (GetVariables()) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button10Click(TObject *Sender) +{ + if (IsConnect) + { + if (GetProcess()) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button6Click(TObject *Sender) +{ + if (IsConnect) + { + if (mysql_refresh(MySQL,REFRESH_HOSTS)) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button7Click(TObject *Sender) +{ + if (IsConnect) + { + if (mysql_refresh(MySQL,REFRESH_LOG)) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button8Click(TObject *Sender) +{ + if (IsConnect) + { + if (mysql_refresh(MySQL,REFRESH_TABLES)) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button2Click(TObject *Sender) +{ + Memo1->Enabled = true; + Memo1->Lines->Clear(); + AnsiString asFileName = FileSearch("my.ini", TheWinDir()); + if (asFileName.IsEmpty()) + Application->MessageBox("Don't found my.ini file on the Win Directory", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + else + FillMyIni(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button3Click(TObject *Sender) +{ + TIniFile *pIniFile = new + TIniFile(TheWinDir() + "\\my.ini"); + + if (!Memo1->GetTextLen()) + Application->MessageBox("The Memo Box is Empty", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + else + { + if(Application->MessageBox("Are you sure to write the modifications into My.ini file.", "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + Memo1->Lines->SaveToFile(TheWinDir() + "\\my.ini"); + + Memo1->Lines->Clear(); + Memo1->Enabled = true; + Memo1->Lines->Clear(); + if (NtVer->Checked) + pIniFile->WriteString("WinMySQLadmin","Server",TheDir() + "/bin/mysqld-nt.exe"); + if (MysqldVer->Checked == true) + pIniFile->WriteString("WinMySQLadmin","Server", TheDir() + "/bin/mysqld.exe"); + if (ShareVer->Checked) + pIniFile->WriteString("WinMySQLadmin","Server",TheDir() + "/bin/mysqld-shareware.exe"); + if (OptVer->Checked) + pIniFile->WriteString("WinMySQLadmin","Server", TheDir() + "/bin/mysqld-opt.exe"); + FillMyIni(); + Application->MessageBox("My.ini was modificated", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + } + + } + delete pIniFile; + Memo1->Lines->Clear(); + FillMyIni(); + +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button1Click(TObject *Sender) +{ + if(CreatingShortCut()) + Application->MessageBox("The ShortCut on Start Menu was created", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); + else + Application->MessageBox("Fails the Operation of Create the ShortCut", "WinMySQLadmin 1.0", MB_OK |MB_ICONINFORMATION); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SpeedButton2Click(TObject *Sender) +{ + BROWSEINFO info; + char szDir[MAX_PATH]; + char szDisplayName[MAX_PATH]; + LPITEMIDLIST pidl; + LPMALLOC pShellMalloc; + + + if(SHGetMalloc(&pShellMalloc) == NO_ERROR) + { + + memset(&info, 0x00,sizeof(info)); + info.hwndOwner = Handle; + info.pidlRoot = 0; + info.pszDisplayName = szDisplayName; + info.lpszTitle = "Search MySQL Base Directory"; + info.ulFlags = BIF_RETURNONLYFSDIRS; + info.lpfn = 0; + + pidl = SHBrowseForFolder(&info); + + if(pidl) + { + + if(SHGetPathFromIDList(pidl, szDir)) {BaseDir->Text = szDir; } + + pShellMalloc->Free(pidl); + } + pShellMalloc->Release(); + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::Button4Click(TObject *Sender) +{ + if (IsConnect) + { + Memo3->Lines->Add(mysql_stat(MySQL)); + } +} +//--------------------------------------------------------------------------- + + +void __fastcall TForm1::SpeedButton3Click(TObject *Sender) +{ + if(Showme1->Caption == "Show me") { TrayMessage(NIM_DELETE); + Showme1->Caption = "Hide me"; Show(); } + else { TrayMessage(NIM_ADD); TrayMessage(NIM_MODIFY); + Showme1->Caption = "Show me"; Hide(); } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::ExtendedClick(TObject *Sender) +{ +if (ya) + { + Extended->Caption = "Start Extended Server Status"; + ya = false; + ClearBox(); + } +else + { + Extended->Caption = "Stop Extended Server Status"; + ya = true; + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::GetServerOptions(void) +{ +AnsiString FileName; +FileName = FileSearch("mysqld-opt.exe", ExtractFilePath(Application->ExeName)); +if (FileName.IsEmpty()) {OptVer->Enabled = false; } + +FileName = FileSearch("mysqld-shareware.exe", ExtractFilePath(Application->ExeName)); +if (FileName.IsEmpty()) {ShareVer->Enabled = false; } + +FileName = FileSearch("mysqld.exe", ExtractFilePath(Application->ExeName)); +if (FileName.IsEmpty()) {MysqldVer->Enabled = false; } + +FileName = FileSearch("mysqld-nt.exe", ExtractFilePath(Application->ExeName)); +if (FileName.IsEmpty()) {NtVer->Enabled = false; } + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::GetReportServer(void) +{ + + AnsiString strspace; + Memo5->Lines->Clear(); + Memo5->Lines->Add("This Report was made using the WinMySQLadmin 1.0 Tool"); + Memo5->Lines->Add(""); + Memo5->Lines->Add(Now()); + Memo5->Lines->Add(""); + + preport = true; + Memo5->Lines->Add(""); + Memo5->Lines->Add("Server Status Values"); + Memo5->Lines->Add(""); + Memo5->Lines->Add(GetString("Server Info") + mysql_get_server_info(MySQL)); + Memo5->Lines->Add(GetString("Host Info") + mysql_get_host_info(MySQL)); + Memo5->Lines->Add(GetString("Client Info") + mysql_get_client_info()); + Memo5->Lines->Add(GetString("Proto Info") + mysql_get_proto_info(MySQL)); + GetExtendedStatus(); + preport = false; + treport = true; + Memo5->Lines->Add(""); + Memo5->Lines->Add("Variables Values"); + Memo5->Lines->Add(""); + GetVariables(); + treport = false; + ereport = true; + Memo5->Lines->Add(""); + Memo5->Lines->Add("Last Lines from Err File"); + Memo5->Lines->Add(""); + SeekErrFile(); + ereport = false; + +} + +void __fastcall TForm1::SpeedButton4Click(TObject *Sender) +{ + if(IsConnect) + GetReportServer(); + else + Application->MessageBox("The Server must be connected", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SpeedButton5Click(TObject *Sender) +{ + AnsiString PathName; + SaveFileDialog->FileName = PathName; + if (SaveFileDialog->Execute() ){ + PathName= SaveFileDialog->FileName; + Caption = ExtractFileName(PathName); + Memo5->Lines->SaveToFile(PathName); + Memo5->Modified = false; + } +} +//--------------------------------------------------------------------------- +String __fastcall TForm1::GetString(String k) +{ + int i = 35 - k.Length(); + for (int y = 1 ; y <= i ;y++ ) + k+= " "; + return k ; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::SpeedButton6Click(TObject *Sender) +{ + PrinterSetupDialog1->Execute(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SpeedButton7Click(TObject *Sender) +{ + AnsiString PathName; + if (PrintDialog1->Execute()){ + try { + Memo5->Print(PathName); + } + catch(...){ + Printer()->EndDoc(); + throw; + } + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SpeedButton8Click(TObject *Sender) +{ + Memo5->CutToClipboard(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SpeedButton9Click(TObject *Sender) +{ + Memo5->CopyToClipboard(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SpeedButton10Click(TObject *Sender) +{ + + Memo5->PasteFromClipboard(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SpeedButton11Click(TObject *Sender) +{ + Memo5->ClearSelection(); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::SpeedButton12Click(TObject *Sender) +{ + Memo5->SelectAll(); +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::GetMainRoot() +{ + + MYSQL_RES *res; + MYSQL_ROW row; + unsigned int i; + AnsiString command; + + CleanGrid(); + CleanGridI(); + TakeIP(); + + MySQLNode = DBView->Items->Add(NULL, mainroot.UpperCase()); + MySQLNode->ImageIndex = 0; + + if (!(res=mysql_list_dbs(MySQL,"%"))) { return false; } + while ((row=mysql_fetch_row(res)) != 0) { + mysql_field_seek(res,0); + + for (i=0 ; i < mysql_num_fields(res); i++) + { + MySQLDbs = DBView->Items->AddChild(MySQLNode, row[i]); + MySQLDbs->ImageIndex = 1; + MySQLDbs->SelectedIndex = 1; + + + } + + } + + mysql_free_result(res); + MySQLNode->Expanded = true; + + + + + IsMySQLNode = true; + return true; + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::DeleteDatabaseSClick(TObject *Sender) +{ + AnsiString alert; + if (IsConnect) + { + if(DBView->Selected == MySQLNode ) + Application->MessageBox("Invalid database row selected.", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + else if ( DBView->Selected == NULL ) + Application->MessageBox("Invalid database row selected.", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + else + { + if (DBView->Selected->Text.UpperCase() == "MYSQL") + Application->MessageBox("You cann't use this tool to drop the MySQL Database.", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + else { + alert = "Are you sure to drop the < "; + alert+= DBView->Selected->Text.c_str(); + alert+= " > database."; + if(Application->MessageBox(alert.c_str(), "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + char* lese = DBView->Selected->Text.c_str(); + if (!mysql_drop_db(MySQL, lese )) + { + DBView->Items->Clear(); + GetMainRoot(); + } + else + Application->MessageBox("Fails to drop the Database.", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + } + } + } + } + else + Application->MessageBox("The Server must be connected", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); +} +//--------------------------------------------------------------------------- + bool __fastcall TForm1::IsDatabase(String Name) +{ + MYSQL_RES *res; + MYSQL_ROW row; + unsigned int i; + AnsiString command; + + + CleanTree(); + command = "use "; + command+= Name.c_str(); + char* das = command.c_str(); + char* lis = Name.c_str(); + if (mysql_query(MySQL, das ) || + !(res=mysql_list_tables(MySQL,"%"))) + return false; + + MySQLNodeT = TableView->Items->Add(NULL, lis); + MySQLNodeT->ImageIndex = 1; + MySQLNodeT->SelectedIndex = 1; + while ((row=mysql_fetch_row(res)) != 0) { + mysql_field_seek(res,0); + + for (i=0 ; i < mysql_num_fields(res); i++) + { + + MySQLTbs = TableView->Items->AddChild(MySQLNodeT, row[i]); + MySQLTbs->ImageIndex = 2; + MySQLTbs->SelectedIndex = 2; + } + MySQLNodeT->Expanded = true; + } + mysql_free_result(res); + return true; +} +//--------------------------------------------------------------------------- + + +void __fastcall TForm1::DBViewClick(TObject *Sender) +{ + + if (IsConnect) + { + if (DBView->Selected != MySQLNode && DBView->Selected != NULL ) + { + IsDatabase(DBView->Selected->Text); + + } + else + { + CleanTree(); + } + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::TableViewClick(TObject *Sender) +{ + if (IsConnect) + { + if (DBView->Selected != MySQLNodeT ) + { + IsTable(TableView->Selected->Text); + IsIndex(TableView->Selected->Text); + + } + else + { + CleanGrid(); + CleanGridI(); + + } + } +} +//--------------------------------------------------------------------------- + bool __fastcall TForm1::IsTable(String Name) +{ + MYSQL_RES *res; + MYSQL_ROW row; + unsigned int i; + int k = 0; + int therow = 1; + new_line=1; + AnsiString command; + AnsiString commandt; + + CleanGrid(); + CleanGridI(); + command = "use "; + command+= DBView->Selected->Text.c_str(); + char* las = command.c_str(); + + commandt = "desc "; + commandt+= Name.c_str(); + char* les = commandt.c_str(); + + if (mysql_query(MySQL, las )) + return false; + + if (mysql_query(MySQL, les ) || + !(res=mysql_store_result(MySQL))) + return false ; + + StringGrid4->Cells[0][0] = "Field"; + StringGrid4->Cells[1][0] = "Type"; + StringGrid4->Cells[2][0] = "Null"; + StringGrid4->Cells[3][0] = "Key"; + StringGrid4->Cells[4][0] = "Default"; + StringGrid4->Cells[5][0] = "Extra"; + StringGrid4->Cells[6][0] = "Previleges"; + + + int thecounter; + String u = GetNumberServer(); + if ( u == "3.22") + { + StringGrid3->ColCount = 7; + thecounter = 4; + } + else + thecounter = 5; + + while ((row=mysql_fetch_row(res)) != 0) + { + mysql_field_seek(res,0); + + for (i=0 ; i < mysql_num_fields(res); i++) + { + if (k <= thecounter ) + { + StringGrid4->Cells[k][therow] = row[i]; + k++; + } + else + { + StringGrid4->Cells[(k)][therow] = row[i]; + k = 0; + therow++ ; + StringGrid4->RowCount++; + } + } + + } + StringGrid4->RowCount--; + mysql_free_result(res); + return true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::TableViewChange(TObject *Sender, TTreeNode *Node) +{ +if (IsConnect) + { + if (DBView->Selected != MySQLNodeT ) + { + IsTable(TableView->Selected->Text); + IsIndex(TableView->Selected->Text); + + } + else + { + CleanGrid(); + CleanGridI(); + + } + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::DBViewChange(TObject *Sender, TTreeNode *Node) +{ + if (IsConnect) + { + if (DBView->Selected != MySQLNode ) + { + IsDatabase(DBView->Selected->Text); + + } + else + { + CleanTree(); + } + } + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::RefreshSClick(TObject *Sender) +{ + MYSQL_RES *res; + MYSQL_ROW row; + unsigned int i; + AnsiString command; + + if (IsConnect) + { + IsMySQLNode = false; + CleanTree(); + DBView->Items->Clear(); + + TakeIP(); + + MySQLNode = DBView->Items->Add(NULL, mainroot.UpperCase()); + MySQLNode->ImageIndex = 0; + + if (!(res=mysql_list_dbs(MySQL,"%"))) { /*do nothing;*/ } + while ((row=mysql_fetch_row(res)) != 0) { + mysql_field_seek(res,0); + + for (i=0 ; i < mysql_num_fields(res); i++) + { + MySQLDbs = DBView->Items->AddChild(MySQLNode, row[i]); + MySQLDbs->ImageIndex = 1; + MySQLDbs->SelectedIndex = 1; + + } + + } + + mysql_free_result(res); + + IsMySQLNode = true; + + MySQLNode->Expanded = true; + + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::CreateDatabaseSClick(TObject *Sender) +{ + + if (IsConnect) + { + dbfrm->Show(); + + } + else + ShowMessage("Precisa estar conectado"); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::CleanTree(void) +{ + StringGrid4->RowCount= 2; + StringGrid4->Cells[0][1] = ""; + StringGrid4->Cells[1][1] = ""; + StringGrid4->Cells[2][1] = ""; + StringGrid4->Cells[3][1] = ""; + StringGrid4->Cells[4][1] = ""; + StringGrid4->Cells[5][1] = ""; + TableView->Items->Clear(); + +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::CleanGrid(void) +{ + StringGrid4->RowCount= 2; + StringGrid4->Cells[0][1] = ""; + StringGrid4->Cells[1][1] = ""; + StringGrid4->Cells[2][1] = ""; + StringGrid4->Cells[3][1] = ""; + StringGrid4->Cells[4][1] = ""; + StringGrid4->Cells[5][1] = ""; +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::CreatingDB() +{ + + if (mysql_create_db(MySQL, dbfrm->Edit1->Text.c_str())) + return true; + else + return false; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::OutRefresh(void) +{ + RefreshSClick(dbfrm->SpeedButton1); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::FlushHosts1Click(TObject *Sender) +{ + if (IsConnect) + { + if (mysql_refresh(MySQL,REFRESH_HOSTS)) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::FlushLogs1Click(TObject *Sender) +{ + if (IsConnect) + { + if (mysql_refresh(MySQL,REFRESH_LOG)) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- + +void __fastcall TForm1::FlushTables1Click(TObject *Sender) +{ + if (IsConnect) + { + if (mysql_refresh(MySQL,REFRESH_TABLES)) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- +//--------------------------------------------------------------------------- + bool __fastcall TForm1::IsIndex(String Name) +{ + MYSQL_RES *res; + MYSQL_ROW row; + unsigned int i; + int k = 0; + int therow = 1; + new_line=1; + AnsiString command; + AnsiString commandt; + i = 0; + CleanGridI(); + command = "use "; + command+= DBView->Selected->Text.c_str(); + char* las = command.c_str(); + + commandt = "show index from "; + commandt+= Name.c_str(); + char* les = commandt.c_str(); + + if (mysql_query(MySQL, las )) + return false; + + if (mysql_query(MySQL, les ) || + !(res=mysql_store_result(MySQL))) + return false ; + + StringGrid3->RowCount= 2; + StringGrid3->Cells[0][0] = "Table"; + StringGrid3->Cells[1][0] = "Non_unique"; + StringGrid3->Cells[2][0] = "Key_name"; + StringGrid3->Cells[3][0] = "Seq_in_index"; + StringGrid3->Cells[4][0] = "Col_name"; + StringGrid3->Cells[5][0] = "Collation"; + StringGrid3->Cells[6][0] = "Card."; + StringGrid3->Cells[7][0] = "Sub_part"; + StringGrid3->Cells[8][0] = "Packed"; + StringGrid3->Cells[9][0] = "Comment"; + + int thecounter; + String u = GetNumberServer(); + + if ( u == "3.22") + { + StringGrid3->ColCount = 8; + thecounter = 6; + } + else + thecounter = 8; + while ((row=mysql_fetch_row(res)) != 0) + { + mysql_field_seek(res,0); + + for (i=0 ; i < mysql_num_fields(res); i++) + { + if (k <= thecounter ) + { + StringGrid3->Cells[k][therow] = row[i]; + k++; + } + else + { + StringGrid3->Cells[(k)][therow] = row[i]; + k = 0; + therow++ ; + StringGrid3->RowCount++; + } + } + + } + if (i) + StringGrid3->RowCount--; + mysql_free_result(res); + return true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::CleanGridI(void) +{ + StringGrid3->RowCount= 2; + StringGrid3->Cells[0][1] = ""; + StringGrid3->Cells[1][1] = ""; + StringGrid3->Cells[2][1] = ""; + StringGrid3->Cells[3][1] = ""; + StringGrid3->Cells[4][1] = ""; + StringGrid3->Cells[5][1] = ""; + StringGrid3->Cells[6][1] = ""; + StringGrid3->Cells[7][1] = ""; +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::CreatingTable(String TheTable) +{ + + if (!mysql_query(MySQL, TheTable.c_str())) + return true; + else + return false; +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::GetExtendedStatus() +{ + if (!ya && !preport) + return true; + + MYSQL_RES *res; + MYSQL_ROW row; + unsigned int i; + int k = 1; + new_line=1; + bool left = true; + bool open_tables = false; + bool open_files = false; + bool uptime = false; + bool running_threads = false; + bool open_streams = false; + bool slow_queries = false; + bool opened_tables = false; + bool questions = false; + + AnsiString report; + if (yy) + StringGrid5->RowCount = 2; + + if (mysql_query(MySQL,"show status") || + !(res=mysql_store_result(MySQL))) + { + return false; + } + + while ((row=mysql_fetch_row(res)) != 0) + { + mysql_field_seek(res,0); + + StringGrid5->Cells[0][0] = "Variable Name"; + StringGrid5->Cells[1][0] = "Value"; + + + for (i=0 ; i < mysql_num_fields(res); i++) + { + + if (left) + { + if (preport) + report = GetString(row[i]); + if ( (String) row[i] == "Open_tables") + open_tables = true; + else + open_tables = false; + if ( (String) row[i] == "Open_files") + open_files = true; + else + open_files = false; + if ((String) row[i] == "Uptime") + uptime = true; + else + uptime = false; + + if ( (String) row[i] == "Opened_tables") + opened_tables = true; + else + opened_tables = false; + + if ( (String) row[i] == "Threads_running" || (String) row[i] == "Running_threads") + running_threads = true; + else + running_threads = false; + + if ( (String) row[i] == "Open_streams") + open_streams = true; + else + open_streams = false; + + if ( (String) row[i] == "Slow_queries") + slow_queries = true; + else + slow_queries = false; + + if ( (String) row[i] == "Questions") + questions = true; + else + questions = false; + + if (yy) + StringGrid5->Cells[0][k++] = row[i]; + + left = false; + } + else + { + if (preport) + Memo5->Lines->Add(report + row[i]); + if (open_tables) + st22->Text = row[i]; + if (open_files) + st23->Text = row[i]; + if (uptime) + nice_time(row[i]); + if (running_threads) + st27->Text = row[i]; + if (open_streams) + st24->Text = row[i]; + if (slow_queries) + st28->Text = row[i]; + if (opened_tables) + st25->Text = row[i]; + if (questions){ + q++; + st26->Text = StrToInt64(row[i]) - q; } + + if (yy){ + StringGrid5->RowCount++; + StringGrid5->Cells[1][--k] = row[i]; + k++; } + + left = true; + } + + } + + } + + + if (rinit) + StringGrid5->RowCount--; + mysql_free_result(res); + yy = false; + return true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::SpeedButton13Click(TObject *Sender) +{ + yy = true; + // rinit = true; +} +//--------------------------------------------------------------------------- +String __fastcall TForm1::GetNumberServer() +{ + String TheVersion; + + TheVersion = mysql_get_server_info(MySQL) ; + TheVersion.SetLength(4); + return TheVersion; + + +} + +//--------------------------------------------------------------------------- +void __fastcall TForm1::KillProcess1Click(TObject *Sender) +{ + + if (IsConnect) + KillPID(); + else + Application->MessageBox("The Server must be connected", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); +} +//--------------------------------------------------------------------------- +bool __fastcall TForm1::KillPID() +{ + String s = "Are you sure to kill the process PID no. "; + s+= StringGrid2->Cells[0][StringGrid2->Row]; + s+= " of the USER "; + s+= StringGrid2->Cells[1][StringGrid2->Row]; + unsigned long xx = mysql_thread_id(MySQL); + unsigned long yy = StrToInt(StringGrid2->Cells[0][StringGrid2->Row]); + if ( xx != yy) + { + if(Application->MessageBox(s.c_str(), "WinMySQLadmin 1.0", MB_YESNOCANCEL | MB_ICONQUESTION ) == IDYES) + { + if (!mysql_kill(MySQL,yy)) + { + GetProcess(); + return true; + } + } + } + else + { + Application->MessageBox("From here you can't kill the PID of this tool", "WinMySQLadmin 1.0", MB_OK | MB_ICONEXCLAMATION); + return true; + } + return true; +} +void __fastcall TForm1::FlushThreads1Click(TObject *Sender) +{ + if (IsConnect) + { + if (mysql_refresh(MySQL,REFRESH_THREADS)) + StatusLine->SimpleText = ""; + } +} +//--------------------------------------------------------------------------- + diff --git a/VC++Files/winmysqladmin/main.h b/VC++Files/winmysqladmin/main.h new file mode 100644 index 00000000000..dcb8ad60d7b --- /dev/null +++ b/VC++Files/winmysqladmin/main.h @@ -0,0 +1,314 @@ +//--------------------------------------------------------------------------- +#ifndef mainH +#define mainH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MYWM_NOTIFY (WM_APP+100) +#define IDC_MYICON 1006 +extern HINSTANCE g_hinst; +LRESULT IconDrawItem(LPDRAWITEMSTRUCT lpdi); +//--------------------------------------------------------------------------- +class TForm1 : public TForm +{ +__published: // IDE-managed Components + TStatusBar *StatusLine; + TPanel *Panel1; + TImage *Image1; + TLabel *Label1; + TLabel *Label2; + TLabel *Label3; + TLabel *Label8; + TImage *Image3; + TImage *Image2; + TPageControl *PageControl1; + TTabSheet *TabSheet1; + TSpeedButton *SpeedButton1; + TGroupBox *GroupBox1; + TLabel *Label4; + TLabel *Label5; + TLabel *Label6; + TLabel *Label14; + TLabel *Label17; + TEdit *Localhost; + TEdit *Localuser; + TEdit *OS; + TMemo *Memo2; + TEdit *Edit2; + TGroupBox *GroupBox2; + TMemo *Memo3; + TGroupBox *GroupBox3; + TLabel *Label13; + TLabel *Label15; + TLabel *Label16; + TLabel *Label7; + TLabel *Label47; + TLabel *Label44; + TLabel *Label42; + TLabel *Label45; + TEdit *Edit3; + TEdit *Edit4; + TEdit *Edit5; + TEdit *Edit6; + TEdit *st29; + TEdit *st27; + TEdit *st25; + TEdit *st28; + TTabSheet *TabSheet2; + TTabSheet *TabSheet3; + TLabel *Label18; + TSpeedButton *SpeedButton2; + TEdit *BaseDir; + TMemo *Memo1; + TRadioGroup *RadioGroup1; + TRadioButton *ShareVer; + TRadioButton *MysqldVer; + TRadioButton *OptVer; + TRadioButton *NtVer; + TButton *Button2; + TButton *Button3; + TButton *Button1; + TTabSheet *TabSheet4; + TMemo *Memo4; + TButton *Button5; + TTabSheet *TabSheet5; + TStringGrid *StringGrid1; + TButton *Button11; + TTabSheet *TabSheet6; + TStringGrid *StringGrid2; + TButton *Button10; + TPopupMenu *PopupMenu1; + TMenuItem *Showme1; + TMenuItem *N1; + TMenuItem *Win9; + TMenuItem *Swin9; + TMenuItem *N3; + TMenuItem *SSW9; + TMenuItem *N4; + TMenuItem *ShutDownBoth1; + TMenuItem *N2; + TMenuItem *WinNT; + TMenuItem *ShutDownthisTool1; + TMenuItem *N5; + TMenuItem *StopS; + TMenuItem *N6; + TMenuItem *RService; + TMenuItem *N7; + TMenuItem *Standa; + TImageList *ImageList1; + TTimer *Timer1; + TTimer *Timer2; + TTimer *Timer3; + TSpeedButton *SpeedButton3; + TSpeedButton *Extended; + TLabel *Label9; + TEdit *st26; + TLabel *Label43; + TEdit *st24; + TLabel *Label41; + TEdit *st23; + TLabel *Label40; + TEdit *st22; + TLabel *Label39; + TTabSheet *TabSheet8; + TSaveDialog *SaveFileDialog; + TPrinterSetupDialog *PrinterSetupDialog1; + TPrintDialog *PrintDialog1; + TRichEdit *Memo5; + TGroupBox *GroupBox5; + TSpeedButton *SpeedButton4; + TSpeedButton *SpeedButton5; + TSpeedButton *SpeedButton7; + TSpeedButton *SpeedButton6; + TGroupBox *GroupBox6; + TSpeedButton *SpeedButton8; + TSpeedButton *SpeedButton9; + TSpeedButton *SpeedButton10; + TSpeedButton *SpeedButton11; + TSpeedButton *SpeedButton12; + TTabSheet *TabSheet9; + TImageList *ImageList2; + TPopupMenu *PopupMenu2; + TMenuItem *CreateDatabaseS; + TMenuItem *DeleteDatabaseS; + TMenuItem *RefreshS; + TMenuItem *N8; + TMenuItem *N9; + TMenuItem *N10; + TGroupBox *GroupBox7; + TTreeView *DBView; + TGroupBox *GroupBox8; + TTreeView *TableView; + TGroupBox *GroupBox9; + TStringGrid *StringGrid4; + TMenuItem *FlushHosts1; + TMenuItem *N11; + TMenuItem *FlushLogs1; + TMenuItem *N12; + TMenuItem *FlushTables1; + TGroupBox *GroupBox10; + TStringGrid *StringGrid3; + TImage *Image5; + TStringGrid *StringGrid5; + TSpeedButton *SpeedButton13; + TPopupMenu *PopupMenu4; + TMenuItem *KillProcess1; + TMenuItem *N13; + TMenuItem *FlushThreads1; + void __fastcall FormCreate(TObject *Sender); + void __fastcall Showme1Click(TObject *Sender); + void __fastcall Timer1Timer(TObject *Sender); + void __fastcall SpeedButton1Click(TObject *Sender); + void __fastcall Timer2Timer(TObject *Sender); + void __fastcall Swin9Click(TObject *Sender); + void __fastcall SSW9Click(TObject *Sender); + void __fastcall ShutDownBoth1Click(TObject *Sender); + void __fastcall ShutDownthisTool1Click(TObject *Sender); + void __fastcall StopSClick(TObject *Sender); + void __fastcall RServiceClick(TObject *Sender); + void __fastcall StandaClick(TObject *Sender); + void __fastcall Button5Click(TObject *Sender); + void __fastcall Timer3Timer(TObject *Sender); + void __fastcall Button11Click(TObject *Sender); + void __fastcall Button10Click(TObject *Sender); + void __fastcall Button6Click(TObject *Sender); + void __fastcall Button7Click(TObject *Sender); + void __fastcall Button8Click(TObject *Sender); + + void __fastcall Button2Click(TObject *Sender); + void __fastcall Button3Click(TObject *Sender); + void __fastcall Button1Click(TObject *Sender); + void __fastcall SpeedButton2Click(TObject *Sender); + void __fastcall Button4Click(TObject *Sender); + void __fastcall SpeedButton3Click(TObject *Sender); + void __fastcall ExtendedClick(TObject *Sender); + void __fastcall SpeedButton4Click(TObject *Sender); + void __fastcall SpeedButton5Click(TObject *Sender); + void __fastcall SpeedButton6Click(TObject *Sender); + void __fastcall SpeedButton7Click(TObject *Sender); + void __fastcall SpeedButton8Click(TObject *Sender); + void __fastcall SpeedButton9Click(TObject *Sender); + void __fastcall SpeedButton10Click(TObject *Sender); + void __fastcall SpeedButton11Click(TObject *Sender); + void __fastcall SpeedButton12Click(TObject *Sender); + void __fastcall DeleteDatabaseSClick(TObject *Sender); + void __fastcall DBViewClick(TObject *Sender); + void __fastcall TableViewClick(TObject *Sender); + void __fastcall TableViewChange(TObject *Sender, TTreeNode *Node); + void __fastcall DBViewChange(TObject *Sender, TTreeNode *Node); + + void __fastcall RefreshSClick(TObject *Sender); + void __fastcall CreateDatabaseSClick(TObject *Sender); + void __fastcall FlushHosts1Click(TObject *Sender); + void __fastcall FlushLogs1Click(TObject *Sender); + void __fastcall FlushTables1Click(TObject *Sender); + void __fastcall SpeedButton13Click(TObject *Sender); + void __fastcall KillProcess1Click(TObject *Sender); + void __fastcall FlushThreads1Click(TObject *Sender); + + + + + + + +private: // User declarations + void __fastcall DrawItem(TMessage& Msg); + void __fastcall MyNotify(TMessage& Msg); + bool __fastcall TrayMessage(DWORD dwMessage); + HANDLE __fastcall IconHandle(void); + void __fastcall ToggleState(void); + PSTR __fastcall TipText(void); + void __fastcall WMQueryEndSession(TWMQueryEndSession &msg); + AnsiString __fastcall TheComputer(); + AnsiString __fastcall TheUser(); + AnsiString __fastcall TheOS(); + void __fastcall TakeIP(void); + void __fastcall GetmemStatus(void); + void __fastcall ShowHelp(void); + void __fastcall ContinueLoad(void); + void __fastcall MyODBC(void); + void __fastcall IsMyIniUp(void); + void __fastcall QuickSearch(void); + AnsiString __fastcall TheWinDir(); + void __fastcall FillMyIni(void); + void __fastcall GetBaseDir(void); + bool __fastcall MySQLSignal(); + bool __fastcall mysqldstart(); + bool __fastcall SeekErrFile(); + AnsiString __fastcall TheDir(); + bool __fastcall TheServiceStart(); + bool __fastcall TheServicePause(); + bool __fastcall TheServiceResume(); + bool __fastcall TheServiceStatus(); + bool __fastcall TheServiceCreate(); + bool __fastcall TheServiceRemove(); + bool __fastcall Shutd(); + void __fastcall ClearBox(void); + bool __fastcall TheServerPath(); + void __fastcall GetServerOptions(void); + void __fastcall GetReportServer(void); + + + TFileStream *MyFile; + String FName; + + void __fastcall IsMySQLInit(void); + void __fastcall GetServerStatus(void); + bool __fastcall GetExtendedStatus(); + bool __fastcall GetProcess(); + bool __fastcall GetVariables(); + bool __fastcall nice_time(AnsiString buff); + String __fastcall GetString(String k); + String __fastcall GetNumberServer(); + // pointers for database screen + TTreeNode *MySQLNode, *MySQLDbs, *MySQLNodeT, *MySQLTbs; + + bool __fastcall GetMainRoot(); + bool __fastcall IsDatabase(String Name); + bool __fastcall IsTable(String Name); + void __fastcall CleanTree(void); + void __fastcall CleanGrid(void); + bool __fastcall IsIndex(String Name); + void __fastcall CleanGridI(void); + bool __fastcall KillPID(); + + + +public: // User declarations + __fastcall TForm1(TComponent* Owner); + void __fastcall GetServerFile(void); + void __fastcall CreateMyIniFile(void); + bool __fastcall CreatingShortCut(); + bool __fastcall CreatingDB(); + void __fastcall OutRefresh(void); + bool __fastcall CreatingTable(String TheTable); + + bool IsConnect ; + + + + STARTUPINFO si; + PROCESS_INFORMATION pi; + BEGIN_MESSAGE_MAP + MESSAGE_HANDLER(WM_DRAWITEM,TMessage,DrawItem) + MESSAGE_HANDLER(MYWM_NOTIFY,TMessage,MyNotify) + MESSAGE_HANDLER(WM_QUERYENDSESSION,TWMQueryEndSession,WMQueryEndSession) + END_MESSAGE_MAP(TForm) +}; +//--------------------------------------------------------------------------- +extern PACKAGE TForm1 *Form1; +//--------------------------------------------------------------------------- +#endif diff --git a/VC++Files/winmysqladmin/mysql.h b/VC++Files/winmysqladmin/mysql.h new file mode 100644 index 00000000000..e83babb8fa8 --- /dev/null +++ b/VC++Files/winmysqladmin/mysql.h @@ -0,0 +1,293 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* defines for the libmysql library */ + +#ifndef _mysql_h +#define _mysql_h + +#ifndef MYSQL_SERVER +#ifdef __cplusplus +extern "C" { +#endif +#endif + +#ifndef _global_h /* If not standard header */ +#include +typedef char my_bool; +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) +#define __WIN__ +#endif +#if !defined(__WIN__) +#define STDCALL +#else +#define STDCALL __stdcall +#endif +typedef char * gptr; + +#ifndef ST_USED_MEM_DEFINED +#define ST_USED_MEM_DEFINED +typedef struct st_used_mem { /* struct for once_alloc */ + struct st_used_mem *next; /* Next block in use */ + unsigned int left; /* memory left in block */ + unsigned int size; /* size of block */ +} USED_MEM; +typedef struct st_mem_root { + USED_MEM *free; + USED_MEM *used; + unsigned int min_malloc; + unsigned int block_size; + void (*error_handler)(void); +} MEM_ROOT; +#endif + +#ifndef my_socket_defined +#ifdef __WIN__ +#define my_socket SOCKET +#else +typedef int my_socket; +#endif +#endif +#endif +#include "mysql_com.h" +#include "mysql_version.h" + +extern unsigned int mysql_port; +extern char *mysql_unix_port; + +#define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) +#define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) +#define IS_BLOB(n) ((n) & BLOB_FLAG) +#define IS_NUM(t) ((t) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR) + +typedef struct st_mysql_field { + char *name; /* Name of column */ + char *table; /* Table of column if column was a field */ + char *def; /* Default value (set by mysql_list_fields) */ + enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ + unsigned int length; /* Width of column */ + unsigned int max_length; /* Max width of selected set */ + unsigned int flags; /* Div flags */ + unsigned int decimals; /* Number of decimals in field */ +} MYSQL_FIELD; + +typedef char **MYSQL_ROW; /* return data as array of strings */ +typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ + +#if defined(NO_CLIENT_LONG_LONG) +typedef unsigned long my_ulonglong; +#elif defined (__WIN__) +typedef unsigned __int64 my_ulonglong; +#else +typedef unsigned long long my_ulonglong; +#endif + +#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) + +typedef struct st_mysql_rows { + struct st_mysql_rows *next; /* list of rows */ + MYSQL_ROW data; +} MYSQL_ROWS; + +typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ + +typedef struct st_mysql_data { + my_ulonglong rows; + unsigned int fields; + MYSQL_ROWS *data; + MEM_ROOT alloc; +} MYSQL_DATA; + +struct st_mysql_options { + unsigned int connect_timeout,client_flag; + my_bool compress,named_pipe; + unsigned int port; + char *host,*init_command,*user,*password,*unix_socket,*db; + char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; + my_bool use_ssl; /* if to use SSL or not */ + char *ssl_key; /* PEM key file */ + char *ssl_cert; /* PEM cert file */ + char *ssl_ca; /* PEM CA file */ + char *ssl_capath; /* PEM directory of CA-s? */ +}; + +enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, + MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, + MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, + MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME}; + +enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT, + MYSQL_STATUS_USE_RESULT}; + +typedef struct st_mysql { + NET net; /* Communication parameters */ + gptr connector_fd; /* ConnectorFd for SSL */ + char *host,*user,*passwd,*unix_socket,*server_version,*host_info, + *info,*db; + unsigned int port,client_flag,server_capabilities; + unsigned int protocol_version; + unsigned int field_count; + unsigned int server_status; + unsigned long thread_id; /* Id for connection in server */ + my_ulonglong affected_rows; + my_ulonglong insert_id; /* id if insert on table with NEXTNR */ + my_ulonglong extra_info; /* Used by mysqlshow */ + unsigned long packet_length; + enum mysql_status status; + MYSQL_FIELD *fields; + MEM_ROOT field_alloc; + my_bool free_me; /* If free in mysql_close */ + my_bool reconnect; /* set to 1 if automatic reconnect */ + struct st_mysql_options options; + char scramble_buff[9]; + struct charset_info_st *charset; + unsigned int server_language; +} MYSQL; + + +typedef struct st_mysql_res { + my_ulonglong row_count; + unsigned int field_count, current_field; + MYSQL_FIELD *fields; + MYSQL_DATA *data; + MYSQL_ROWS *data_cursor; + MEM_ROOT field_alloc; + MYSQL_ROW row; /* If unbuffered read */ + MYSQL_ROW current_row; /* buffer to current row */ + unsigned long *lengths; /* column lengths of current row */ + MYSQL *handle; /* for unbuffered reads */ + my_bool eof; /* Used my mysql_fetch_row */ +} MYSQL_RES; + +/* Functions to get information from the MYSQL and MYSQL_RES structures */ +/* Should definitely be used if one uses shared libraries */ + +my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); +unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); +my_bool STDCALL mysql_eof(MYSQL_RES *res); +MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, + unsigned int fieldnr); +MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); +MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res); +unsigned int STDCALL mysql_field_tell(MYSQL_RES *res); + +unsigned int STDCALL mysql_field_count(MYSQL *mysql); +my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); +my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); +unsigned int STDCALL mysql_errno(MYSQL *mysql); +char * STDCALL mysql_error(MYSQL *mysql); +char * STDCALL mysql_info(MYSQL *mysql); +unsigned long STDCALL mysql_thread_id(MYSQL *mysql); +const char * STDCALL mysql_character_set_name(MYSQL *mysql); + +MYSQL * STDCALL mysql_init(MYSQL *mysql); +#ifdef HAVE_OPENSSL +int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, + const char *cert, const char *ca, + const char *capath); +char * STDCALL mysql_ssl_cipher(MYSQL *mysql); +int STDCALL mysql_ssl_clear(MYSQL *mysql); +#endif /* HAVE_OPENSSL */ +MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, + const char *user, const char *passwd); +my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, + const char *passwd, const char *db); +#if MYSQL_VERSION_ID >= 32200 +MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, + const char *user, + const char *passwd, + const char *db, + unsigned int port, + const char *unix_socket, + unsigned int clientflag); +#else +MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, + const char *user, + const char *passwd, + unsigned int port, + const char *unix_socket, + unsigned int clientflag); +#endif +void STDCALL mysql_close(MYSQL *sock); +int STDCALL mysql_select_db(MYSQL *mysql, const char *db); +int STDCALL mysql_query(MYSQL *mysql, const char *q); +int STDCALL mysql_real_query(MYSQL *mysql, const char *q, + unsigned int length); +int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); +int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); +int STDCALL mysql_shutdown(MYSQL *mysql); +int STDCALL mysql_dump_debug_info(MYSQL *mysql); +int STDCALL mysql_refresh(MYSQL *mysql, + unsigned int refresh_options); +int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid); +int STDCALL mysql_ping(MYSQL *mysql); +char * STDCALL mysql_stat(MYSQL *mysql); +char * STDCALL mysql_get_server_info(MYSQL *mysql); +char * STDCALL mysql_get_client_info(void); +char * STDCALL mysql_get_host_info(MYSQL *mysql); +unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild); +MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); +MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, + const char *wild); +MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); +MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); +int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, + const char *arg); +void STDCALL mysql_free_result(MYSQL_RES *result); +void STDCALL mysql_data_seek(MYSQL_RES *result, + my_ulonglong offset); +MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET); +MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, + MYSQL_FIELD_OFFSET offset); +MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); +unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); +MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); +unsigned long STDCALL mysql_escape_string(char *to,const char *from, + unsigned long from_length); +unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, + char *to,const char *from, + unsigned long length); +void STDCALL mysql_debug(const char *debug); +char * STDCALL mysql_odbc_escape_string(MYSQL *mysql, + char *to, + unsigned long to_length, + const char *from, + unsigned long from_length, + void *param, + char * + (*extend_buffer) + (void *, char *to, + unsigned long *length)); +void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); +unsigned int STDCALL mysql_thread_safe(void); + + +#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) + +/* new api functions */ + +#define HAVE_MYSQL_REAL_CONNECT + +#ifndef MYSQL_SERVER +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/VC++Files/winmysqladmin/mysql_com.h b/VC++Files/winmysqladmin/mysql_com.h new file mode 100644 index 00000000000..2a1471f735d --- /dev/null +++ b/VC++Files/winmysqladmin/mysql_com.h @@ -0,0 +1,242 @@ +/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA */ + +/* +** Common definition between mysql server & client +*/ + +#ifndef _mysql_com_h +#define _mysql_com_h + + +#define NAME_LEN 64 /* Field/table name length */ +#define HOSTNAME_LENGTH 60 +#define USERNAME_LENGTH 16 + +#define LOCAL_HOST "localhost" +#define LOCAL_HOST_NAMEDPIPE "." + +#if defined(__EMX__) || defined(__OS2__) +#undef MYSQL_UNIX_ADDR +#define MYSQL_OS2_ADDR "\\socket\\MySQL" +#define MYSQL_UNIX_ADDR MYSQL_OS2_ADDR +#endif +#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) +#define MYSQL_NAMEDPIPE "MySQL" +#define MYSQL_SERVICENAME "MySql" +#endif /* __WIN__ */ + +enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY, + COM_FIELD_LIST,COM_CREATE_DB,COM_DROP_DB,COM_REFRESH, + COM_SHUTDOWN,COM_STATISTICS, + COM_PROCESS_INFO,COM_CONNECT,COM_PROCESS_KILL, + COM_DEBUG,COM_PING,COM_TIME,COM_DELAYED_INSERT, + COM_CHANGE_USER, COM_BINLOG_DUMP, + COM_TABLE_DUMP}; + +#define NOT_NULL_FLAG 1 /* Field can't be NULL */ +#define PRI_KEY_FLAG 2 /* Field is part of a primary key */ +#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ +#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ +#define BLOB_FLAG 16 /* Field is a blob */ +#define UNSIGNED_FLAG 32 /* Field is unsigned */ +#define ZEROFILL_FLAG 64 /* Field is zerofill */ +#define BINARY_FLAG 128 +/* The following are only sent to new clients */ +#define ENUM_FLAG 256 /* field is an enum */ +#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ +#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ +#define SET_FLAG 2048 /* field is a set */ +#define PART_KEY_FLAG 16384 /* Intern; Part of some key */ +#define GROUP_FLAG 32768 /* Intern: Group field */ +#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */ + +#define REFRESH_GRANT 1 /* Refresh grant tables */ +#define REFRESH_LOG 2 /* Start on new log file */ +#define REFRESH_TABLES 4 /* close all tables */ +#define REFRESH_HOSTS 8 /* Flush host cache */ +#define REFRESH_STATUS 16 /* Flush status variables */ +#define REFRESH_THREADS 32 /* Flush status variables */ +#define REFRESH_SLAVE 64 /* Reset master info and restart slave + thread */ +#define REFRESH_MASTER 128 /* Remove all bin logs in the index + and truncate the index */ + +/* The following can't be set with mysql_refresh() */ +#define REFRESH_READ_LOCK 16384 /* Lock tables for read */ +#define REFRESH_FAST 32768 /* Intern flag */ + +#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ +#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ +#define CLIENT_LONG_FLAG 4 /* Get all column flags */ +#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ +#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ +#define CLIENT_COMPRESS 32 /* Can use compression protocol */ +#define CLIENT_ODBC 64 /* Odbc client */ +#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ +#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ +#define CLIENT_CHANGE_USER 512 /* Support the mysql_change_user() */ +#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ +#define CLIENT_SSL 2048 /* Switch to SSL after handshake */ +#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ +#define CLIENT_TRANSACTIONS 8196 /* Client knows about transactions */ + +#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ +#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ + +#define MYSQL_ERRMSG_SIZE 200 +#define NET_READ_TIMEOUT 30 /* Timeout on read */ +#define NET_WRITE_TIMEOUT 60 /* Timeout on write */ +#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ + +#ifndef Vio_defined +#define Vio_defined +#ifdef HAVE_VIO +class Vio; /* Fill Vio class in C++ */ +#else +struct st_vio; /* Only C */ +typedef struct st_vio Vio; +#endif +#endif + +typedef struct st_net { + Vio* vio; + my_socket fd; /* For Perl DBI/dbd */ + int fcntl; + unsigned char *buff,*buff_end,*write_pos,*read_pos; + char last_error[MYSQL_ERRMSG_SIZE]; + unsigned int last_errno,max_packet,timeout,pkt_nr; + unsigned char error; + my_bool return_errno,compress; + my_bool no_send_ok; /* needed if we are doing several + queries in one command ( as in LOAD TABLE ... FROM MASTER ), + and do not want to confuse the client with OK at the wrong time + */ + unsigned long remain_in_buf,length, buf_length, where_b; + unsigned int *return_status; + unsigned char reading_or_writing; + char save_char; +} NET; + +#define packet_error ((unsigned int) -1) + +enum enum_field_types { FIELD_TYPE_DECIMAL, FIELD_TYPE_TINY, + FIELD_TYPE_SHORT, FIELD_TYPE_LONG, + FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE, + FIELD_TYPE_NULL, FIELD_TYPE_TIMESTAMP, + FIELD_TYPE_LONGLONG,FIELD_TYPE_INT24, + FIELD_TYPE_DATE, FIELD_TYPE_TIME, + FIELD_TYPE_DATETIME, FIELD_TYPE_YEAR, + FIELD_TYPE_NEWDATE, + FIELD_TYPE_ENUM=247, + FIELD_TYPE_SET=248, + FIELD_TYPE_TINY_BLOB=249, + FIELD_TYPE_MEDIUM_BLOB=250, + FIELD_TYPE_LONG_BLOB=251, + FIELD_TYPE_BLOB=252, + FIELD_TYPE_VAR_STRING=253, + FIELD_TYPE_STRING=254 +}; + +#define FIELD_TYPE_CHAR FIELD_TYPE_TINY /* For compability */ +#define FIELD_TYPE_INTERVAL FIELD_TYPE_ENUM /* For compability */ + +extern unsigned long max_allowed_packet; +extern unsigned long net_buffer_length; + +#define net_new_transaction(net) ((net)->pkt_nr=0) + +int my_net_init(NET *net, Vio* vio); +void net_end(NET *net); +void net_clear(NET *net); +int net_flush(NET *net); +int my_net_write(NET *net,const char *packet,unsigned long len); +int net_write_command(NET *net,unsigned char command,const char *packet, + unsigned long len); +int net_real_write(NET *net,const char *packet,unsigned long len); +unsigned int my_net_read(NET *net); + +struct rand_struct { + unsigned long seed1,seed2,max_value; + double max_value_dbl; +}; + + /* The following is for user defined functions */ + +enum Item_result {STRING_RESULT,REAL_RESULT,INT_RESULT}; + +typedef struct st_udf_args +{ + unsigned int arg_count; /* Number of arguments */ + enum Item_result *arg_type; /* Pointer to item_results */ + char **args; /* Pointer to argument */ + unsigned long *lengths; /* Length of string arguments */ + char *maybe_null; /* Set to 1 for all maybe_null args */ +} UDF_ARGS; + + /* This holds information about the result */ + +typedef struct st_udf_init +{ + my_bool maybe_null; /* 1 if function can return NULL */ + unsigned int decimals; /* for real functions */ + unsigned int max_length; /* For string functions */ + char *ptr; /* free pointer for function data */ + my_bool const_item; /* 0 if result is independent of arguments */ +} UDF_INIT; + + /* Constants when using compression */ +#define NET_HEADER_SIZE 4 /* standard header size */ +#define COMP_HEADER_SIZE 3 /* compression header extra size */ + + /* Prototypes to password functions */ + +#ifdef __cplusplus +extern "C" { +#endif + +void randominit(struct rand_struct *,unsigned long seed1, + unsigned long seed2); +double rnd(struct rand_struct *); +void make_scrambled_password(char *to,const char *password); +void get_salt_from_password(unsigned long *res,const char *password); +void make_password_from_salt(char *to, unsigned long *hash_res); +char *scramble(char *to,const char *message,const char *password, + my_bool old_ver); +my_bool check_scramble(const char *, const char *message, + unsigned long *salt,my_bool old_ver); +char *get_tty_password(char *opt_message); +void hash_password(unsigned long *result, const char *password); +#ifdef __cplusplus +} +#endif + +/* Some other useful functions */ + +void my_init(void); +void load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv); + +#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ + +#ifdef __WIN__ +#define socket_errno WSAGetLastError() +#else +#define socket_errno errno +#endif + +#endif diff --git a/VC++Files/winmysqladmin/mysql_version.h b/VC++Files/winmysqladmin/mysql_version.h new file mode 100644 index 00000000000..1f868704fe8 --- /dev/null +++ b/VC++Files/winmysqladmin/mysql_version.h @@ -0,0 +1,20 @@ +/* Copyright Abandoned 1996,1999 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ + +/* Version numbers for protocol & mysqld */ + +#ifdef _CUSTOMCONFIG_ + #include +#else +#define PROTOCOL_VERSION 10 +#define MYSQL_SERVER_VERSION "3.23.22-beta" +#define FRM_VER 6 +#define MYSQL_VERSION_ID 32322 +#define MYSQL_PORT 3306 +#define MYSQL_UNIX_ADDR "/tmp/mysql.sock" + +/* mysqld compile time options */ +#ifndef MYSQL_CHARSET +#define MYSQL_CHARSET "latin1" +#endif +#endif diff --git a/VC++Files/winmysqladmin/winmysqladmin.cpp b/VC++Files/winmysqladmin/winmysqladmin.cpp new file mode 100644 index 00000000000..591b7518fa3 --- /dev/null +++ b/VC++Files/winmysqladmin/winmysqladmin.cpp @@ -0,0 +1,38 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +HINSTANCE g_hinst; +USERES("winmysqladmin.res"); +USEFORM("main.cpp", Form1); +USEFORM("initsetup.cpp", Form2); +USEFORM("db.cpp", dbfrm); +USELIB("lib\mysqlclient.lib"); +USELIB("lib\myisammrg.lib"); +USELIB("lib\heap.lib"); +USELIB("lib\isam.lib"); +USELIB("lib\merge.lib"); +USELIB("lib\myisam.lib"); +USELIB("lib\mysys.lib"); +USELIB("lib\regex.lib"); +USELIB("lib\strings.lib"); +USELIB("lib\zlib.lib"); +//--------------------------------------------------------------------------- +WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) +{ + try + { + Application->Initialize(); + Application->HelpFile = "C:\\mysql\\bin\\WINMYSQLADMIN.HLP"; + Application->Title = "WinMySQLadmin 1.0"; + Application->CreateForm(__classid(TForm1), &Form1); + Application->CreateForm(__classid(TForm2), &Form2); + Application->CreateForm(__classid(Tdbfrm), &dbfrm); + Application->Run(); + } + catch (Exception &exception) + { + Application->ShowException(&exception); + } + return 0; +} +//--------------------------------------------------------------------------- diff --git a/VC++Files/zlib/zlib.dsp b/VC++Files/zlib/zlib.dsp index 5a596b41f32..b46afad005c 100644 --- a/VC++Files/zlib/zlib.dsp +++ b/VC++Files/zlib/zlib.dsp @@ -65,8 +65,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /ZI /Od /D "_DEBUG" /D "__WIN32__" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /G6 /MTd /W3 /Zi /Od /D "_DEBUG" /D "__WIN32__" /D "_WINDOWS" /FD /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 BSC32=bscmake.exe -- cgit v1.2.1