2000-10-30 18:51 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2000-10-30 18:51 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
|
||||
* contrib/mysql/*
|
||||
* little changes chasing a bug :-|
|
||||
|
||||
2000-10-27 18:05 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
|
||||
* contrib/mysql/tmysql.prg
|
||||
* contrib/mysql/tsqlbrw.prg
|
||||
|
||||
@@ -55,6 +55,8 @@ HB_FUNC(SQLCONNECT) // MYSQL *mysql_real_connect(MYSQL*, char * host, char * use
|
||||
{
|
||||
MYSQL * mysql = NULL;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("mysql_real_connect(%s, %s, %s)", _parc(1), _parc(2), _parc(3)));
|
||||
|
||||
#if MYSQL_VERSION_ID > 32200
|
||||
/* from 3.22.x of MySQL there is a new parameter in mysql_real_connect() call, that is char * db
|
||||
which is not used here */
|
||||
@@ -77,12 +79,16 @@ HB_FUNC(SQLCLOSE) // void mysql_close(MYSQL *mysql)
|
||||
|
||||
HB_FUNC(SQLSELECTD) // int mysql_select_db(MYSQL *, char *)
|
||||
{
|
||||
_retnl(mysql_select_db((MYSQL *)_parnl(1), _parc(2)));
|
||||
HB_TRACE(HB_TR_DEBUG, ("mysql_select_db(%lu, %s)", _parnl(1), _parc(2)));
|
||||
|
||||
_retnl((long) mysql_select_db((MYSQL *)_parnl(1), _parc(2)));
|
||||
}
|
||||
|
||||
|
||||
HB_FUNC(SQLQUERY) // int mysql_query(MYSQL *, char *)
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("mysql_query(%lu, %s)", _parnl(1), _parc(2)));
|
||||
|
||||
_retnl((long) mysql_query((MYSQL *)_parnl(1), _parc(2)));
|
||||
}
|
||||
|
||||
|
||||
@@ -282,30 +282,45 @@ METHOD New(nSocket, cQuery) CLASS TMySQLQuery
|
||||
|
||||
local nI, aField, rc
|
||||
|
||||
::aFieldStruct := {}
|
||||
::nSocket := nSocket
|
||||
::cQuery := cQuery
|
||||
::nCurRow := 1
|
||||
|
||||
::lError := .F.
|
||||
::aFieldStruct := {}
|
||||
::nCurRow := 1
|
||||
::nResultHandle := nil
|
||||
::nNumFields := 0
|
||||
::nNumRows := 0
|
||||
|
||||
if (rc := sqlQuery(nSocket, cQuery)) == 0
|
||||
|
||||
// save result set
|
||||
::nResultHandle := sqlStoreR(nSocket)
|
||||
::nNumRows := sqlNRows(::nResultHandle)
|
||||
::nNumFields := sqlNumFi(::nResultHandle)
|
||||
if (::nResultHandle := sqlStoreR(nSocket)) > 0
|
||||
|
||||
for nI := 1 to ::nNumFields
|
||||
::nNumRows := sqlNRows(::nResultHandle)
|
||||
::nNumFields := sqlNumFi(::nResultHandle)
|
||||
|
||||
aField := sqlFetchF(::nResultHandle)
|
||||
AAdd(::aFieldStruct, aField)
|
||||
for nI := 1 to ::nNumFields
|
||||
|
||||
next
|
||||
aField := sqlFetchF(::nResultHandle)
|
||||
AAdd(::aFieldStruct, aField)
|
||||
|
||||
next
|
||||
|
||||
else
|
||||
// Should query have returned rows? (Was it a SELECT like query?)
|
||||
|
||||
if (::nNumFields := sqlNumFi(nSocket)) == 0
|
||||
|
||||
// Was not a SELECT so reset ResultHandle changed by previous sqlStoreR()
|
||||
::nResultHandle := nil
|
||||
|
||||
else
|
||||
::lError := .T.
|
||||
|
||||
endif
|
||||
endif
|
||||
else
|
||||
::nResultHandle := nil
|
||||
::nNumFields := 0
|
||||
::nNumRows := 0
|
||||
::lError := .T.
|
||||
|
||||
endif
|
||||
|
||||
@@ -148,8 +148,7 @@ METHOD New(nTop, nLeft, nBottom, nRight, oServer, oQuery, cTable) CLASS TBrowseS
|
||||
::oQuery := oQuery
|
||||
|
||||
// Let's get a row to build needed columns
|
||||
::oCurRow := ::oQuery:GetRow()
|
||||
::oQuery:Skip(-1)
|
||||
::oCurRow := ::oQuery:GetRow(1)
|
||||
|
||||
// positioning blocks
|
||||
::SkipBlock := {|n| ::oCurRow := Skipper(@n, ::oQuery), n }
|
||||
|
||||
Reference in New Issue
Block a user