Changeset 129

Show
Ignore:
Timestamp:
11/18/09 04:40:30 (3 years ago)
Author:
mercyful
Message:

$ Build 438/Sql Alpha
+ Removed all SQLite Code and References.
+ Updated the SQL Wrapper, and all Automake files to now link in and also Detect MySql? in the configure scripts.
+ Added detection for OpenSSL, not in use yet, but will add encryption for passwords.

and anything else of intertest once everything is moved over to the SQL Backend.

This is still an interm develop update release, the MySql? backend
is still a WIP, and the Husky SMAPI Library will be removed shortly.

Location:
trunk
Files:
4 added
19 modified

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r128 r129  
     1 
     2/=/==================================================================================================== 
     3$ Fixes and updates since Build 438/Sql Alpha 
     4$ Build 438/Sql Alpha 
     5+ Removed all SQLite Code and References. 
     6+ Updated the SQL Wrapper, and all Automake files to now link in and also Detect MySql in the 
     7  configure scripts. 
     8+ Added detection for OpenSSL, not in use yet, but will add encryption for passwords. 
     9  and anything else of intertest once everything is moved over to the SQL Backend. 
     10 
     11This is still an interm develop update release, the MySql backend is still a WIP, and Husky SMAPI 
     12will be removed shortly. 
    113/=/==================================================================================================== 
    214$ Fixes and updates since Build 437/SQlite Alpha 
  • trunk/INSTALL

    r92 r129  
    22================== 
    33 
    4    These are generic installation instructions. 
     4You can run the install.pl script to install and compile the source in your current 
     5Directoy. 
    56 
    6    The `configure' shell script attempts to guess correct values for 
    7 various system-dependent variables used during compilation.  It uses 
    8 those values to create a `Makefile' in each directory of the package. 
    9 It may also create one or more `.h' files containing system-dependent 
    10 definitions.  Finally, it creates a shell script `config.status' that 
    11 you can run in the future to recreate the current configuration, a file 
    12 `config.cache' that saves the results of its tests to speed up 
    13 reconfiguring, and a file `config.log' containing compiler output 
    14 (useful mainly for debugging `configure'). 
     7Or you can manally run. 
    158 
    16    If you need to do unusual things to compile the package, please try 
    17 to figure out how `configure' could check whether to do them, and mail 
    18 diffs or instructions to the address given in the `README' so they can 
    19 be considered for the next release.  If at some point `config.cache' 
    20 contains results you don't want to keep, you may remove or edit it. 
     9$ ./autogen.sh       (detects OS and Platform and generates configure script) 
     10$ ./configure        (run the configure script to setup make files) 
     11$ gmake              (gmake or make is fine) 
    2112 
    22    The file `configure.in' is used to create `configure' by a program 
    23 called `autoconf'.  You only need `configure.in' if you want to change 
    24 it or regenerate `configure' using a newer version of `autoconf'. 
     13Some dependencies exists, you should have Autotools installed beore running either method. 
     14Some distro's don't have much installed, so you should check and verify the follow are 
     15installed before trying to compile. 
    2516 
    26 The simplest way to compile this package is: 
     17g++ compiler        (c++ compiler) 
     18libc                (standard library for c/c++) 
     19sed                 (needed for scripts) 
     20wget                (downloads programs from the web) 
     21automake            (Development tools for ccompiling source code) 
     22libtools            (Used with automake to detect compiling settings) 
     23Husky SMAPI Lib,    (Install.pl will download and attempt to compile it) 
     24xinetd / telnetd    (Used for Answering and Handeling Telnet Connections) 
     25mysql Database/Libs (New - Now Required, still WIP) 
    2726 
    28   1. `cd' to the directory containing the package's source code and type 
    29      `./configure' to configure the package for your system.  If you're 
    30      using `csh' on an old version of System V, you might need to type 
    31      `sh ./configure' instead to prevent `csh' from trying to execute 
    32      `configure' itself. 
     27python              (optional) 
     28perl                (optional) 
     29OpenSSL             (Optional) 
    3330 
    34      Running `configure' takes a while.  While running, it prints some 
    35      messages telling which features it is checking for. 
    3631 
    37   2. Type `make' to compile the package. 
     32I believe i have everything here, although it's easy to miss something accross different 
     33linux/bsd/osx distro's.  If i have, please let me know so we can keep track and make 
     34getting everything setup easier on everyone. 
    3835 
    39   3. Type `make install' to install the programs and any data files and 
    40      documentation. 
    41  
    42   4. You can remove the program binaries and object files from the 
    43      source code directory by typing `make clean'.   
    44  
    45 Compilers and Options 
    46 ===================== 
    47  
    48    Some systems require unusual options for compilation or linking that 
    49 the `configure' script does not know about.  You can give `configure' 
    50 initial values for variables by setting them in the environment.  Using 
    51 a Bourne-compatible shell, you can do that on the command line like 
    52 this: 
    53      CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure 
    54  
    55 Or on systems that have the `env' program, you can do it like this: 
    56      env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure 
    57  
    58 Compiling For Multiple Architectures 
    59 ==================================== 
    60  
    61    You can compile the package for more than one kind of computer at the 
    62 same time, by placing the object files for each architecture in their 
    63 own directory.  To do this, you must use a version of `make' that 
    64 supports the `VPATH' variable, such as GNU `make'.  `cd' to the 
    65 directory where you want the object files and executables to go and run 
    66 the `configure' script.  `configure' automatically checks for the 
    67 source code in the directory that `configure' is in and in `..'. 
    68  
    69    If you have to use a `make' that does not supports the `VPATH' 
    70 variable, you have to compile the package for one architecture at a time 
    71 in the source code directory.  After you have installed the package for 
    72 one architecture, use `make distclean' before reconfiguring for another 
    73 architecture. 
    74  
    75 Installation Names 
    76 ================== 
    77  
    78    By default, `make install' will install the package's files in 
    79 `/usr/local/bin', `/usr/local/man', etc.  You can specify an 
    80 installation prefix other than `/usr/local' by giving `configure' the 
    81 option `--prefix=PATH'. 
    82  
    83    You can specify separate installation prefixes for 
    84 architecture-specific files and architecture-independent files.  If you 
    85 give `configure' the option `--exec-prefix=PATH', the package will use 
    86 PATH as the prefix for installing programs and libraries. 
    87 Documentation and other data files will still use the regular prefix. 
    88  
    89    If the package supports it, you can cause programs to be installed 
    90 with an extra prefix or suffix on their names by giving `configure' the 
    91 option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 
    92  
    93 Optional Features 
    94 ================= 
    95  
    96    Some packages pay attention to `--enable-FEATURE' options to 
    97 `configure', where FEATURE indicates an optional part of the package. 
    98 They may also pay attention to `--with-PACKAGE' options, where PACKAGE 
    99 is something like `gnu-as' or `x' (for the X Window System).  The 
    100 `README' should mention any `--enable-' and `--with-' options that the 
    101 package recognizes. 
    102  
    103    For packages that use the X Window System, `configure' can usually 
    104 find the X include and library files automatically, but if it doesn't, 
    105 you can use the `configure' options `--x-includes=DIR' and 
    106 `--x-libraries=DIR' to specify their locations. 
    107  
    108 Specifying the System Type 
    109 ========================== 
    110  
    111    There may be some features `configure' can not figure out 
    112 automatically, but needs to determine by the type of host the package 
    113 will run on.  Usually `configure' can figure that out, but if it prints 
    114 a message saying it can not guess the host type, give it the 
    115 `--host=TYPE' option.  TYPE can either be a short name for the system 
    116 type, such as `sun4', or a canonical name with three fields: 
    117      CPU-COMPANY-SYSTEM 
    118  
    119 See the file `config.sub' for the possible values of each field.  If 
    120 `config.sub' isn't included in this package, then this package doesn't 
    121 need to know the host type. 
    122  
    123    If you are building compiler tools for cross-compiling, you can also 
    124 use the `--target=TYPE' option to select the type of system they will 
    125 produce code for and the `--build=TYPE' option to select the type of 
    126 system on which you are compiling the package. 
    127  
    128 Sharing Defaults 
    129 ================ 
    130  
    131    If you want to set default values for `configure' scripts to share, 
    132 you can create a site shell script called `config.site' that gives 
    133 default values for variables like `CC', `cache_file', and `prefix'. 
    134 `configure' looks for `PREFIX/share/config.site' if it exists, then 
    135 `PREFIX/etc/config.site' if it exists.  Or, you can set the 
    136 `CONFIG_SITE' environment variable to the location of the site script. 
    137 A warning: not all `configure' scripts look for a site script. 
    138  
    139 Operation Controls 
    140 ================== 
    141  
    142    `configure' recognizes the following options to control how it 
    143 operates. 
    144  
    145 `--cache-file=FILE' 
    146      Use and save the results of the tests in FILE instead of 
    147      `./config.cache'.  Set FILE to `/dev/null' to disable caching, for 
    148      debugging `configure'. 
    149  
    150 `--help' 
    151      Print a summary of the options to `configure', and exit. 
    152  
    153 `--quiet' 
    154 `--silent' 
    155 `-q' 
    156      Do not print messages saying which checks are being made. 
    157  
    158 `--srcdir=DIR' 
    159      Look for the package's source code in directory DIR.  Usually 
    160      `configure' can determine that directory automatically. 
    161  
    162 `--version' 
    163      Print the version of Autoconf used to generate the `configure' 
    164      script, and exit. 
    165  
    166 `configure' also accepts some other, not widely useful, options. 
    167  
  • trunk/README

    r128 r129  
    11/=/==================================================================================================== 
    22 
    3 Enthral BBS - 11/17/2009 Build 437/SQ Alpha. 
     3Enthral BBS - 11/18/2009 Build 438/SQ Alpha. 
    44 
    55Interm Release, This release or code sync is just to get the code in development up to date 
     
    1010Extra Release Notes. 
    1111############################################################## 
    12 Extra Release Notes, this temp version currently is linking SQLite, if you get any problems 
    13 compiling this source, make sure you have the sqlite3 lib, this will be removed soon though 
    14 as we've changed to MySQL. 
     12Extra Release Notes, this temp version currently is linking MySql, if you get any problems 
     13compiling this source, make sure you have the Mysql installed, the software is now moving 
     14away from the Husky SAMPI (JAM Message Format) to a MySql Database. 
    1515 
    1616 
     
    2323scripts that will update and compile your current Enthral install via 
    2424the svn. 
     25 
     26Basic Installation - PreREQ and small overview. 
     27================== 
     28 
     29You can run the install.pl script to install and compile the source in your current 
     30Directoy. 
     31 
     32Or you can manally run. 
     33 
     34$ ./autogen.sh       (detects OS and Platform and generates configure script) 
     35$ ./configure        (run the configure script to setup make files) 
     36$ gmake              (gmake or make is fine) 
     37 
     38Some dependencies exists, you should have Autotools installed beore running either method. 
     39Some distro's don't have much installed, so you should check and verify the follow are 
     40installed before trying to compile. 
     41 
     42g++ compiler        (c++ compiler) 
     43libc                (standard library for c/c++) 
     44sed                 (needed for scripts) 
     45wget                (downloads programs from the web) 
     46automake            (Development tools for ccompiling source code) 
     47libtools            (Used with automake to detect compiling settings) 
     48Husky SMAPI Lib,    (Install.pl will download and attempt to compile it) 
     49xinetd / telnetd    (Used for Answering and Handeling Telnet Connections) 
     50mysql Database/Libs (New - Now Required, still WIP) 
     51 
     52 
     53python              (optional) 
     54perl                (optional) 
     55OpenSSL             (Optional) 
     56 
     57I believe i have everything here, although it's easy to miss something accross different 
     58linux/bsd/osx distro's.  If i have, please let me know so we can keep track and make 
     59getting everything setup easier on everyone. 
     60 
     61MySQL instructions will be coming soon once it's more intergrated and used in the system. 
    2562 
    2663/=/==================================================================================================== 
     
    3572 
    3673You need to have perl installed on your system to use the install script. 
     74Along with the PreREQ's mentioned above. 
    3775 
    3876/=/==================================================================================================== 
     
    164202Netsurge, Esc, and even pook who have also setup the bbs for testing. 
    165203 
    166  
     204-=+[Team Enthral]+=- 
    167205Mike  -Mercyful Fate 
    168206Frank -Netsurge 
  • trunk/configure.in

    r117 r129  
    88AC_LANG_CPLUSPLUS 
    99AC_PROG_CXX 
     10 
     11AC_PROG_LIBTOOL 
     12AC_PROG_MAKE_SET 
     13AC_PROG_CC 
     14 
    1015 
    1116m4_pattern_allow([^AM_PROG_LIBTOOL$]) 
     
    2833AH_VERBATIM([USING_LINUX],[#undef USING_LINUX]) 
    2934AH_VERBATIM([OLD_PERL],[#undef OLD_PERL]) 
     35 
     36 
     37dnl ********************************************************************* 
     38dnl ** MYSql ************************************************************ 
     39dnl ********************************************************************* 
     40 
     41echo Detecting MySQL ... 
     42 
     43# mysql autodetected. 
     44 
     45# checking for mysql library. 
     46AC_CHECK_HEADER([mysql/mysql.h]) 
     47AC_PATH_PROG([mysql_config], [mysql_config]) 
     48 
     49# checking for mysql environment. 
     50if test "$ac_cv_header_mysql_mysql_h" = "yes" -a -n "$mysql_config"; then 
     51    MYSQL_CFLAGS="$(mysql_config --cflags)" 
     52    MYSQL_LDFLAGS="$(mysql_config --libs)" 
     53    AC_SUBST(MYSQL_CFLAGS) 
     54    AC_SUBST(MYSQL_LDFLAGS) 
     55 
     56    # define the mysql name and version. 
     57    AC_DEFINE_UNQUOTED(PLUGIN_NAME_MYSQL, "mysql", [Plugin name as Prefix.]) 
     58    AC_DEFINE_UNQUOTED(PLUGIN_VERSION_MYSQL, "$(mysql_config --version)", [Plugin version for MySQL.]) 
     59fi 
     60 
     61# define automake rule for compiling. 
     62AM_CONDITIONAL([HAVE_MYSQL], [test "$ac_cv_header_mysql_mysql_h" = "yes"]) 
     63 
     64 
     65# check if no database backends are available, that doesn't make sense for a sql plugin. :) 
     66if test -z "$ac_cv_header_mysql_mysql_h"; then 
     67    AC_MSG_ERROR([*** no database backend found, install development and library files]) 
     68fi 
    3069 
    3170 
     
    143182AM_CONDITIONAL(DO_PERL, test "x$perl" = "xyes") 
    144183 
    145 echo =[Python]======= 
     184echo =[OpenSSL Detection]==================== 
     185echo checking for OpenSSL for Encryption [Not Yet Implimented]. 
     186# Checking openssl library. 
     187AC_CHECK_HEADER([openssl/des.h], [], [AC_MSG_ERROR([*** des.h is required, install openssl header files])]) 
     188AC_CHECK_HEADER([openssl/evp.h], [], [AC_MSG_ERROR([*** evp.h is required, install openssl header files])]) 
     189AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_init], [], [AC_MSG_ERROR([*** EVP_CIPHER_CTX_init is required, install openssl library files])]) 
     190AC_CHECK_LIB([crypto], [EVP_MD_CTX_init], [], [AC_MSG_ERROR([*** EVP_MD_CTX_init is required, install openssl library files])]) 
     191AC_CHECK_LIB([crypto], [DES_crypt], [], [AC_MSG_ERROR([*** DES_crypt is required, install openssl library files])]) 
     192echo =[OpenSSL Detection]==================== 
     193echo 
     194echo =[Plugin Detection]===================== 
     195echo =[MySQL]================================ 
     196echo PLUGINS: MySQL: $ac_cv_header_mysql_mysql_h 
     197echo PLUGINS: MySQL: $MYSQL_CFLAGS 
     198echo PLUGINS: MySQL: $MYSQL_LDFLAGS 
     199echo 
     200echo =[Python]=============================== 
    146201echo PLUGINS: Python: $python 
    147202echo PLUGINS: Python: $PY_VER 
    148203echo PLUGINS: Python: $PY_LIB 
    149204echo PLUGINS: Python: $PY_INC 
    150 echo =[Perl - WIP]=== 
     205echo 
     206echo =[Perl]================================= 
    151207echo PLUGINS: Perl: $perl 
    152208echo PLUGINS: Perl: $PERL_CFLAGS 
    153209echo PLUGINS: Perl: $PERL_LDFLAGS 
    154 echo =[Done]========= 
    155  
     210echo =[Done]================================= 
     211 
     212AC_SUBST(MYSQL_CFLAGS) 
     213AC_SUBST(MYSQL_LDFLAGS) 
    156214 
    157215AC_SUBST(PY_CFLAGS) 
  • trunk/enthral.kdevelop

    r125 r129  
    1414    <projectdirectory>file:///home/merc/enthral/trunk</projectdirectory> 
    1515    <absoluteprojectpath>false</absoluteprojectpath> 
    16     <description/> 
     16    <description></description> 
    1717    <secondaryLanguages/> 
    1818    <versioncontrol>kdevsubversion</versioncontrol> 
    1919    <projectname>enthral</projectname> 
    20     <defaultencoding/> 
     20    <defaultencoding></defaultencoding> 
    2121  </general> 
    2222  <kdevautoproject> 
     
    9898        <f77compilerbinary/> 
    9999        <cflags/> 
    100         <cxxflags>-m32</cxxflags> 
     100        <cxxflags/> 
    101101        <f77flags/> 
    102102      </default> 
     
    236236    <references/> 
    237237    <creategettersetter> 
    238       <prefixGet/> 
     238      <prefixGet></prefixGet> 
    239239      <prefixSet>set</prefixSet> 
    240240      <prefixVariable>m_,_</prefixVariable> 
     
    262262    <general> 
    263263      <programargs/> 
    264       <gdbpath/> 
     264      <gdbpath></gdbpath> 
    265265      <dbgshell>libtool</dbgshell> 
    266       <configGdbScript/> 
    267       <runShellScript/> 
    268       <runGdbScript/> 
     266      <configGdbScript></configGdbScript> 
     267      <runShellScript></runShellScript> 
     268      <runGdbScript></runGdbScript> 
    269269      <breakonloadinglibs>true</breakonloadinglibs> 
    270270      <separatetty>false</separatetty> 
  • trunk/enthral.kdevses

    r118 r129  
    22<!DOCTYPE KDevPrjSession> 
    33<KDevPrjSession> 
    4  <DocsAndViews NumberOfDocuments="0" /> 
     4 <DocsAndViews NumberOfDocuments="2" > 
     5  <Doc0 NumberOfViews="1" URL="file:///home/merc/enthral_work/src/sql_set_t.cpp" > 
     6   <View0 Encoding="" Type="Source" /> 
     7  </Doc0> 
     8  <Doc1 NumberOfViews="1" URL="file:///home/merc/enthral_work/configure.in" > 
     9   <View0 Encoding="" line="29" Type="Source" /> 
     10  </Doc1> 
     11 </DocsAndViews> 
    512 <pluginList> 
    613  <kdevdebugger> 
  • trunk/file_id.diz

    r128 r129  
    44|_____|__|__||____|__|__|__| |___._||__| 
    55+<:<-------------------------------->:>+ 
    6 ! build 437 of the enthral bbs system  | 
     6! build 438 of the enthral bbs system  | 
    77+ for *nix/bsd.  For more info visit:  : 
    88:                                      + 
  • trunk/src/Makefile.am

    r127 r129  
    22enthral_SOURCES = configbbs.cpp conio.cpp console.cpp data_areas.cpp dtfunc.cpp \ 
    33        enthral.cpp file_area.cpp file_edit.cpp file_list.cpp files.cpp history.cpp \ 
    4         language.cpp logon.cpp main_system.cpp menu_func.cpp msg_api.cpp \ 
    5         sql_Database.cpp sql_Query.cpp sql_StderrLog.cpp sql_SysLog.cpp msg_area.cpp \ 
     4        language.cpp logon.cpp main_system.cpp menu_func.cpp msg_api.cpp msg_area.cpp \ 
    65        msg_edit.cpp msg_email.cpp msg_fse.cpp msg_new.cpp msg_newscan.cpp msg_pack.cpp \ 
    76        msg_quote.cpp msg_read.cpp msg_readll.cpp msg_stats.cpp msg_title.cpp msgs.cpp \ 
    8         node.cpp plenthral.cpp pyenthral.cpp user_list.cpp users.cpp 
     7        node.cpp plenthral.cpp pyenthral.cpp sql_Database.cpp sql_Query.cpp \ 
     8        sql_StderrLog.cpp sql_SysLog.cpp sql_enum_t.cpp sql_set_t.cpp user_list.cpp users.cpp 
    99 
    1010# set the include path found by configure 
     
    1616 
    1717 
    18 enthral_LDADD = -lpthread -lsqlite3 libsmapilnx.a $(PY_LIBS) 
     18enthral_LDADD = $(PY_LIBS) -lpthread -lmysqlclient libsmapilnx.a 
    1919noinst_HEADERS = api_brow.h compiler.h configbbs.h conio.h console.h \ 
    2020        data_areas.h dtfunc.h file_area.h file_edit.h file_list.h files.h history.h \ 
    21         language.h logon.h main_system.h menu_func.h msg_api.h \ 
    22         sql_Database.h sql_Query.h sql_StderrLog.h sql_SysLog.h sql_IError.h msg_email.h msg_fse.h \ 
    23         msg_email.h msg_fse.h \ 
     21        language.h logon.h main_system.h menu_func.h msg_api.h msg_email.h msg_fse.h \ 
    2422        msg_new.h msg_pack.h msg_read.h msg_readll.h msg_stats.h msg_title.h msgapi.h \ 
    25         msgs.h node.h stamp.h struct.h typedefs.h user_list.h users.h 
     23        msgs.h node.h sql_Database.h sql_IError.h sql_Query.h sql_StderrLog.h \ 
     24        sql_SysLog.h sql_enum_t.h sql_set_t.h stamp.h struct.h typedefs.h user_list.h \ 
     25        users.h 
    2626 
    2727 
  • trunk/src/Makefile.in

    r127 r129  
    5757        file_list.$(OBJEXT) files.$(OBJEXT) history.$(OBJEXT) \ 
    5858        language.$(OBJEXT) logon.$(OBJEXT) main_system.$(OBJEXT) \ 
    59         menu_func.$(OBJEXT) msg_api.$(OBJEXT) sql_Database.$(OBJEXT) \ 
    60         sql_Query.$(OBJEXT) sql_StderrLog.$(OBJEXT) \ 
    61         sql_SysLog.$(OBJEXT) msg_area.$(OBJEXT) msg_edit.$(OBJEXT) \ 
    62         msg_email.$(OBJEXT) msg_fse.$(OBJEXT) msg_new.$(OBJEXT) \ 
    63         msg_newscan.$(OBJEXT) msg_pack.$(OBJEXT) msg_quote.$(OBJEXT) \ 
    64         msg_read.$(OBJEXT) msg_readll.$(OBJEXT) msg_stats.$(OBJEXT) \ 
    65         msg_title.$(OBJEXT) msgs.$(OBJEXT) node.$(OBJEXT) \ 
    66         plenthral.$(OBJEXT) pyenthral.$(OBJEXT) user_list.$(OBJEXT) \ 
     59        menu_func.$(OBJEXT) msg_api.$(OBJEXT) msg_area.$(OBJEXT) \ 
     60        msg_edit.$(OBJEXT) msg_email.$(OBJEXT) msg_fse.$(OBJEXT) \ 
     61        msg_new.$(OBJEXT) msg_newscan.$(OBJEXT) msg_pack.$(OBJEXT) \ 
     62        msg_quote.$(OBJEXT) msg_read.$(OBJEXT) msg_readll.$(OBJEXT) \ 
     63        msg_stats.$(OBJEXT) msg_title.$(OBJEXT) msgs.$(OBJEXT) \ 
     64        node.$(OBJEXT) plenthral.$(OBJEXT) pyenthral.$(OBJEXT) \ 
     65        sql_Database.$(OBJEXT) sql_Query.$(OBJEXT) \ 
     66        sql_StderrLog.$(OBJEXT) sql_SysLog.$(OBJEXT) \ 
     67        sql_enum_t.$(OBJEXT) sql_set_t.$(OBJEXT) user_list.$(OBJEXT) \ 
    6768        users.$(OBJEXT) 
    6869enthral_OBJECTS = $(am_enthral_OBJECTS) 
    6970am__DEPENDENCIES_1 = 
    70 enthral_DEPENDENCIES = libsmapilnx.a $(am__DEPENDENCIES_1) 
     71enthral_DEPENDENCIES = $(am__DEPENDENCIES_1) libsmapilnx.a 
    7172DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) 
    7273depcomp = $(SHELL) $(top_srcdir)/depcomp 
     
    120121FGREP = @FGREP@ 
    121122GREP = @GREP@ 
     123HAVE_MYSQL_FALSE = @HAVE_MYSQL_FALSE@ 
     124HAVE_MYSQL_TRUE = @HAVE_MYSQL_TRUE@ 
    122125INSTALL_DATA = @INSTALL_DATA@ 
    123126INSTALL_PROGRAM = @INSTALL_PROGRAM@ 
     
    133136LTLIBOBJS = @LTLIBOBJS@ 
    134137MAKEINFO = @MAKEINFO@ 
     138MYSQL_CFLAGS = @MYSQL_CFLAGS@ 
     139MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ 
    135140NM = @NM@ 
    136141NMEDIT = @NMEDIT@ 
     
    195200mandir = @mandir@ 
    196201mkdir_p = @mkdir_p@ 
     202mysql_config = @mysql_config@ 
    197203oldincludedir = @oldincludedir@ 
    198204pdfdir = @pdfdir@ 
     
    209215enthral_SOURCES = configbbs.cpp conio.cpp console.cpp data_areas.cpp dtfunc.cpp \ 
    210216        enthral.cpp file_area.cpp file_edit.cpp file_list.cpp files.cpp history.cpp \ 
    211         language.cpp logon.cpp main_system.cpp menu_func.cpp msg_api.cpp \ 
    212         sql_Database.cpp sql_Query.cpp sql_StderrLog.cpp sql_SysLog.cpp msg_area.cpp \ 
     217        language.cpp logon.cpp main_system.cpp menu_func.cpp msg_api.cpp msg_area.cpp \ 
    213218        msg_edit.cpp msg_email.cpp msg_fse.cpp msg_new.cpp msg_newscan.cpp msg_pack.cpp \ 
    214219        msg_quote.cpp msg_read.cpp msg_readll.cpp msg_stats.cpp msg_title.cpp msgs.cpp \ 
    215         node.cpp plenthral.cpp pyenthral.cpp user_list.cpp users.cpp 
     220        node.cpp plenthral.cpp pyenthral.cpp sql_Database.cpp sql_Query.cpp \ 
     221        sql_StderrLog.cpp sql_SysLog.cpp sql_enum_t.cpp sql_set_t.cpp user_list.cpp users.cpp 
    216222 
    217223 
     
    221227# the library search path. 
    222228enthral_LDFLAGS = $(all_libraries) 
    223 enthral_LDADD = -lpthread -lsqlite3 libsmapilnx.a $(PY_LIBS) 
     229enthral_LDADD = $(PY_LIBS) -lpthread -lmysqlclient libsmapilnx.a 
    224230noinst_HEADERS = api_brow.h compiler.h configbbs.h conio.h console.h \ 
    225231        data_areas.h dtfunc.h file_area.h file_edit.h file_list.h files.h history.h \ 
    226         language.h logon.h main_system.h menu_func.h msg_api.h \ 
    227         sql_Database.h sql_Query.h sql_StderrLog.h sql_SysLog.h sql_IError.h msg_email.h msg_fse.h \ 
    228         msg_email.h msg_fse.h \ 
     232        language.h logon.h main_system.h menu_func.h msg_api.h msg_email.h msg_fse.h \ 
    229233        msg_new.h msg_pack.h msg_read.h msg_readll.h msg_stats.h msg_title.h msgapi.h \ 
    230         msgs.h node.h stamp.h struct.h typedefs.h user_list.h users.h 
     234        msgs.h node.h sql_Database.h sql_IError.h sql_Query.h sql_StderrLog.h \ 
     235        sql_SysLog.h sql_enum_t.h sql_set_t.h stamp.h struct.h typedefs.h user_list.h \ 
     236        users.h 
    231237 
    232238_SOURCES = pyenthral.h plenthral.h 
     
    338344@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql_StderrLog.Po@am__quote@ 
    339345@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql_SysLog.Po@am__quote@ 
     346@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql_enum_t.Po@am__quote@ 
     347@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql_set_t.Po@am__quote@ 
    340348@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user_list.Po@am__quote@ 
    341349@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/users.Po@am__quote@ 
  • trunk/src/sql_Database.cpp

    r127 r129  
    1 /* 
     1/** 
    22 **     Database.cpp 
    33 ** 
    4  **     Published / author: 2005-08-12 / grymse@alhem.net 
     4 **     Published / author: 2001-02-15 / grymse@alhem.net 
    55 **/ 
    66 
    77/* 
    8 Copyright (C) 2001-2006  Anders Hedstrom 
     8Copyright (C) 2001  Anders Hedstrom 
    99 
    1010This program is made available under the terms of the GNU GPL. 
     
    3737#include <string> 
    3838#include <map> 
     39#ifdef WIN32 
     40#include <config-win.h> 
     41#include <mysql.h> 
     42#else 
    3943#include <stdio.h> 
    4044#include <stdlib.h> 
    4145#include <string.h> 
    42 #include <sqlite3.h> 
     46#include <mysql/mysql.h> 
    4347#include <stdarg.h> 
     48#endif 
    4449 
    4550#include "sql_IError.h" 
     
    4752 
    4853 
    49 #ifdef SQLITEW_NAMESPACE 
    50 namespace SQLITEW_NAMESPACE { 
     54#ifdef MYSQLW_NAMESPACE 
     55namespace MYSQLW_NAMESPACE { 
    5156#endif 
    5257 
     
    7277 
    7378 
     79Database::Database(const std::string& h,const std::string& u,const std::string& p,const std::string& d,IError *e) 
     80:host(h) 
     81,user(u) 
     82,password(p) 
     83,database(d) 
     84,m_errhandler(e) 
     85,m_embedded(false) 
     86,m_mutex(m_mutex) 
     87,m_b_use_mutex(false) 
     88{ 
     89} 
     90 
     91 
     92Database::Database(Mutex& m,const std::string& h,const std::string& u,const std::string& p,const std::string& d,IError *e) 
     93:host(h) 
     94,user(u) 
     95,password(p) 
     96,database(d) 
     97,m_errhandler(e) 
     98,m_embedded(false) 
     99,m_mutex(m) 
     100,m_b_use_mutex(true) 
     101{ 
     102} 
     103 
     104 
    74105Database::~Database() 
    75106{ 
     
    77108        { 
    78109                OPENDB *p = *it; 
    79                 sqlite3_close(p -> db); 
     110                mysql_close(&p -> mysql); 
    80111        } 
    81112        while (m_opendbs.size()) 
     
    93124 
    94125 
     126void Database::OnMyInit(OPENDB *odb) 
     127{ 
     128        // using embedded server (libmysqld) 
     129        if (m_embedded) 
     130        { 
     131                mysql_options(&odb -> mysql, MYSQL_READ_DEFAULT_GROUP, "test_libmysqld_CLIENT"); 
     132        } 
     133} 
     134 
     135 
    95136void Database::RegErrHandler(IError *p) 
    96137{ 
     
    124165                        return NULL; 
    125166                } 
    126                 int rc = sqlite3_open(database.c_str(), &odb -> db); 
    127                 if (rc) 
    128                 { 
    129                         error("Can't open database: %s\n", sqlite3_errmsg(odb -> db)); 
    130                         sqlite3_close(odb -> db); 
     167                if (!mysql_init(&odb -> mysql)) 
     168                { 
     169                        error("mysql_init() failed - list size %d",m_opendbs.size()); 
    131170                        delete odb; 
    132171                        return NULL; 
    133172                } 
     173                // use callback to set mysql_options() before connect, etc 
     174                this -> OnMyInit(odb); 
     175                if (m_embedded) 
     176                { 
     177                        if (!mysql_real_connect(&odb -> mysql,NULL,NULL,NULL,database.c_str(),0,NULL,0) ) 
     178                        { 
     179                                error("mysql_real_connect(NULL,NULL,NULL,%s,0,NULL,0) failed - list size %d",database.c_str(),m_opendbs.size()); 
     180                                delete odb; 
     181                                return NULL; 
     182                        } 
     183                } 
     184                else 
     185                { 
     186                        if (!mysql_real_connect(&odb -> mysql,host.c_str(),user.c_str(),password.c_str(),database.c_str(),0,NULL,0) ) 
     187                        { 
     188                                error("mysql_real_connect(%s,%s,***,%s,0,NULL,0) failed - list size %d",host.c_str(),user.c_str(),database.c_str(),m_opendbs.size()); 
     189                                delete odb; 
     190                                return NULL; 
     191                        } 
     192                } 
    134193                odb -> busy = true; 
    135194                m_opendbs.push_back(odb); 
     
    137196        else 
    138197        { 
     198                if (mysql_ping(&odb -> mysql)) 
     199                { 
     200                        error("mysql_ping() failed when reusing an old connection from the connection pool"); 
     201                } 
    139202                odb -> busy = true; 
    140203        } 
     
    189252 
    190253 
    191 void Database::error(Query& q,const std::string& msg) 
    192 { 
    193         if (m_errhandler) 
    194         { 
    195                 m_errhandler -> error(*this, q, msg); 
    196         } 
    197 } 
    198  
    199  
    200254bool Database::Connected() 
    201255{ 
     
    205259                return false; 
    206260        } 
     261        int ping_result = mysql_ping(&odb -> mysql); 
     262        if (ping_result) 
     263        { 
     264                error("mysql_ping() failed"); 
     265        } 
    207266        freedb(odb); 
    208         return true; 
     267        return ping_result ? false : true; 
    209268} 
    210269 
     
    279338                case '\\': 
    280339                case 34: 
    281                         str2 += '\''; 
     340                        str2 += '\\'; 
    282341                default: 
     342                        str2 += str[i]; 
     343                } 
     344        } 
     345        return str2; 
     346} 
     347 
     348 
     349std::string Database::unsafestr(const std::string& str) 
     350{ 
     351        std::string str2; 
     352        for (size_t i = 0; i < str.size(); i++) 
     353        { 
     354                if (str[i] == '\\') 
     355                { 
     356                        i++; 
     357                } 
     358                if (i < str.size()) 
     359                { 
    283360                        str2 += str[i]; 
    284361                } 
     
    346423} 
    347424 
    348  
    349 #ifdef SQLITEW_NAMESPACE 
    350 } // namespace SQLITEW_NAMESPACE { 
    351 #endif 
    352  
     425// Added Michael Griffin 11/15/09 
     426// Custom for Inserting Clean Char * 
     427char *Database::strip_escape(OPENDB *qodb, char* Oldstr) { 
     428         
     429  char* Newstr = NULL; 
     430  int ilen=0; 
     431     
     432  if(!Oldstr) 
     433        return NULL; 
     434     
     435  Newstr = new char[((2 * strlen(Oldstr))+1)]; 
     436         
     437  ilen=mysql_real_escape_string(&qodb -> mysql, 
     438                             (char *)Newstr,  
     439                             (char *)Oldstr,  
     440                             (long unsigned int)strlen((char *)Oldstr));  
     441                                  
     442  Newstr[ilen] = 0;                               
     443  return (Newstr); 
     444} 
     445 
     446 
     447#ifdef MYSQLW_NAMESPACE 
     448} // namespace MYSQLW_NAMESPACE { 
     449#endif 
     450 
  • trunk/src/sql_Database.h

    r127 r129  
    1 /* 
     1/** 
    22 **     Database.h 
    33 ** 
    4  **     Published / author: 2005-08-12 / grymse@alhem.net 
     4 **     Published / author: 2001-02-15 / grymse@alhem.net 
    55 **/ 
    66 
    77/* 
    8 Copyright (C) 2001-2006  Anders Hedstrom 
     8Copyright (C) 2001  Anders Hedstrom 
    99 
    1010This program is made available under the terms of the GNU GPL. 
    1111 
    1212If you would like to use this program in a closed-source application, 
    13 a separate license agreement is available. For information about 
     13a separate license agreement is available. For information about  
    1414the closed-source license agreement for this program, please 
    1515visit http://www.alhem.net/sqlwrapped/license.html and/or 
     
    3131*/ 
    3232 
    33 #ifndef _DATABASE_H_SQLITE 
    34 #define _DATABASE_H_SQLITE 
     33#ifndef _DATABASE_H 
     34#define _DATABASE_H 
    3535 
    3636#ifdef _WIN32 
     
    4848#endif 
    4949 
    50 #include <sqlite3.h> 
    51 #include "sql_Database.h" 
    52  
    53 #ifdef SQLITEW_NAMESPACE 
    54 namespace SQLITEW_NAMESPACE { 
     50#ifdef MYSQLW_NAMESPACE 
     51namespace MYSQLW_NAMESPACE { 
    5552#endif 
    56  
    5753 
    5854class IError; 
     
    6157 
    6258 
    63 /** Connection information and pool. */ 
    64 class Database 
     59/** Connection information and pooling. */ 
     60class Database  
    6561{ 
     62        /** Mutex container class, used by Lock.  
     63                \ingroup threading */ 
    6664public: 
    67         /** Mutex container class, used by Lock. 
    68                 \ingroup threading */ 
    6965        class Mutex { 
    7066        public: 
     
    8076#endif 
    8177        }; 
     78        /** Mutex helper class. */ 
    8279private: 
    83         /** Mutex helper class. */ 
    8480        class Lock { 
    8581        public: 
     
    9490        struct OPENDB { 
    9591                OPENDB() : busy(false) {} 
    96                 sqlite3 *db; 
     92                MYSQL mysql; 
    9793                bool busy; 
    9894        }; 
    9995        typedef std::list<OPENDB *> opendb_v; 
     96         
     97        // Temp container for strip_escape 
     98        std::string d_tmpstr; 
    10099 
    101100public: 
    102         /** Use file */ 
     101        /** Use embedded libmysqld */ 
    103102        Database(const std::string& database, 
    104103                IError * = NULL); 
    105104 
    106         /** Use file + thread safe */ 
     105        /** Use embedded libmysqld + thread safe */ 
    107106        Database(Mutex& ,const std::string& database, 
    108107                IError * = NULL); 
    109108 
     109        /** Connect to a MySQL server */ 
     110        Database(const std::string& host, 
     111                const std::string& user, 
     112                const std::string& password = "", 
     113                const std::string& database = "", 
     114                IError * = NULL); 
     115 
     116        /** Connect to a MySQL server + thread safe */ 
     117        Database(Mutex& ,const std::string& host, 
     118                const std::string& user, 
     119                const std::string& password = "", 
     120                const std::string& database = "", 
     121                IError * = NULL); 
     122 
    110123        virtual ~Database(); 
     124 
     125        /** Callback after mysql_init */ 
     126        virtual void OnMyInit(OPENDB *); 
    111127 
    112128        /** try to establish connection with given host */ 
     
    115131        void RegErrHandler(IError *); 
    116132        void error(Query&,const char *format, ...); 
    117         void error(Query&,const std::string& ); 
    118133 
    119134        /** Request a database connection. 
     
    135150        void freedb(OPENDB *odb); 
    136151 
    137         /** Escape string - change all ' to ''. */ 
     152        // utility 
    138153        std::string safestr(const std::string& ); 
    139         /** Make string xml safe. */ 
     154        std::string unsafestr(const std::string& ); 
    140155        std::string xmlsafestr(const std::string& ); 
    141156 
    142         /** Convert string to 64-bit integer. */ 
    143157        int64_t a2bigint(const std::string& ); 
    144         /** Convert string to unsigned 64-bit integer. */ 
    145158        uint64_t a2ubigint(const std::string& ); 
     159         
     160        char *strip_escape(OPENDB *qodb, char* Oldstr); 
    146161 
    147162private: 
     
    150165        void error(const char *format, ...); 
    151166        // 
     167        std::string host; 
     168        std::string user; 
     169        std::string password; 
    152170        std::string database; 
    153171        opendb_v m_opendbs; 
     
    158176}; 
    159177 
    160  
    161 #ifdef SQLITEW_NAMESPACE 
    162 } // namespace SQLITEW_NAMESPACE { 
     178#ifdef MYSQLW_NAMESPACE 
     179} //namespace MYSQLW_NAMESPACE { 
    163180#endif 
    164181 
     182 
    165183#endif // _DATABASE_H 
  • trunk/src/sql_IError.h

    r127 r129  
    1 /* 
     1/** 
    22 **     IError.h 
    33 ** 
     
    66 
    77/* 
    8 Copyright (C) 2004,2005,2006  Anders Hedstrom 
     8Copyright (C) 2004  Anders Hedstrom 
    99 
    1010This program is made available under the terms of the GNU GPL. 
     
    3131*/ 
    3232 
    33 #ifndef _IERROR_H_SQLITE 
    34 #define _IERROR_H_SQLITE 
     33#ifndef _IERROR_H 
     34#define _IERROR_H 
    3535 
    3636#include <string> 
    3737 
    38  
    39 #ifdef SQLITEW_NAMESPACE 
    40 namespace SQLITEW_NAMESPACE { 
     38#ifdef MYSQLW_NAMESPACE 
     39namespace MYSQLW_NAMESPACE { 
    4140#endif 
    4241 
     
    4443class Database; 
    4544class Query; 
    46  
    4745 
    4846/** Log class interface. */ 
     
    5553 
    5654 
    57 #ifdef SQLITEW_NAMESPACE 
    58 } // namespace SQLITEW_NAMESPACE { 
     55#ifdef MYSQLW_NAMESPACE 
     56} // namespace MYSQLW_NAMESPACE { 
    5957#endif 
    6058 
  • trunk/src/sql_Query.cpp

    r127 r129  
    1 /* 
     1/** 
    22 **     Query.cpp 
    33 ** 
    4  **     Published / author: 2005-08-12 / grymse@alhem.net 
     4 **     Published / author: 2001-02-15 / grymse@alhem.net 
    55 **/ 
    66 
    77/* 
    8 Copyright (C) 2001-2006  Anders Hedstrom 
     8Copyright (C) 2001  Anders Hedstrom 
    99 
    1010This program is made available under the terms of the GNU GPL. 
     
    3636#include <string> 
    3737#include <map> 
     38#ifdef WIN32 
     39#include <config-win.h> 
     40#include <mysql.h> 
     41#else 
    3842#include <stdio.h> 
    3943#include <stdlib.h> 
    4044#include <string.h> 
    41 #include <sqlite3.h> 
     45#include <mysql/mysql.h> 
     46#endif 
    4247 
    4348#include "sql_Database.h" 
     
    4550 
    4651 
    47 #ifdef SQLITEW_NAMESPACE 
    48 namespace SQLITEW_NAMESPACE { 
     52#ifdef MYSQLW_NAMESPACE 
     53namespace MYSQLW_NAMESPACE { 
    4954#endif 
    5055 
    5156 
    52 Query::Query(Database& dbin)  
    53 : m_db(dbin) 
    54 ,odb(dbin.grabdb()) 
     57Query::Query(Database *dbin) 
     58:m_db(*dbin) 
     59,odb(dbin ? dbin -> grabdb() : NULL) 
    5560,res(NULL) 
    56 ,row(false) 
    57 ,cache_rc(0) 
    58 ,cache_rc_valid(false) 
    59 ,m_row_count(0) 
     61,row(NULL) 
    6062,m_num_cols(0) 
    6163{ 
     
    6365 
    6466 
    65 Query::Query(Database& dbin,const std::string& sql)  
    66 : m_db(dbin) 
    67 ,odb(dbin.grabdb()) 
    68 ,res(NULL) 
    69 ,row(false) 
    70 ,cache_rc(0) 
    71 ,cache_rc_valid(false) 
    72 ,m_row_count(0) 
     67Query::Query(Database& dbin) : m_db(dbin),odb(dbin.grabdb()),res(NULL),row(NULL) 
    7368,m_num_cols(0) 
    7469{ 
     70} 
     71 
     72 
     73Query::Query(Database *dbin,const std::string& sql) : m_db(*dbin) 
     74,odb(dbin ? dbin -> grabdb() : NULL),res(NULL),row(NULL) 
     75,m_num_cols(0) 
     76{ 
    7577        execute(sql); 
    7678} 
    7779 
    7880 
     81Query::Query(Database& dbin,const std::string& sql) : m_db(dbin),odb(dbin.grabdb()),res(NULL),row(NULL) 
     82,m_num_cols(0) 
     83{ 
     84        execute(sql); // returns 0 if fail 
     85} 
     86 
     87 
    7988Query::~Query() 
    8089{ 
    8190        if (res) 
    8291        { 
    83                 GetDatabase().error(*this, "sqlite3_finalize in destructor"); 
    84                 sqlite3_finalize(res); 
     92                GetDatabase().error(*this, "mysql_free_result in destructor"); 
     93                mysql_free_result(res); 
    8594        } 
    8695        if (odb) 
     
    97106 
    98107 
    99 /* 
    100 The sqlite3_finalize() routine deallocates a prepared SQL statement.  
    101 All prepared statements must be finalized before the database can be closed. 
    102 */ 
    103108bool Query::execute(const std::string& sql) 
    104 { 
    105         // query, no result 
     109{               // query, no result 
    106110        m_last_query = sql; 
    107111        if (odb && res) 
     
    111115        if (odb && !res) 
    112116        { 
    113                 const char *s = NULL; 
    114                 int rc = sqlite3_prepare(odb -> db, sql.c_str(), sql.size(), &res, &s); 
    115                 if (rc != SQLITE_OK) 
    116                 { 
    117                         GetDatabase().error(*this, "execute: prepare query failed"); 
    118                         return false; 
    119                 } 
    120                 if (!res) 
    121                 { 
    122                         GetDatabase().error(*this, "execute: query failed"); 
    123                         return false; 
    124                 } 
    125                 rc = sqlite3_step(res); // execute 
    126                 sqlite3_finalize(res); // deallocate statement 
     117                if (mysql_query(&odb -> mysql,sql.c_str())) 
     118                { 
     119                        GetDatabase().error(*this,"query failed"); 
     120                } 
     121                else 
     122                { 
     123                        return true; 
     124                } 
     125        } 
     126        return false; 
     127} 
     128 
     129 
     130 
     131// methods using db specific api calls 
     132 
     133MYSQL_RES *Query::get_result(const std::string& sql) 
     134{       // query, result 
     135        if (odb && res) 
     136        { 
     137                GetDatabase().error(*this, "get_result: query busy"); 
     138        } 
     139        if (odb && !res) 
     140        { 
     141                if (execute(sql)) 
     142                { 
     143                        res = mysql_store_result(&odb -> mysql); 
     144                        if (res) 
     145                        { 
     146                                MYSQL_FIELD *f = mysql_fetch_field(res); 
     147                                int i = 1; 
     148                                while (f) 
     149                                { 
     150                                        if (f -> name) 
     151                                                m_nmap[f -> name] = i; 
     152                                        f = mysql_fetch_field(res); 
     153                                        i++; 
     154                                } 
     155                                m_num_cols = i - 1; 
     156                        } 
     157                } 
     158        } 
     159        return res; 
     160} 
     161 
     162 
     163void Query::free_result() 
     164{ 
     165        if (odb && res) 
     166        { 
     167                mysql_free_result(res); 
    127168                res = NULL; 
    128                 switch (rc) 
    129                 { 
    130                 case SQLITE_BUSY: 
    131                         GetDatabase().error(*this, "execute: database busy"); 
    132                         return false; 
    133                 case SQLITE_DONE: 
    134                 case SQLITE_ROW: 
    135                         return true; 
    136                 case SQLITE_ERROR: 
    137                         GetDatabase().error(*this, sqlite3_errmsg(odb -> db)); 
    138                         return false; 
    139                 case SQLITE_MISUSE: 
    140                         GetDatabase().error(*this, "execute: database misuse"); 
    141                         return false; 
    142                 } 
    143                 GetDatabase().error(*this, "execute: unknown result code"); 
    144         } 
    145         return false; 
    146 } 
    147  
    148  
    149  
    150 // methods using db specific api calls 
    151  
    152 sqlite3_stmt *Query::get_result(const std::string& sql) 
    153 { 
    154         // query, result 
    155         m_last_query = sql; 
    156         if (odb && res) 
    157         { 
    158                 GetDatabase().error(*this, "get_result: query busy"); 
    159         } 
    160         if (odb && !res) 
    161         { 
    162                 const char *s = NULL; 
    163                 int rc = sqlite3_prepare(odb -> db, sql.c_str(), sql.size(), &res, &s); 
    164                 if (rc != SQLITE_OK) 
    165                 { 
    166                         GetDatabase().error(*this, "get_result: prepare query failed"); 
    167                         return NULL; 
    168                 } 
    169                 if (!res) 
    170                 { 
    171                         GetDatabase().error(*this, "get_result: query failed"); 
    172                         return NULL; 
    173                 } 
    174                 // get column names from result 
    175                 { 
    176                         int i = 0; 
    177                         do 
    178                         { 
    179                                 const char *p = sqlite3_column_name(res, i); 
    180                                 if (!p) 
    181                                         break; 
    182                                 m_nmap[p] = ++i; 
    183                         } while (true); 
    184                         m_num_cols = i; 
    185                 } 
    186                 cache_rc = sqlite3_step(res); 
    187                 cache_rc_valid = true; 
    188                 m_row_count = (cache_rc == SQLITE_ROW) ? 1 : 0; 
    189         } 
    190         return res; 
    191 } 
    192  
    193  
    194 void Query::free_result() 
    195 { 
    196         if (odb && res) 
    197         { 
    198                 sqlite3_finalize(res); 
    199                 res = NULL; 
    200                 row = false; 
    201                 cache_rc_valid = false; 
    202         } 
    203         // clear column names 
     169                row = NULL; 
     170        } 
    204171        while (m_nmap.size()) 
    205172        { 
     
    207174                m_nmap.erase(it); 
    208175        } 
    209 } 
    210  
    211  
    212 bool Query::fetch_row() 
     176        m_num_cols = 0; 
     177} 
     178 
     179 
     180MYSQL_ROW Query::fetch_row() 
    213181{ 
    214182        rowcount = 0; 
    215         row = false; 
    216         if (odb && res) 
    217         { 
    218                 int rc = cache_rc_valid ? cache_rc : sqlite3_step(res); // execute 
    219                 cache_rc_valid = false; 
    220                 switch (rc) 
    221                 { 
    222                 case SQLITE_BUSY: 
    223                         GetDatabase().error(*this, "execute: database busy"); 
    224                         return false; 
    225                 case SQLITE_DONE: 
    226                         return false; 
    227                 case SQLITE_ROW: 
    228                         row = true; 
    229                         return true; 
    230                 case SQLITE_ERROR: 
    231                         GetDatabase().error(*this, sqlite3_errmsg(odb -> db)); 
    232                         return false; 
    233                 case SQLITE_MISUSE: 
    234                         GetDatabase().error(*this, "execute: database misuse"); 
    235                         return false; 
    236                 } 
    237                 GetDatabase().error(*this, "execute: unknown result code"); 
    238         } 
     183        return odb && res ? row = mysql_fetch_row(res) : NULL; 
     184} 
     185 
     186 
     187my_ulonglong Query::insert_id() 
     188{ 
     189        if (odb) 
     190        { 
     191                return mysql_insert_id(&odb -> mysql); 
     192        } 
     193        else 
     194        { 
     195                return 0; 
     196        } 
     197} 
     198 
     199 
     200long Query::num_rows() 
     201{ 
     202        return odb && res ? mysql_num_rows(res) : 0; 
     203} 
     204 
     205 
     206int Query::num_cols() 
     207{ 
     208        return m_num_cols; 
     209} 
     210 
     211 
     212bool Query::is_null(int x) 
     213{ 
     214        if (odb && res && row) 
     215        { 
     216                return row[x] ? false : true; 
     217        } 
     218        return false; // ... 
     219} 
     220 
     221 
     222bool Query::is_null(const std::string& x) 
     223{ 
     224        int index = m_nmap[x] - 1; 
     225        if (index >= 0) 
     226                return is_null(index); 
     227        error("Column name lookup failure: " + x); 
    239228        return false; 
    240229} 
    241230 
    242231 
    243 sqlite_int64 Query::insert_id() 
    244 { 
    245         if (odb) 
    246         { 
    247                 return sqlite3_last_insert_rowid(odb -> db); 
    248         } 
    249         else 
    250         { 
    251                 return 0; 
    252         } 
    253 } 
    254  
    255  
    256 long Query::num_rows() 
    257 { 
    258         return odb && res ? m_row_count : 0; 
    259 } 
    260  
    261  
    262 int Query::num_cols() 
    263 { 
    264         return m_num_cols; 
    265 } 
    266  
    267  
    268 bool Query::is_null(int x) 
     232bool Query::is_null() 
     233{ 
     234        return is_null(rowcount++); 
     235} 
     236 
     237 
     238const char *Query::getstr(const std::string& x) 
     239{ 
     240        int index = m_nmap[x] - 1; 
     241        if (index >= 0) 
     242                return getstr(index); 
     243        error("Column name lookup failure: " + x); 
     244        return NULL; 
     245} 
     246 
     247 
     248const char *Query::getstr(int x) 
    269249{ 
    270250        if (odb && res && row) 
    271251        { 
    272                 if (sqlite3_column_type(res, x) == SQLITE_NULL) 
    273                         return true; 
    274         } 
    275         return false; // ... 
    276 } 
    277  
    278  
    279 const char *Query::getstr(const std::string& x) 
    280 { 
    281         int index = m_nmap[x] - 1; 
    282         if (index >= 0) 
    283                 return getstr(index); 
    284         error("Column name lookup failure: " + x); 
    285         return ""; 
    286 } 
    287  
    288  
    289 const char *Query::getstr(int x) 
    290 { 
    291         if (odb && res && row && x < sqlite3_column_count(res) ) 
    292         { 
    293                 const unsigned char *tmp = sqlite3_column_text(res, x); 
    294                 return tmp ? (const char *)tmp : ""; 
    295         } 
    296         return ""; 
     252                return row[x] ? row[x] : ""; 
     253        } 
     254        return NULL; 
    297255} 
    298256 
     
    316274double Query::getnum(int x) 
    317275{ 
    318         if (odb && res && row) 
    319         { 
    320                 return sqlite3_column_double(res, x); 
    321         } 
     276        return odb && res && row && row[x] ? atof(row[x]) : 0; 
     277} 
     278 
     279 
     280long Query::getval(const std::string& x) 
     281{ 
     282        int index = m_nmap[x] - 1; 
     283        if (index >= 0) 
     284                return getval(index); 
     285        error("Column name lookup failure: " + x); 
    322286        return 0; 
    323287} 
    324288 
    325289 
    326 long Query::getval(const std::string& x) 
    327 { 
    328         int index = m_nmap[x] - 1; 
    329         if (index >= 0) 
    330                 return getval(index); 
     290long Query::getval(int x) 
     291{ 
     292        return odb && res && row && row[x] ? atol(row[x]) : 0; 
     293} 
     294 
     295 
     296double Query::getnum() 
     297{ 
     298        return getnum(rowcount++); 
     299} 
     300 
     301 
     302long Query::getval() 
     303{ 
     304        return getval(rowcount++); 
     305} 
     306 
     307 
     308unsigned long Query::getuval(const std::string& x) 
     309{ 
     310        int index = m_nmap[x] - 1; 
     311        if (index >= 0) 
     312                return getuval(index); 
    331313        error("Column name lookup failure: " + x); 
    332314        return 0; 
     
    334316 
    335317 
    336 long Query::getval(int x) 
    337 { 
    338         if (odb && res && row) 
    339         { 
    340                 return sqlite3_column_int(res, x); 
    341         } 
     318unsigned long Query::getuval(int x) 
     319{ 
     320        unsigned long l = 0; 
     321        if (odb && res && row && row[x]) 
     322        { 
     323                l = m_db.a2ubigint(row[x]); 
     324        } 
     325        return l; 
     326} 
     327 
     328 
     329unsigned long Query::getuval() 
     330{ 
     331        return getuval(rowcount++); 
     332} 
     333 
     334 
     335int64_t Query::getbigint(const std::string& x) 
     336{ 
     337        int index = m_nmap[x] - 1; 
     338        if (index >= 0) 
     339                return getbigint(index); 
     340        error("Column name lookup failure: " + x); 
    342341        return 0; 
    343342} 
    344343 
    345344 
    346 double Query::getnum() 
    347 { 
    348         return getnum(rowcount++); 
    349 } 
    350  
    351  
    352 long Query::getval() 
    353 { 
    354         return getval(rowcount++); 
    355 } 
    356  
    357  
    358 unsigned long Query::getuval(const std::string& x) 
    359 { 
    360         int index = m_nmap[x] - 1; 
    361         if (index >= 0) 
    362                 return getuval(index); 
     345int64_t Query::getbigint(int x) 
     346{ 
     347        return odb && res && row && row[x] ? m_db.a2bigint(row[x]) : 0; 
     348} 
     349 
     350 
     351int64_t Query::getbigint() 
     352{ 
     353        return getbigint(rowcount++); 
     354} 
     355 
     356 
     357uint64_t Query::getubigint(const std::string& x) 
     358{ 
     359        int index = m_nmap[x] - 1; 
     360        if (index >= 0) 
     361                return getubigint(index); 
    363362        error("Column name lookup failure: " + x); 
    364363        return 0; 
     
    366365 
    367366 
    368 unsigned long Query::getuval(int x) 
    369 { 
    370         unsigned long l = 0; 
    371         if (odb && res && row) 
    372         { 
    373                 l = sqlite3_column_int(res, x); 
    374         } 
    375         return l; 
    376 } 
    377  
    378  
    379 unsigned long Query::getuval() 
    380 { 
    381         return getuval(rowcount++); 
    382 } 
    383  
    384  
    385 int64_t Query::getbigint(const std::string& x) 
    386 { 
    387         int index = m_nmap[x] - 1; 
    388         if (index >= 0) 
    389                 return getbigint(index); 
    390         error("Column name lookup failure: " + x); 
    391         return 0; 
    392 } 
    393  
    394  
    395 int64_t Query::getbigint(int x) 
    396 { 
    397         if (odb && res && row) 
    398         { 
    399                 return sqlite3_column_int64(res, x); 
    400         } 
    401         return 0; 
    402 } 
    403  
    404  
    405 int64_t Query::getbigint() 
    406 { 
    407         return getbigint(rowcount++); 
    408 } 
    409  
    410  
    411 uint64_t Query::getubigint(const std::string& x) 
    412 { 
    413         int index = m_nmap[x] - 1; 
    414         if (index >= 0) 
    415                 return getubigint(index); 
    416         error("Column name lookup failure: " + x); 
    417         return 0; 
    418 } 
    419  
    420  
    421367uint64_t Query::getubigint(int x) 
    422368{ 
    423         uint64_t l = 0; 
    424         if (odb && res && row) 
    425         { 
    426                 l = sqlite3_column_int64(res, x); 
    427         } 
    428         return l; 
     369        return odb && res && row && row[x] ? m_db.a2ubigint(row[x]) : 0; 
    429370} 
    430371 
     
    489430std::string Query::GetError() 
    490431{ 
     432        return odb ? mysql_error(&odb -> mysql) : ""; 
     433} 
     434 
     435 
     436int Query::GetErrno() 
     437{ 
     438        return odb ? mysql_errno(&odb -> mysql) : 0; 
     439} 
     440 
     441 
     442bool Query::Connected() 
     443{ 
    491444        if (odb) 
    492                 return sqlite3_errmsg(odb -> db); 
    493         return ""; 
    494 } 
    495  
    496  
    497 int Query::GetErrno() 
    498 { 
    499         if (odb) 
    500                 return sqlite3_errcode(odb -> db); 
    501         return 0; 
    502 } 
    503  
    504  
    505 bool Query::Connected() 
    506 { 
     445        { 
     446                if (mysql_ping(&odb -> mysql)) 
     447                { 
     448                        GetDatabase().error(*this, "mysql_ping() failed"); 
     449                        return false; 
     450                } 
     451        } 
    507452        return odb ? true : false; 
    508453} 
    509454 
    510455 
    511  
    512  
    513 void Query::ViewRes() 
    514 { 
    515         if (!res) 
    516         { 
    517                 printf("no result stored\n"); 
    518                 return; 
    519         } 
    520         printf("result column count = %d\n", sqlite3_column_count(res)); 
    521         for (int i = 0; i < sqlite3_column_count(res); i++) 
    522         { 
    523                 printf(" %2d   type %d   name '%s'", i, sqlite3_column_type(res, i), sqlite3_column_name(res, i)); 
    524                 printf("  / '%s'", (char *)sqlite3_column_text(res, i)); 
    525                 printf("  / %d", sqlite3_column_int(res, i)); 
    526                 printf("  / %f", sqlite3_column_double(res, i)); 
    527                 printf("\n"); 
    528         } 
    529 } 
    530  
    531  
    532 void Query::error(const std::string& msg) 
    533 { 
    534         GetDatabase().error(*this, msg); 
    535 } 
    536  
    537  
    538 #ifdef SQLITEW_NAMESPACE 
    539 } // namespace SQLITEW_NAMESPACE { 
     456void Query::error(const std::string& x) 
     457{ 
     458        m_db.error(*this, x.c_str()); 
     459} 
     460 
     461 
     462std::string Query::safestr(const std::string& x) 
     463{ 
     464        return m_db.safestr(x); 
     465} 
     466 
     467// Added Michael Griffin 11/15/09 
     468// Custom 'mysql_real_escape_string()' 
     469char *Query::strip(char* Oldstr)  
     470{ 
     471    return m_db.strip_escape(odb,Oldstr); 
     472} 
     473 
     474 
     475#ifdef MYSQLW_NAMESPACE 
     476} // namespace MYSQLW_NAMESPACE { 
    540477#endif 
    541478 
  • trunk/src/sql_Query.h

    r127 r129  
    55 **     Query.h 
    66 ** 
    7  **     Published / author: 2005-08-12 / grymse@alhem.net 
     7 **     Published / author: 2001-02-15 / grymse@alhem.net 
    88 **/ 
    99 
    1010/* 
    11 Copyright (C) 2001-2006  Anders Hedstrom 
     11Copyright (C) 2001  Anders Hedstrom 
    1212 
    1313This program is made available under the terms of the GNU GPL. 
     
    3434*/ 
    3535 
    36 #ifndef _QUERY_H_SQLITE 
    37 #define _QUERY_H_SQLITE 
     36#ifndef _QUERY_H 
     37#define _QUERY_H 
    3838 
    3939#include <string> 
     
    4747 
    4848 
    49 #ifdef SQLITEW_NAMESPACE 
    50 namespace SQLITEW_NAMESPACE { 
     49#ifdef MYSQLW_NAMESPACE 
     50namespace MYSQLW_NAMESPACE { 
    5151#endif 
    5252 
    5353 
    54 /** SQL Statement execute / result. */ 
     54/** SQL Statement execute / result set helper class. */ 
    5555class Query  
    5656{ 
     
    5959        Query(Database& dbin); 
    6060        /** Constructor accepting reference to database object 
    61                 and query string to execute. */ 
     61                and query to execute. */ 
    6262        Query(Database& dbin,const std::string& sql); 
    6363        ~Query(); 
    6464 
    65         /** Check if database object is connectable. */ 
     65        /** Check to see if database object is connectable. */ 
    6666        bool Connected(); 
    6767        /** Return reference to database object. */ 
    6868        Database& GetDatabase() const; 
    69         /** Return string containing last query executed. */ 
     69        /** Return string of last query executed. */ 
    7070        const std::string& GetLastQuery(); 
    7171 
    7272        /** execute() returns true if query is successful, 
    73                 does not store result. */ 
     73                does not store result */ 
    7474        bool execute(const std::string& sql); 
     75        /** execute query and store result. */ 
     76        MYSQL_RES *get_result(const std::string& sql); 
    7577 
    76         /** Execute query and store result. */ 
    77         sqlite3_stmt *get_result(const std::string& sql); 
    78         /** Free stored result, must be called after get_result() before calling  
    79                 execute()/get_result() again. */ 
     78        /** free stored result, must be called after get_result() */ 
    8079        void free_result(); 
    8180        /** Fetch next result row. 
    8281                \return false if there was no row to fetch (end of rows) */ 
    83         bool fetch_row(); 
     82        MYSQL_ROW fetch_row(); 
    8483        /** Get id of last insert. */ 
    85         sqlite_int64 insert_id(); 
    86         /** Returns 0 if there are no rows to fetch. */ 
     84        my_ulonglong insert_id(); 
     85        /** Returns number of rows returned by last select call. */ 
    8786        long num_rows(); 
    8887        /** Number of columns in current result. */ 
     
    9493 
    9594        /** Check if column x in current row is null. */ 
     95        bool is_null(const std::string& x); 
    9696        bool is_null(int x); 
     97        bool is_null(); 
    9798 
    9899        /** Execute query and return first result as a string. */ 
     
    103104        double get_num(const std::string& sql); 
    104105 
    105         /** Return column named x as a string value. */ 
    106106        const char *getstr(const std::string& x); 
    107         /** Return column x as a string value. */ 
    108107        const char *getstr(int x); 
    109         /** Return next column as a string value - see rowcount. */ 
    110108        const char *getstr(); 
    111  
    112         /** Return column named x as a long integer. */ 
    113109        long getval(const std::string& x); 
    114         /** Return column x as a long integer. */ 
    115110        long getval(int x); 
    116         /** Return next column as a long integer - see rowcount. */ 
    117111        long getval(); 
    118  
    119         /** Return column named x as an unsigned long integer. */ 
    120112        unsigned long getuval(const std::string& x); 
    121         /** Return column x as an unsigned long integer. */ 
    122113        unsigned long getuval(int x); 
    123         /** Return next column as an unsigned long integer. */ 
    124114        unsigned long getuval(); 
    125  
    126         /** Return column named x as a 64-bit integer value. */ 
    127115        int64_t getbigint(const std::string& x); 
    128         /** Return column x as a 64-bit integer value. */ 
    129116        int64_t getbigint(int x); 
    130         /** Return next column as a 64-bit integer value. */ 
    131117        int64_t getbigint(); 
    132  
    133         /** Return column named x as an unsigned 64-bit integer value. */ 
    134118        uint64_t getubigint(const std::string& x); 
    135         /** Return column x as an unsigned 64-bit integer value. */ 
    136119        uint64_t getubigint(int x); 
    137         /** Return next column as an unsigned 64-bit integer value. */ 
    138120        uint64_t getubigint(); 
    139  
    140         /** Return column named x as a double. */ 
    141121        double getnum(const std::string& x); 
    142         /** Return column x as a double. */ 
    143122        double getnum(int x); 
    144         /** Return next column as a double. */ 
    145123        double getnum(); 
    146124 
     125        std::string safestr(const std::string& x); 
     126        char *strip(char* Oldstr); 
     127 
     128protected: 
     129        Query(Database *dbin); 
     130        Query(Database *dbin,const std::string& sql); 
    147131private: 
    148         /** Hide the copy constructor. */ 
    149132        Query(const Query& q) : m_db(q.GetDatabase()) {} 
    150         /** Hide the assignment operator. */ 
    151133        Query& operator=(const Query& ) { return *this; } 
    152         /** Print current result to stdout. */ 
    153         void ViewRes(); 
    154         /** Print error to debug class. */ 
    155134        void error(const std::string& ); 
    156         Database& m_db; ///< Reference to database object 
    157         Database::OPENDB *odb; ///< Connection pool handle 
    158         sqlite3_stmt *res; ///< Stored result 
    159         bool row; ///< true if fetch_row succeeded 
    160         short rowcount; ///< Current column pointer in result 
    161         std::string m_tmpstr; ///< Used to store result in get_string() call 
    162         std::string m_last_query; ///< Last query executed 
    163         int cache_rc; ///< Cached result after call to get_result() 
    164         bool cache_rc_valid; ///< Indicates cache_rc is valid 
    165         int m_row_count; ///< 0 if get_result() returned no rows 
    166         // 
    167         std::map<std::string,int> m_nmap; ///< map translating column names to index 
    168         int m_num_cols; ///< number of columns in result 
     135        Database& m_db; 
     136        Database::OPENDB *odb; 
     137        MYSQL_RES *res; 
     138        MYSQL_ROW row; 
     139        short rowcount; 
     140        std::string m_tmpstr; 
     141        std::string m_last_query; 
     142        std::map<std::string,int> m_nmap; 
     143        int m_num_cols; 
    169144}; 
    170145 
    171146 
    172 #ifdef SQLITEW_NAMESPACE 
    173 } // namespace SQLITEW_NAMESPACE { 
     147#ifdef MYSQLW_NAMESPACE 
     148} // namespace MYSQLW_NAMESPACE { 
    174149#endif 
    175150 
  • trunk/src/sql_StderrLog.cpp

    r127 r129  
    1 /* 
     1/** 
    22 **     StderrLog.cpp 
    33 ** 
     
    66 
    77/* 
    8 Copyright (C) 2004,2005,2006  Anders Hedstrom 
     8Copyright (C) 2004  Anders Hedstrom 
    99 
    1010This program is made available under the terms of the GNU GPL. 
     
    3737#include <string> 
    3838#include <map> 
     39#ifdef WIN32 
     40#include <config-win.h> 
     41#include <mysql.h> 
    3942#include <time.h> 
    40 #include <sqlite3.h> 
     43#else 
     44#include <mysql/mysql.h> 
     45#endif 
    4146 
    4247#include "sql_Database.h" 
    4348#include "sql_Query.h" 
    44 #include "sql_IError.h" 
     49//#include "sql_IError.h" 
    4550#include "sql_StderrLog.h" 
    4651 
    4752 
    48 #ifdef SQLITEW_NAMESPACE 
    49 namespace SQLITEW_NAMESPACE { 
     53#ifdef MYSQLW_NAMESPACE 
     54namespace MYSQLW_NAMESPACE { 
    5055#endif 
    5156 
     
    7479 
    7580 
    76 #ifdef SQLITEW_NAMESPACE 
    77 } // namespace SQLITEW_NAMESPACE { 
     81#ifdef MYSQLW_NAMESPACE 
     82} // namespace MYSQLW_NAMESPACE { 
    7883#endif 
    7984 
  • trunk/src/sql_StderrLog.h

    r127 r129  
    66 
    77/* 
    8 Copyright (C) 2004,2005,2006  Anders Hedstrom 
     8Copyright (C) 2004  Anders Hedstrom 
    99 
    1010This program is made available under the terms of the GNU GPL. 
     
    3030Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    3131*/ 
    32 #ifndef _STDERRLOG_H_SQLITE 
    33 #define _STDERRLOG_H_SQLITE 
     32#ifndef _STDERRLOG_H 
     33#define _STDERRLOG_H 
    3434 
    35  
    36 #ifdef SQLITEW_NAMESPACE 
    37 namespace SQLITEW_NAMESPACE { 
     35#ifdef MYSQLW_NAMESPACE 
     36namespace MYSQLW_NAMESPACE { 
    3837#endif 
    3938 
     39#include "sql_Database.h" 
     40#include "sql_IError.h" 
    4041 
    41 /** Log class writing to standard error. */ 
     42/** Log class writing to stderr. */ 
    4243class StderrLog : public IError 
    4344{ 
     
    5051 
    5152 
    52 #ifdef SQLITEW_NAMESPACE 
    53 } // namespace SQLITEW_NAMESPACE { 
     53#ifdef MYSQLW_NAMESPACE 
     54} // namespace MYSQLW_NAMESPACE { 
    5455#endif 
    5556 
     57 
    5658#endif // _STDERRLOG_H 
  • trunk/src/sql_SysLog.cpp

    r127 r129  
    1 /* 
     1/** 
    22 **     SysLog.cpp 
    33 ** 
     
    66 
    77/* 
    8 Copyright (C) 2004,2005,2006  Anders Hedstrom 
     8Copyright (C) 2004  Anders Hedstrom 
    99 
    1010This program is made available under the terms of the GNU GPL. 
    1111 
    1212If you would like to use this program in a closed-source application, 
    13 a separate license agreement is available. For information about 
     13a separate license agreement is available. For information about  
    1414the closed-source license agreement for this program, please 
    1515visit http://www.alhem.net/sqlwrapped/license.html and/or 
     
    3232#ifndef WIN32 
    3333 
    34 #include <cstring> 
    35 #include <sqlite3.h> 
     34#include <mysql/mysql.h> 
    3635#include <syslog.h> 
    3736 
     37#include <cstdio> 
     38#include <cstring> 
    3839#include "sql_Database.h" 
    3940#include "sql_Query.h" 
     
    4243 
    4344 
    44 #ifdef SQLITEW_NAMESPACE 
    45 namespace SQLITEW_NAMESPACE { 
     45#ifdef MYSQLW_NAMESPACE 
     46namespace MYSQLW_NAMESPACE { 
    4647#endif 
    4748 
     
    7475 
    7576 
    76 #ifdef SQLITEW_NAMESPACE 
    77 } // namespace SQLITEW_NAMESPACE { 
     77#ifdef MYSQLW_NAMESPACE 
     78} // namespace MYSQLW_NAMESPACE { 
    7879#endif 
    7980 
  • trunk/src/sql_SysLog.h

    r127 r129  
    1 /* 
     1/** 
    22 **     SysLog.h 
    33 ** 
     
    66 
    77/* 
    8 Copyright (C) 2004,2005,2006  Anders Hedstrom 
     8Copyright (C) 2004  Anders Hedstrom 
    99 
    1010This program is made available under the terms of the GNU GPL. 
    1111 
    1212If you would like to use this program in a closed-source application, 
    13 a separate license agreement is available. For information about 
     13a separate license agreement is available. For information about  
    1414the closed-source license agreement for this program, please 
    1515visit http://www.alhem.net/sqlwrapped/license.html and/or 
     
    3030Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    3131*/ 
    32 #ifndef _SYSLOG_H_SQLITE 
    33 #define _SYSLOG_H_SQLITE 
     32#ifndef _SYSLOG_H 
     33#define _SYSLOG_H 
    3434#ifndef WIN32 
    3535 
    36 #include <sql_SysLog.h> 
     36#include <syslog.h> 
    3737 
    38  
    39 #ifdef SQLITEW_NAMESPACE 
    40 namespace SQLITEW_NAMESPACE { 
     38#ifdef MYSQLW_NAMESPACE 
     39namespace MYSQLW_NAMESPACE { 
    4140#endif 
    4241 
     
    5655 
    5756 
    58 #ifdef SQLITEW_NAMESPACE 
    59 } // namespace SQLITEW_NAMESPACE { 
     57#ifdef MYSQLW_NAMESPACE 
     58} // namespace MYSQLW_NAMESPACE { 
    6059#endif 
    6160