2002-08-17 21:05 UTC+0100 Tomaz Zupan <tomaz.zupan@orpo.si>

This commit is contained in:
Tomaz Zupan
2002-08-17 19:12:12 +00:00
parent 8183a575f6
commit 93fa32b1e0
3 changed files with 34 additions and 6 deletions

View File

@@ -8,6 +8,14 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2002-08-17 21:05 UTC+0100 Tomaz Zupan <tomaz.zupan@orpo.si>
* contrib/odbc/odbc.c
+ Added SQLConnect function
* contrib/odbc/todbc.prg
+ Method new() now accepts additional parameters username and password.
If TODBC:new() is called with username and password, it uses
SQLConnect insted of SQLDriverConnect to establish ODBC conenction.
2002-08-15 17:40 UTC-0300 Luiz Rafael Culik <culikr@uol.com.br>
* source/rtl/memoedit.prg
* When User function is Defined , Make ALT+W key exit the Editing windows if not redefined inside the UDF function

View File

@@ -118,6 +118,18 @@ HB_FUNC( SQLDRIVERC ) /* HB_SQLDRIVERCONNECT( hDbc, @ cConnectString, lPrompt )
hb_storc( bBuffer1 , 3 );
hb_retni( ret );
}
HB_FUNC( SQLCONNECT ) /* HB_SQLCONNECT( hDbc, @ cServerName, nNameLength1, @cUserName, nNameLength2, @cPassword, nNameLength3 ) --> nRetCode */
{
RETCODE ret = SQLConnect( ( HDBC ) hb_parnl( 1 ),
hb_parc( 2 ),
strlen(hb_parc(2)),
hb_parc( 3 ),
strlen(hb_parc(3)),
hb_parc( 4 ),
strlen(hb_parc(4)));
hb_retni( ret );
}
HB_FUNC( SQLDISCONN ) /* HB_SQLDISCONNECT( hDbc ) --> nRetCode */
{

View File

@@ -155,10 +155,13 @@ METHOD SQLErrorMessage() CLASS TODBC
RETURN( "Error " + cErrorClass + " - " + cErrorMsg )
// New instance of TODBC
METHOD New( cODBCStr ) CLASS TODBC
METHOD New( cODBCStr, cUserName, cPassword ) CLASS TODBC
LOCAL xBuf
LOCAL nRet
IF cUserName != NIL
DEFAULT cPassword TO ""
ENDIF
// WHILE .t.
::cODBCStr := cODBCStr
@@ -183,9 +186,15 @@ METHOD New( cODBCStr ) CLASS TODBC
SQLAllocCo( ::hEnv, @xBuf ) // Allocates SQL Connection
::hDbc := xBuf
SQLDriverC( ::hDbc, ::cODBCStr, @xBuf ) // Connects to Driver
::cODBCRes := xBuf
IF cUserName == NIL
SQLDriverC( ::hDbc, ::cODBCStr, @xBuf ) // Connects to Driver
::cODBCRes := xBuf
ELSE
IF .not. ( (nRet := SQLConnect( ::hDbc, cODBCStr, cUserName, cPassword)) == SQL_SUCCESS )
//TODO: Some error here
ENDIF
ENDIF
// ENDDO
RETURN ( Self )
@@ -289,7 +298,6 @@ METHOD Open() CLASS TODBC
// Sets the Dataset state to active and put cursor on first record
::Active := .t.
::First()
EXIT