diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 997ddcae95..2eb962a1bd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,18 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2002-11-20 21:45 UTC-0300 Luiz Rafael Culik + * source/pp/pptable.c + + COLOR parameter to @...PROMPT + * source/rtl/menuto.prg + ! Added code to use the passed Color to the Prompt.This will allow + to make Color menus and Was Far Requested since this feature is an Alaska,Flagship and Max compiler + * tests/menuto.prg + * Changes the Test to Show the ability of menu items in colors + * contrib/mysql/tmysql.prg + * On method GetRow(nRow) of TMySQLQuery fixed Handling of Date + Retrived(The date is formated on Current SET DATE FORMAT) + 2002-11-20 21:56 UTC+0300 Alexander Kresin * source/codepage/cdppl852.c * source/codepage/cdppliso.c diff --git a/harbour/contrib/mysql/tmysql.prg b/harbour/contrib/mysql/tmysql.prg index 6a254610d3..9fa8de55a5 100644 --- a/harbour/contrib/mysql/tmysql.prg +++ b/harbour/contrib/mysql/tmysql.prg @@ -453,6 +453,7 @@ METHOD GetRow(nRow) CLASS TMySQLQuery local aRow := NIL local oRow := NIL + local cFormatoDaData := set(4) //ACRESCENTEI local i default nRow to 0 @@ -490,10 +491,38 @@ METHOD GetRow(nRow) CLASS TMySQLQuery case ::aFieldStruct[i][MYSQL_FS_TYPE] == MYSQL_DATE_TYPE if Empty(aRow[i]) aRow[i] := CToD("") - else + *else // Date format YYYY-MM-DD - aRow[i] := CToD(SubStr(aRow[i], 6, 2) + "/" + Right(aRow[i], 2) + "/" + Left(aRow[i], 4)) - endif + + * abaixo presume que o se utiliza (set date USA) + * aRow[i] := CToD(SubStr(aRow[i], 6, 2) + "/" + Right(aRow[i], 2) + "/" + Left(aRow[i], 4)) + + elseif cFormatoDaData = 'mm-dd-yyyy' // USA + aRow[i] := ctod(substr(aRow[i],6,2)+"-"+right(aRow[i],2,0)+ "-" + Left(aRow[i], 4)) + + elseif cFormatoDaData = 'dd/mm/yyyy' // BRITISH ou FRENCH + aRow[i] := ctod(right(aRow[i],2,0)+ "/"+ substr(aRow[i],6,2)+"/"+ Left(aRow[i], 4)) + + elseif cFormatoDaData = 'yyyy.mm.dd' // ANSI + aRow[i] := ctod(Left(aRow[i], 4)+ "."+substr(aRow[i],6,2)+"."+right(aRow[i],2,0)) + + elseif cFormatoDaData = 'dd.mm.yyyy' //GERMAN + aRow[i] :=ctod(right(aRow[i],2,0)+ "."+ substr(aRow[i],6,2)+"."+ Left(aRow[i], 4 )) + + elseif cFormatoDaData = 'dd-mm-yyyy' //ITALIAN + aRow[i] :=ctod(right(aRow[i],2,0)+ "-"+ substr(aRow[i],6,2)+"-"+ Left(aRow[i], 4)) + + elseif cFormatoDaData = 'yyyy/mm/dd' //JAPAN + aRow[i] := ctod(Left(aRow[i], 4)+ "/"+substr(aRow[i],6,2)+"/"+right(aRow[i],2,0)) + + elseif cFormatoDaData = 'mm/dd/yyyy' // AMERICAN + aRow[i] := ctod(substr(aRow[i],6,2)+"/"+right(aRow[i],2,0)+ "/" + Left(aRow[i], 4)) + else + aRow[i] := "''" + endif + + + case ::aFieldStruct[i][MYSQL_FS_TYPE] == MYSQL_BLOB_TYPE // Memo field @@ -773,18 +802,35 @@ METHOD Destroy() CLASS TMySQLServer return Self +*METHOD SelectDB(cDBName) CLASS TMySQLServer +* +* if sqlSelectD(::nSocket, cDBName) == 0 +* ::cDBName := cDBName +* return .T. +* else +* ::cDBName := "" +* endif +* +*return .F. + +*****************alterado METHOD SelectDB(cDBName) CLASS TMySQLServer - if sqlSelectD(::nSocket, cDBName) == 0 - ::cDBName := cDBName + ::lError := .F. + + if sqlSelectD(::nSocket, cDBName) != 0 && tabela nao existe + ::cDBName :="" + ::lError := .T. + else && tabela existe + ::cDBName :=cDBName + ::lError := .F. return .T. - else - ::cDBName := "" endif return .F. + METHOD CreateDatabase ( cDataBase ) CLASS TMySQLServer local cCreateQuery := "CREATE DATABASE "+ lower(cDatabase) @@ -1063,7 +1109,7 @@ return aStruct static function ClipValue2SQL(Value) local cValue := "" - + local cFormatoDaData := set(4) do case case Valtype(Value) == "N" cValue := AllTrim(Str(Value)) @@ -1071,7 +1117,27 @@ static function ClipValue2SQL(Value) case Valtype(Value) == "D" if !Empty(Value) // MySQL dates are like YYYY-MM-DD - cValue := "'" + Str(Year(Value), 4) + "-" + PadL(Month(Value), 2, "0") + "-" + PadL(Day(Value), 2, "0") + "'" + if cFormatoDaData = 'mm-dd-yyyy' // USA + cValue := "'"+PadL(Month(Value), 2, "0") + '-'+ PadL(Day(Value), 2, "0") + "-" + Str(Year(Value), 4) + "'" + + elseif cFormatoDaData = 'dd/mm/yyyy' // BRITISH ou FRENCH + cValue := "'"+PadL(Day(Value), 2, "0") + "/" + PadL(Month(Value), 2, "0") + "/" + Str(Year(Value), 4) + "'" + + elseif cFormatoDaData = 'yyyy.mm.dd' // ANSI + cValue := "'"+Str(Year(Value), 4) + "." + PadL(Month(Value), 2, "0") + "." + PadL(Day(Value), 2, "0") + "'" + + elseif cFormatoDaData = 'dd.mm.yyyy' //GERMAN + cValue := "'"+PadL(Day(Value), 2, "0") + "." + PadL(Month(Value), 2, "0") + "." + Str(Year(Value), 4) + "'" + + elseif cFormatoDaData = 'dd-mm-yyyy' //ITALIAN + cValue := "'"+PadL(Day(Value), 2, "0") + "-" + PadL(Month(Value), 2, "0") + "-" + Str(Year(Value), 4) + "'" + + elseif cFormatoDaData = 'yyyy/mm/dd' //JAPAN + cValue := "'"+Str(Year(Value), 4) + "/" + PadL(Month(Value), 2, "0") + "/" + PadL(Day(Value), 2, "0") + "'" + + elseif cFormatoDaData = 'mm/dd/yyyy' // AMERICAN + cValue := "'"+Str(Year(Value), 4) + "/" + PadL(Month(Value), 2, "0") + "/" + PadL(Day(Value), 2, "0") + "'" + endif else cValue := "''" endif diff --git a/harbour/source/pp/pptable.c b/harbour/source/pp/pptable.c index b2fdd68caf..c25a888b50 100644 --- a/harbour/source/pp/pptable.c +++ b/harbour/source/pp/pptable.c @@ -248,8 +248,8 @@ void hb_pp_Table( void ) static COMMANDS sC___109 = {0,"SET","MESSAGE TO \1A00 [\1B20 CENTER, CENTRE>]", "Set( _SET_MESSAGE, \1A00 ) ; Set( _SET_MCENTER, \1B50 )",&sC___108 }; static COMMANDS sC___110 = {0,"SET","MESSAGE TO","Set( _SET_MESSAGE, 0 ) ; Set( _SET_MCENTER, .f. )",&sC___109 }; - static COMMANDS sC___111 = {0,"@","\1A00, \1B00 PROMPT \1C00 [MESSAGE \1D00]", - "__AtPrompt( \1A00, \1B00, \1C00 , \1D00 )",&sC___110 }; + static COMMANDS sC___111 = {0,"@","\1A00, \1B00 PROMPT \1C00 [MESSAGE \1D00] [COLOR \1E00]", + "__AtPrompt( \1A00, \1B00, \1C00 , \1D00 , \1E00 )",&sC___110 }; static COMMANDS sC___112 = {0,"MENU","TO \1A00","\1A00 := __MenuTo( {|_1| if(PCount() == 0, \1A00, \1A00 := _1)}, \1A10 )",&sC___111 }; static COMMANDS sC___113 = {0,"SAVE","SCREEN","__XSaveScreen()",&sC___112 }; static COMMANDS sC___114 = {0,"RESTORE","SCREEN","__XRestScreen()",&sC___113 }; diff --git a/harbour/source/rtl/menuto.prg b/harbour/source/rtl/menuto.prg index f113cc48fe..e24a5cc264 100644 --- a/harbour/source/rtl/menuto.prg +++ b/harbour/source/rtl/menuto.prg @@ -18,11 +18,12 @@ #include "inkey.ch" #include "hbmemvar.ch" #include "setcurs.ch" +#xtranslate COLORARRAY() => &( '{"' + strtran(, ',', '","') + '"}' ) static s_aLevel := {} static s_nPointer := 1 -function __AtPrompt( nRow, nCol, cPrompt, cMsg ) +function __AtPrompt( nRow, nCol, cPrompt, cMsg, cColor ) if s_nPointer < 1 s_nPointer := 1 @@ -34,10 +35,10 @@ function __AtPrompt( nRow, nCol, cPrompt, cMsg ) enddo // add to the static array - aadd( s_aLevel[ s_nPointer ], { nRow, nCol, cPrompt, cMsg } ) + aadd( s_aLevel[ s_nPointer ], { nRow, nCol, cPrompt, cMsg, cColor} ) // put this prompt on the screen right now - DispOutAt( nRow, nCol, cPrompt ) + DispOutAt( nRow, nCol, cPrompt, if( cColor <> NIL , cColor, NIL ) ) return .f. @@ -61,6 +62,7 @@ function __MenuTo( bBlock, cVariable ) local nMouseClik local nPointer + Local aColor // Detect if a memvar was passed @@ -138,17 +140,23 @@ function __MenuTo( bBlock, cVariable ) // save the current row q := n + if s_aLevel[ s_nPointer-1,n,5] <> nil + aColor := COLORARRAY( s_aLevel[ s_nPointer-1,n,5] ) + endif + if Set( _SET_INTENSITY ) - ColorSelect( CLR_ENHANCED ) + if( aColor <> Nil , aColor[ 2 ] , ColorSelect( CLR_ENHANCED ) ) endif // highlight the prompt DispOutAt( s_aLevel[ nPointer - 1, n, 1 ],; s_aLevel[ nPointer - 1, n, 2 ],; - s_aLevel[ nPointer - 1, n, 3 ] ) + s_aLevel[ nPointer - 1, n, 3 ],; + if(aColor <> NIL, acolor[ 2 ], NIL ) ) if Set( _SET_INTENSITY ) - ColorSelect( CLR_STANDARD ) + //ColorSelect( CLR_STANDARD ) + if( aColor<> Nil , aColor[ 1 ] , ColorSelect( CLR_STANDARD ) ) endif if lExit @@ -219,7 +227,8 @@ function __MenuTo( bBlock, cVariable ) if n <> 0 DispOutAt( s_aLevel[ nPointer - 1, q, 1 ],; s_aLevel[ nPointer - 1, q, 2 ],; - s_aLevel[ nPointer - 1, q, 3 ] ) + s_aLevel[ nPointer - 1, q, 3 ],; + if( aColor <> NIL , aColor[ 1 ] , nil ) ) endif enddo