- Code: Select all Expand view
If ::LineCount(.F.) == -1
::lOpened := .F.
::RuntimeErr( "27", SR_Msg(27) , 2, EG_OPEN, ESQLRDD_OPEN )
Return Self
EndIf
el codigo de LineCount
- Code: Select all Expand view
METHOD LineCount( lMsg ) CLASS SR_WORKAREA
Local nRet := 0, aRet := {}
DEFAULT lMsg := .T.
If ::lISAM
If nLineCountResult == 0
Switch ::oSql:nSystemID
Case SYSTEMID_POSTGR
::oSql:exec("SELECT " + SR_DBQUALIFY( ::cRecnoName, SYSTEMID_POSTGR) + " FROM " + ::cQualifiedTableName + " ORDER BY " + SR_DBQUALIFY( ::cRecnoName, ::oSql:nSystemID ) + " DESC LIMIT 1" + iif(::oSql:lComments, " /* Counting Records */", ""), lMsg, .t., @aRet)
Exit
Case SYSTEMID_FIREBR
::oSql:exec("SELECT gen_id("+::cFileName+",0) FROM RDB$DATABASE", .F., .T., @aRet)
Exit
Case SYSTEMID_CACHE
::oSql:exec("SELECT TOP 1 " + SR_DBQUALIFY(::cRecnoName, SYSTEMID_CACHE) + " FROM " + ::cOwner + ::cFileName + " ORDER BY " + SR_DBQUALIFY( ::cRecnoName, ::oSql:nSystemID ) + " DESC", lMsg, .t., @aRet)
Exit
Default
::oSql:exec("SELECT MAX( " + SR_DBQUALIFY( ::cRecnoName, ::oSql:nSystemID ) + " ) FROM " + ::cQualifiedTableName + iif(::oSql:lComments, " /* Counting Records */", ""), lMsg, .t., @aRet)
End
If Len(aRet) > 0 .and. valtype(aRet[1,1]) != "N"
::oSql:exec("SELECT COUNT( " + SR_DBQUALIFY( ::cRecnoName, ::oSql:nSystemID ) + " ) FROM " + ::cQualifiedTableName + iif(::oSql:lComments, " /* Counting Records */", ""), lMsg, .t., @aRet)
EndIf
If Len(aRet) > 0
::aInfo[ AINFO_RCOUNT ] := aRet[1,1]
nRet := aRet[1,1]
ElseIf ::oSql:nRetCode != SQL_SUCCESS .and. ::oSql:nRetCode != SQL_NO_DATA_FOUND
nRet := -1 // Error
EndIf
Else
nRet := nLineCountResult
::aInfo[ AINFO_RCOUNT ] := nRet
EndIf
Else
nRet := len(::aCache)
EndIf
If Empty(nRet)
::lEmptyTable := .T.
::aInfo[ AINFO_RECNO ] := 1
::aInfo[ AINFO_RCOUNT ] := 0
::aInfo[ AINFO_BOF ] := .T.
::aInfo[ AINFO_EOF ] := .T.
EndIf
Return nRet
Podria ser que no entrara a la consulta por el tema de ::lISAM, mi base de datos es innoDb, lo que no entiendo es que las tablas creadas con SQLRDD tambien son innoDB y funcionan