diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3cb84ce61c..6cbd0795c4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,25 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ * harbour/makefile.vc + * source/pp/ppcomp.c + * modified TEXT/ENDTEXT to use '#pragma __text' + + added #pragma __stream and #pragma __cstream + (examples later) + + +2006-03-08 3:31 UTC-0500 David Arturo Macias Corona + - harbour/source/codepage/cdpsl437.c + - harbour/source/codepage/cdpsl852.c + - harbour/source/codepage/cdpslwin.c + - harbour/source/codepage/cdpsliso.c + - Removed these four files. + +2006-03-06 12:00 UTC+0100 Mitja Podgornik + David Macias: Source code provided by Mitja Podgornik + * harbour/contrib/mysql/mysql.ch + + added MYSQL_DECIMAL_TYPE for MySQL versions 5.0 and above + + returns 5 digit numeric version of MySQL server * harbour/contrib/mysql/tmysql.prg + added functions sql_commit(), sql_rollback()(CLASS TMySQLServer) to support transactions with InnoDB table types diff --git a/harbour/contrib/mysql/mysql.c b/harbour/contrib/mysql/mysql.c index 8dec899d44..f964a422f3 100644 --- a/harbour/contrib/mysql/mysql.c +++ b/harbour/contrib/mysql/mysql.c @@ -82,6 +82,14 @@ also .h files from same distribution */ + + +HB_FUNC( SQLVERSION ) // long mysql_get_server_version(MYSQL *) +{ + hb_retnl( (long) mysql_get_server_version((MYSQL *)_parnl(1)) ); +} + + HB_FUNC( SQLCONNECT ) // MYSQL *mysql_real_connect(MYSQL*, char * host, char * user, char * password, char * db, uint port, char *, uint flags) { MYSQL * mysql; @@ -121,6 +129,18 @@ HB_FUNC( SQLCLOSE ) // void mysql_close(MYSQL *mysql) } +HB_FUNC( SQLCOMMIT ) // bool mysql_commit(MYSQL *mysql) +{ + hb_retnl((long) mysql_commit((MYSQL *)_parnl(1))); +} + + +HB_FUNC( SQLROLLBACK ) // bool mysql_rollback(MYSQL *mysql) +{ + hb_retnl((long) mysql_rollback((MYSQL *)_parnl(1))); +} + + HB_FUNC( SQLSELECTD ) // int mysql_select_db(MYSQL *, char *) { const char *db=hb_parc(2); @@ -250,7 +270,7 @@ HB_FUNC( SQLNUMFI ) // unsigned int mysql_num_fields(MYSQL_RES *) } #if MYSQL_VERSION_ID > 32200 -HB_FUNC( SQLFICOU ) // unsigned int mysql_num_fields(MYSQL_RES *) +HB_FUNC( SQLFICOU ) // unsigned int mysql_field_count(MYSQL *) { hb_retnl(mysql_field_count(((MYSQL *)_parnl(1)))); } diff --git a/harbour/contrib/mysql/mysql.ch b/harbour/contrib/mysql/mysql.ch index 09115351d8..d05594ab0d 100644 --- a/harbour/contrib/mysql/mysql.ch +++ b/harbour/contrib/mysql/mysql.ch @@ -56,7 +56,6 @@ // MySQL field types -#define MYSQL_DECIMAL_TYPE 0 // NOTE: TINY is used to map clipper logical values to MySQL tables, so 0 == .F., 1 == .T. #define MYSQL_TINY_TYPE 1 #define MYSQL_SHORT_TYPE 2 @@ -72,6 +71,7 @@ #define MYSQL_DATETIME_TYPE 12 #define MYSQL_YEAR_TYPE 13 #define MYSQL_NEWDATE_TYPE 14 +#define MYSQL_DECIMAL_TYPE 246 #define MYSQL_ENUMTYPE 247 #define MYSQL_SET_TYPE 248 #define MYSQL_TINY_BLOB_TYPE 249 diff --git a/harbour/contrib/mysql/tmysql.prg b/harbour/contrib/mysql/tmysql.prg index dbbe23e90c..d5affae44c 100644 --- a/harbour/contrib/mysql/tmysql.prg +++ b/harbour/contrib/mysql/tmysql.prg @@ -232,6 +232,7 @@ METHOD FieldType(nNum) CLASS TMySQLRow local cType := "U" if nNum >=1 .AND. nNum <= Len(::aFieldStruct) + do case case ::aFieldStruct[nNum][MYSQL_FS_TYPE] == MYSQL_TINY_TYPE cType := "L" @@ -873,6 +874,7 @@ METHOD GetRow(nRow) CLASS TMySQLTable ::aOldvalue:={} for i := 1 to ::nNumFields + // ::aOldValue[i] := ::FieldGet(i) aadd(::aOldvalue,::fieldget(i)) next @@ -1417,7 +1419,10 @@ CLASS TMySQLServer METHOD NetErr() INLINE ::lError // Returns .T. if something went wrong METHOD Error() // Returns textual description of last error METHOD CreateDatabase( cDataBase ) // Create an New Mysql Database - +//Mitja + METHOD sql_Commit() // Commits transaction + METHOD sql_Rollback() // Rollbacks transaction + METHOD sql_Version() // server version as numeric ENDCLASS @@ -1435,13 +1440,36 @@ METHOD New(cServer, cUser, cPassword) CLASS TMySQLServer return Self + + METHOD Destroy() CLASS TMySQLServer - sqlClose(::nSocket) - return Self + +METHOD sql_commit() CLASS TMySQLServer + if sqlCommit(::nSocket) == 0 + Return .T. + endif +return .F. + + + +METHOD sql_rollback() CLASS TMySQLServer + if sqlRollback(::nSocket) == 0 + Return .T. + endif +return .F. + + +METHOD sql_version() CLASS TMySQLServer +local nVer + nVer:=sqlversion(::nSocket) +return nVer + + + *METHOD SelectDB(cDBName) CLASS TMySQLServer * * if sqlSelectD(::nSocket, cDBName) == 0 @@ -1453,6 +1481,7 @@ return Self * *return .F. + *****************alterado METHOD SelectDB(cDBName) CLASS TMySQLServer @@ -1470,7 +1499,6 @@ METHOD SelectDB(cDBName) CLASS TMySQLServer return .F. - METHOD CreateDatabase ( cDataBase ) CLASS TMySQLServer local cCreateQuery := "CREATE DATABASE "+ lower(cDatabase) diff --git a/harbour/source/codepage/cdpsl437.c b/harbour/source/codepage/cdpsl437.c new file mode 100644 index 0000000000..6e9cac8611 --- /dev/null +++ b/harbour/source/codepage/cdpsl437.c @@ -0,0 +1,107 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * National Collation Support Module ( SL437 ) + * + * Copyright 2002 Alexander S.Kresin + * www - http://www.harbour-project.org + * 2003 Mitja Podgornik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Slovenian */ +/* ISO language code (2 chars): SL */ +/* Codepage: 437 */ + +#include +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the + alphabet, two-as-one aren't considered + here, accented - are considered. */ +#define IS_LATIN 1 /* Should be 1, if the national alphabet + is based on Latin */ +#define ACCENTED_EQUAL 0 /* Should be 1, if accented character + has the same weight as appropriate + unaccented. */ +#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters + sort after their unaccented counterparts + only if the unaccented versions of all + characters being compared are the same + ( interleaving ) */ + +/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the + accented characters with the symbol '~' before each of them, for example: + a~€ + If there is two-character sequence, which is considered as one, it should + be marked with '.' before and after it, for example: + ... h.ch.i ... + + The Upper case string and the Lower case string should be absolutely the + same excepting the characters case, of course. + */ + +static HB_CODEPAGE s_codepage = { "SL437", + CPID_437, UNITB_437, NUMBER_OF_CHARACTERS, + "ABC^]D\\EFGHIJKLMNOPQRS[TUVWZ@XY", + "abc~}d|efghijklmnopqrs{tuvwz`xy", + IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; + +HB_CODEPAGE_INIT( SL437 ); + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup hb_codepage_Init_SL437 +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SL437 = hb_codepage_Init_SL437; + #pragma data_seg() +#endif + diff --git a/harbour/source/codepage/cdpsl852.c b/harbour/source/codepage/cdpsl852.c new file mode 100644 index 0000000000..77ab20e5db --- /dev/null +++ b/harbour/source/codepage/cdpsl852.c @@ -0,0 +1,108 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * National Collation Support Module ( SL852 ) + * + * Copyright 2002 Alexander S.Kresin + * www - http://www.harbour-project.org + * 2003 Mitja Podgornik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Slovenian */ +/* ISO language code (2 chars): SL */ +/* Codepage: 852 */ + +#include +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the + alphabet, two-as-one aren't considered + here, accented - are considered. */ +#define IS_LATIN 1 /* Should be 1, if the national alphabet + is based on Latin */ +#define ACCENTED_EQUAL 0 /* Should be 1, if accented character + has the same weight as appropriate + unaccented. */ +#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters + sort after their unaccented counterparts + only if the unaccented versions of all + characters being compared are the same + ( interleaving ) */ + +/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the + accented characters with the symbol '~' before each of them, for example: + a~€ + If there is two-character sequence, which is considered as one, it should + be marked with '.' before and after it, for example: + ... h.ch.i ... + + The Upper case string and the Lower case string should be absolutely the + same excepting the characters case, of course. + */ + +static HB_CODEPAGE s_codepage = { "SL852", + CPID_852, UNITB_852, NUMBER_OF_CHARACTERS, + "ABC¬DÑEFGHIJKLMNOPQRSæTUVWZ¦XY", + "abcŸ†dÐefghijklmnopqrsçtuvwz§xy", + IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; + +HB_CODEPAGE_INIT( SL852 ); + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup hb_codepage_Init_SL852 +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SL852 = hb_codepage_Init_SL852; + #pragma data_seg() +#endif + + diff --git a/harbour/source/codepage/cdpsliso.c b/harbour/source/codepage/cdpsliso.c new file mode 100644 index 0000000000..a6162922bc --- /dev/null +++ b/harbour/source/codepage/cdpsliso.c @@ -0,0 +1,107 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * National Collation Support Module ( SLISO ) + * + * Copyright 2002 Alexander S.Kresin + * www - http://www.harbour-project.org + * 2003 Mitja Podgornik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Slovenian */ +/* ISO language code (2 chars): SL */ +/* Codepage: ISO-8859-2 */ + +#include +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the + alphabet, two-as-one aren't considered + here, accented - are considered. */ +#define IS_LATIN 1 /* Should be 1, if the national alphabet + is based on Latin */ +#define ACCENTED_EQUAL 0 /* Should be 1, if accented character + has the same weight as appropriate + unaccented. */ +#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters + sort after their unaccented counterparts + only if the unaccented versions of all + characters being compared are the same + ( interleaving ) */ + +/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the + accented characters with the symbol '~' before each of them, for example: + a~€ + If there is two-character sequence, which is considered as one, it should + be marked with '.' before and after it, for example: + ... h.ch.i ... + + The Upper case string and the Lower case string should be absolutely the + same excepting the characters case, of course. + */ + +static HB_CODEPAGE s_codepage = { "SLISO", + CPID_8859_2, UNITB_8859_2, NUMBER_OF_CHARACTERS, + "ABCÈÆDÐEFGHIJKLMNOPQRS©TUVWZ®XY", + "abcèædðefghijklmnopqrs¹tuvwz¾xy", + IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; + +HB_CODEPAGE_INIT( SLISO ); + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup hb_codepage_Init_SLISO +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SL852 = hb_codepage_Init_SLISO; + #pragma data_seg() +#endif + diff --git a/harbour/source/codepage/cdpslwin.c b/harbour/source/codepage/cdpslwin.c new file mode 100644 index 0000000000..a743909acd --- /dev/null +++ b/harbour/source/codepage/cdpslwin.c @@ -0,0 +1,107 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * National Collation Support Module ( SLWIN ) + * + * Copyright 2002 Alexander S.Kresin + * www - http://www.harbour-project.org + * 2003 Mitja Podgornik + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Slovenian */ +/* ISO language code (2 chars): SL */ +/* Codepage: 1250 */ + +#include +#include "hbapi.h" +#include "hbapicdp.h" + +#define NUMBER_OF_CHARACTERS 31 /* The number of single characters in the + alphabet, two-as-one aren't considered + here, accented - are considered. */ +#define IS_LATIN 1 /* Should be 1, if the national alphabet + is based on Latin */ +#define ACCENTED_EQUAL 0 /* Should be 1, if accented character + has the same weight as appropriate + unaccented. */ +#define ACCENTED_INTERLEAVED 0 /* Should be 1, if accented characters + sort after their unaccented counterparts + only if the unaccented versions of all + characters being compared are the same + ( interleaving ) */ + +/* If ACCENTED_EQUAL or ACCENTED_INTERLEAVED is 1, you need to mark the + accented characters with the symbol '~' before each of them, for example: + a~€ + If there is two-character sequence, which is considered as one, it should + be marked with '.' before and after it, for example: + ... h.ch.i ... + + The Upper case string and the Lower case string should be absolutely the + same excepting the characters case, of course. + */ + +static HB_CODEPAGE s_codepage = { "SLWIN", + CPID_1250, UNITB_1250, NUMBER_OF_CHARACTERS, + "ABCÈÆDÐEFGHIJKLMNOPQRSŠTUVWZŽXY", + "abcèædðefghijklmnopqrsštuvwzžxy", + IS_LATIN, ACCENTED_EQUAL, ACCENTED_INTERLEAVED, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; + +HB_CODEPAGE_INIT( SLWIN ); + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup hb_codepage_Init_SLWIN +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto_hb_codepage_Init_SLWIN = hb_codepage_Init_SLWIN; + #pragma data_seg() +#endif +