diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c4572eb497..35b88cb5c4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-01-21 16:42 UTC+0100 Lorenzo Fiorini (lorenzo.fiorini/at/gmail.com) + * contrib/hbpgsql/tests/simple.prg + * contrib/hbpgsql/tests/async.prg + * contrib/hbpgsql/tests/cache.prg + * contrib/hbpgsql/tests/stress.prg + * contrib/hbpgsql/tests/dbf2pg.prg + * general cleanup for Harbour + * fix of function and method names, removed hard wired uid and pwd + * contrib/hbtip/utils.c + * added new mime types like flash files, rtf, csv + 2009-01-21 10:43 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * include/hbextern.ch + Added new .prg functions. diff --git a/harbour/contrib/hbpgsql/tests/async.prg b/harbour/contrib/hbpgsql/tests/async.prg index 60d61880a3..7074077f4a 100644 --- a/harbour/contrib/hbpgsql/tests/async.prg +++ b/harbour/contrib/hbpgsql/tests/async.prg @@ -5,12 +5,12 @@ * */ -Function main() +Function Main( cServer, cDatabase, cUser, cPass ) Local conn CLEAR SCREEN - ? "Connect", conn := PQConnect('test', 'localhost', 'user', 'pass', 5432) + ? "Connect", conn := PQConnect( cDatabase, cServer, cUser, cPass, 5432) ? "Conection status", PQerrorMessage(conn), PQstatus(conn) @@ -56,7 +56,7 @@ Procedure Query( conn, cQuery, lCancel ) enddo if inkey() != 27 - ? "PQgetResult", valtoprg(res := PQgetResult(conn)) + ? "PQgetResult", hb_valtoexp(res := PQgetResult(conn)) for x := 1 to PQlastrec(res) ? @@ -69,4 +69,4 @@ Procedure Query( conn, cQuery, lCancel ) else ? "Canceling Query", PQrequestCancel(conn) endif -Return \ No newline at end of file +Return diff --git a/harbour/contrib/hbpgsql/tests/cache.prg b/harbour/contrib/hbpgsql/tests/cache.prg index fa8b9b8d55..f3233a967c 100644 --- a/harbour/contrib/hbpgsql/tests/cache.prg +++ b/harbour/contrib/hbpgsql/tests/cache.prg @@ -43,14 +43,14 @@ STATIC oServer STATIC aTableTemp := {} STATIC aTempDBF := {} -Function Main() +Function Main( cServer, cDatabase, cUser, cPass ) Local i Local cQuery Local conn, res SetMode( 25, 80 ) - if SQLConnect( '127.0.0.1', 'test', 'sysadm', 'masterkey' ) + if SQLConnect( cServer, cDatabase, cUser, cPass ) QuickQuery('DROP TABLE test') cQuery := 'CREATE TABLE test ( ' @@ -145,7 +145,7 @@ Function SQLApplyUpdates() oQuery:Append(oRow) - cError := oQuery:Error() + cError := oQuery:ErrorMsg() lError := oQuery:NetErr() @@ -165,7 +165,7 @@ Function SQLApplyUpdates() oQuery:Delete(oRow) - cError := oQuery:Error() + cError := oQuery:ErrorMsg() lError := oQuery:NetErr() @@ -197,7 +197,7 @@ Function SQLApplyUpdates() oQuery:Update(oRow) - cError := oQuery:Error() + cError := oQuery:ErrorMsg() lError := oQuery:NetErr() @@ -366,7 +366,7 @@ Function SQLOpen( cAlias, cQuery, xFetch ) oQuery := oServer:Query(cQuery) IF oQuery:NetErr() - Alert(oQuery:Error()) + Alert(oQuery:ErrorMsg()) RETURN .F. END @@ -423,7 +423,7 @@ Function SQLConnect( cServer, cDatabase, cUser, cPassword, cSchema ) oServer := TPQServer():New(cServer, cDatabase, cUser, cPassWord, 5432, cSchema) if oServer:NetErr() - Alert(oServer:Error()) + Alert(oServer:ErrorMsg()) lRetval := .f. end oServer:lAllCols := .F. @@ -446,7 +446,7 @@ Function SQLQuery( cQuery ) oQuery := oServer:Query(cQuery) IF oQuery:NetErr() - Alert(cQuery + ':' + oQuery:Error()) + Alert(cQuery + ':' + oQuery:ErrorMsg()) END Return oQuery @@ -457,7 +457,7 @@ Function SQLExecQuery( cQuery ) oQuery := oServer:Query(cQuery) IF oQuery:NetErr() - Alert('Nao foi possível executar ' + cQuery + ':' + oQuery:Error()) + Alert('Nao foi possível executar ' + cQuery + ':' + oQuery:ErrorMsg()) result := .F. @@ -496,7 +496,7 @@ Function SQLPrepare( cQuery, x01, x02, x03, x04, x05, x06, x07, x08, x09, x10,; /* Substitui parametros por valores passados */ for i := 2 to PCount() - x := PValue(i) + x := hb_PValue(i) if ! ISNIL(x) .and. Empty(x) x := 'null' diff --git a/harbour/contrib/hbpgsql/tests/dbf2pg.prg b/harbour/contrib/hbpgsql/tests/dbf2pg.prg index 14557d8abe..4f97a69498 100644 --- a/harbour/contrib/hbpgsql/tests/dbf2pg.prg +++ b/harbour/contrib/hbpgsql/tests/dbf2pg.prg @@ -94,26 +94,26 @@ procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, // Scan parameters and setup workings while (i <= PCount()) - cTok := PValue(i++) + cTok := hb_PValue(i++) do case case cTok == "-h" - cHostName := PValue(i++) + cHostName := hb_PValue(i++) case cTok == "-d" - cDataBase := PValue(i++) + cDataBase := hb_PValue(i++) case cTok == "-t" - cTable := PValue(i++) + cTable := hb_PValue(i++) case cTok == "-f" - cFile := PValue(i++) + cFile := hb_PValue(i++) case cTok == "-u" - cUser := PValue(i++) + cUser := hb_PValue(i++) case cTok == "-p" - cPassWord := PValue(i++) + cPassWord := hb_PValue(i++) case cTok == "-c" lCreateTable := .T. @@ -125,13 +125,13 @@ procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, lUseTrans := .T. case cTok == "-m" - nCommit := val(PValue(i++)) + nCommit := val(hb_PValue(i++)) case cTok == "-r" - nRecno := val(PValue(i++)) + nRecno := val(hb_PValue(i++)) case cTok == "-e" - cPath := PValue(i++) + cPath := hb_PValue(i++) otherwise help() @@ -150,7 +150,7 @@ procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, oServer := TPQServer():New(cHostName, cDatabase, cUser, cPassWord, nil, cPath) if oServer:NetErr() - ? oServer:Error() + ? oServer:ErrorMsg() quit endif @@ -160,8 +160,8 @@ procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, if oServer:TableExists(cTable) oServer:DeleteTable(cTable) if oServer:NetErr() - ? oServer:Error() - FWrite( nHandle, "Error: " + oServer:Error() + CRLF ) + ? oServer:ErrorMsg() + FWrite( nHandle, "Error: " + oServer:ErrorMsg() + CRLF ) FClose( nHandle ) quit endif @@ -169,8 +169,8 @@ procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, oServer:CreateTable(cTable, aDbfStruct) if oServer:NetErr() - ? oServer:Error() - FWrite( nHandle, "Error: " + oServer:Error() + CRLF ) + ? oServer:ErrorMsg() + FWrite( nHandle, "Error: " + oServer:ErrorMsg() + CRLF ) FClose( nHandle ) quit endif @@ -179,8 +179,8 @@ procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, if lTruncate oServer:Execute('truncate table ' + cTable) if oServer:NetErr() - ? oServer:Error() - FWrite( nHandle, "Error: " + oServer:Error() + CRLF ) + ? oServer:ErrorMsg() + FWrite( nHandle, "Error: " + oServer:ErrorMsg() + CRLF ) FClose( nHandle ) quit endif @@ -188,8 +188,8 @@ procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, oTable := oServer:Query("SELECT * FROM " + cTable + " LIMIT 1") if oTable:NetErr() - Alert(oTable:Error()) - FWrite( nHandle, "Error: " + oTable:Error() + CRLF ) + Alert(oTable:ErrorMsg()) + FWrite( nHandle, "Error: " + oTable:ErrorMsg() + CRLF ) FClose( nHandle ) quit endif @@ -265,9 +265,9 @@ procedure main(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, if oTable:NetErr() ? - ? "Error Record: ", recno(), left(oTable:Error(),70) + ? "Error Record: ", recno(), left(oTable:ErrorMsg(),70) ? - FWrite( nHandle, "Error at record: " + Str(recno()) + " Description: " + oTable:Error() + CRLF ) + FWrite( nHandle, "Error at record: " + Str(recno()) + " Description: " + oTable:ErrorMsg() + CRLF ) else nCount++ endif diff --git a/harbour/contrib/hbpgsql/tests/simple.prg b/harbour/contrib/hbpgsql/tests/simple.prg index 1584f2954d..82145c2776 100644 --- a/harbour/contrib/hbpgsql/tests/simple.prg +++ b/harbour/contrib/hbpgsql/tests/simple.prg @@ -6,13 +6,9 @@ #include "common.ch" -Function main() - Local oServer, oQuery, oRow, i, x, aTables, aStruct, aKey +Function main( cHost, cDatabase, cUser, cPass ) + Local oServer, oQuery, oRow, i, x, aTables, aStruct - Local cHost := 'localhost' - Local cDatabase := 'test' - Local cUser := 'user' - Local cPass := 'pass' Local cQuery oServer := TPQServer():New(cHost, cDatabase, cUser, cPass) @@ -99,9 +95,7 @@ Function main() ? aStruct[i,1], aStruct[i,2], aStruct[i,3], aStruct[i,4] Next - aKey := oQuery:GetKeyField() - - ? "Fields: ", oQuery:Fcount(), "Primary Key: ", aKey[1] + ? "Fields: ", oQuery:Fcount() oRow := oQuery:Blank() @@ -122,7 +116,7 @@ Function main() ? oQuery:Append(oRow) - ? oQuery:error() + ? oQuery:ErrorMsg() DO WHILE ! oQuery:Eof() ? oQuery:Recno(),; diff --git a/harbour/contrib/hbpgsql/tests/stress.prg b/harbour/contrib/hbpgsql/tests/stress.prg index 042cb4d243..9c53f3f900 100644 --- a/harbour/contrib/hbpgsql/tests/stress.prg +++ b/harbour/contrib/hbpgsql/tests/stress.prg @@ -9,13 +9,9 @@ #include "common.ch" #include "../postgres.ch" -Function Main() +Function Main( cServer, cDatabase, cUser, cPass ) Local conn, res, oRow, i, x - Local cServer := '192.168.1.20' - Local cDatabase := 'test' - Local cUser := 'rodrigo' - Local cPass := 'moreno' Local cQuery CLEAR SCREEN diff --git a/harbour/contrib/hbtip/utils.c b/harbour/contrib/hbtip/utils.c index b12c560212..e017a80b25 100644 --- a/harbour/contrib/hbtip/utils.c +++ b/harbour/contrib/hbtip/utils.c @@ -226,7 +226,7 @@ typedef struct tag_mime #define MIME_FLAG_TRIMTABS 0x0002 #define MIME_FLAG_CASEINSENS 0x0004 #define MIME_FLAG_CONTINUE 0x0008 -#define MIME_TABLE_SIZE 68 +#define MIME_TABLE_SIZE 72 static MIME_ENTRY s_mimeTable[ MIME_TABLE_SIZE ] = { @@ -336,7 +336,19 @@ static MIME_ENTRY s_mimeTable[ MIME_TABLE_SIZE ] = /* 66*/ { 0, "\xFF\xD8", "image/jpeg", 0, 0, 0 }, /* ICO image */ - /* 67*/ { 2, "\x01\x00", "image/x-icon", 0, 0, 0 } + /* 67*/ { 2, "\x01\x00", "image/x-icon", 0, 0, 0 }, + + /* OGG file */ + /* 68*/ { 0, "OggS", "application/ogg", 0, 0, 0 }, + + /* FLV file */ + /* 69*/ { 0, "FLV", "video/x-flv", 0, 0, 0 }, + + /* SWF compressed file */ + /* 70*/ { 0, "CWS", "application/x-shockwave-flash", 0, 0, 0 }, + + /* SWF uncompressed file */ + /* 71*/ { 0, "FWS", "application/x-shockwave-flash", 0, 0, 0 } }; @@ -352,7 +364,7 @@ typedef struct tag_mime_ext short unsigned int flags; } EXT_MIME_ENTRY; -#define EXT_MIME_TABLE_SIZE 16 +#define EXT_MIME_TABLE_SIZE 19 static EXT_MIME_ENTRY s_extMimeTable[EXT_MIME_TABLE_SIZE] = { @@ -363,6 +375,9 @@ static EXT_MIME_ENTRY s_extMimeTable[EXT_MIME_TABLE_SIZE] = /* 1*/ { "HTM", "text/html", MIME_FLAG_CASEINSENS }, /* 2*/ { "HTML", "text/html", MIME_FLAG_CASEINSENS }, + /* XLS file */ + /* 3*/ { "xls", "application/vnd.ms-excel", MIME_FLAG_CASEINSENS }, + /* XML file */ /* 4*/ { "XML", "text/xml", MIME_FLAG_CASEINSENS }, @@ -376,17 +391,24 @@ static EXT_MIME_ENTRY s_extMimeTable[EXT_MIME_TABLE_SIZE] = /* 7*/ { "ps", "application/postscript", MIME_FLAG_CASEINSENS }, /* C source */ - /* 7*/ { "c", "text/x-c", MIME_FLAG_CASEINSENS }, - /* 8*/ { "c++", "text/x-c++", MIME_FLAG_CASEINSENS }, - /* 9*/ { "cpp", "text/x-c++", MIME_FLAG_CASEINSENS }, - /* 10*/ { "cxx", "text/x-c++", MIME_FLAG_CASEINSENS }, - /* 11*/ { "h", "text/x-c-header", MIME_FLAG_CASEINSENS }, - /* 12*/ { "hpp", "text/x-c++-header", MIME_FLAG_CASEINSENS }, - /* 13*/ { "hxx", "text/x-c++-header", MIME_FLAG_CASEINSENS }, + /* 8*/ { "c", "text/x-c", MIME_FLAG_CASEINSENS }, + /* 9*/ { "c++", "text/x-c++", MIME_FLAG_CASEINSENS }, + /* 10*/ { "cpp", "text/x-c++", MIME_FLAG_CASEINSENS }, + /* 11*/ { "cxx", "text/x-c++", MIME_FLAG_CASEINSENS }, + /* 12*/ { "h", "text/x-c-header", MIME_FLAG_CASEINSENS }, + /* 13*/ { "hpp", "text/x-c++-header", MIME_FLAG_CASEINSENS }, + /* 14*/ { "hxx", "text/x-c++-header", MIME_FLAG_CASEINSENS }, /* Java */ - /* 14*/ { "class", "application/java", 0 }, /* case sensitive! */ - /* 15*/ { "java", "text/java", 0 } + /* 15*/ { "class", "application/java", 0 }, /* case sensitive! */ + /* 16*/ { "java", "text/java", 0 }, + + /* RTF file */ + /* 17*/ { "rtf", "application/rtf", MIME_FLAG_CASEINSENS }, + + /* CSV file */ + /* 18*/ { "csv", "text/csv", MIME_FLAG_CASEINSENS } + };