Code: Select all
HandleDB = PeekL(IsDatabase(iDatabase) + 4)
Did anything change with the latest beta to invalidate this method?
Code: Select all
HandleDB = PeekL(IsDatabase(iDatabase) + 4)
Code: Select all
If OpenDatabase(1,"DB-Test","Admin","")
ID=IsDatabase(1)
Structure PB_StructureDataBase
Connection.l ; OS ODBC Connection identifier (SQLHDBC)
Statement.l ; OS ODBC Statement identifier (SQLHSTMT)
EndStructure
*Buffer.PB_StructureDataBase=ID
Handle=PeekL(*Buffer\Statement)
res.w=SQLAllocHandle_(3,Handle,@stmthandle)
If res = #SQL_SUCCESS
Debug "stmthandle="+Str(stmthandle)
EndIf
res.w=SQLTables_(stmthandle,0,0,0,0,0,0,0,0)
If res=#SQL_INVALID_HANDLE
Debug "#SQL_INVALID_HANDLE"
EndIf
If res = #SQL_SUCCESS Or res = #SQL_SUCCESS_WITH_INFO
Debug "#SQL_SUCCESS"
strlen=128+1
*Buffer1=AllocateMemory(strlen):strlen1.l=0
*Buffer2=AllocateMemory(strlen):strlen2.l=0
*Buffer3=AllocateMemory(strlen):strlen3.l=0
*Buffer4=AllocateMemory(strlen):strlen4.l=0
*Buffer5=AllocateMemory(strlen):strlen5.l=0
#SQL_C_CHAR=1
SQLBindCol_(stmthandle,1,#SQL_C_CHAR,*Buffer1,strlen,@strlen1) ; Database
;SQLBindCol_(stmthandle,2,#SQL_C_CHAR,*Buffer2,strlen,@strlen2) ; ?
SQLBindCol_(stmthandle,3,#SQL_C_CHAR,*Buffer3,strlen,@strlen3) ; Tablename
SQLBindCol_(stmthandle,4,#SQL_C_CHAR,*Buffer4,strlen,@strlen4) ; Table-Type
While SQLFetch_(stmthandle)&$FFFF=0
Debug PeekS(*Buffer1,-1,#PB_Ascii)
Debug PeekS(*Buffer3,-1,#PB_Ascii)
Debug PeekS(*Buffer4,-1,#PB_Ascii)
Debug "-----------------------------------------------------------------"
Wend
EndIf
If SQLFreeHandle_(3,stmthandle)=#SQL_SUCCESS
stmthandle=0
EndIf
EndIf
Code: Select all
res.w=SQLAllocHandle_(3,Handle,@stmthandle)
Code: Select all
Procedure.s GetSQLMessages(HandleDB.l)
;
Protected lResult.l
;
Protected SQLState.s = Space(6)
;
Protected NativeErrorPtr.l
;
Protected MessageText.s = Space(10000)
;
Protected BufferLength.l = 10000
;
Protected TextLengthPtr.l
;
Protected DiagInfoPtr.l = -1
;
Repeat
;
lResult = SQLGetDiagRec(#SQL_HANDLE_STMT, HandleDB, 1, @SQLState, @NativeErrorPtr, @MessageText, BufferLength, @TextLengthPtr)
;
Debug lResult
;
If lResult = #SQL_NO_DATA : Break : EndIf
;
Debug Str(TextLengthPtr)+" : "+SQLState+" : "+Left(MessageText, 20)+" : "+Str(lResult)
;
SQLMoreResults(HandleDB)
;
ForEver
;
ProcedureReturn ""
;
EndProcedure
Code: Select all
DECLARE @Counter INT
SET @Counter = 10
WHILE @Counter > 0
BEGIN
PRINT 'The count is ' + CONVERT(VARCHAR(10), @Counter)
SET @Counter = @Counter - 1
END
Code: Select all
ID=IsDatabase(1)
Debug "ID="+Str(ID)
Debug "SQL_HANDLE_ENV="+Hex(PeekL(PeekL(ID)-4))
Debug "SQL_HANDLE_STMT="+Hex(PeekL(PeekL(ID+4)+4))
Debug "SQL_HANDLE_DBC="+Hex(PeekL(PeekL(ID+4)))
Just got burned because Fantaisie software changed the internals.Fred wrote:You are messing with internals...Yes we changed that, try to peek between 0 and 16 (+0, +4, +8, +16) it should be somewhere here.
OK, let's end it here before this topic turns into childish better-than-you arguments. All I say is help the guy who posted the question in a Coding Questions' topic or just don't. And then make a new thread on the Offtopic section on how it's easy to program something in assembly in 5 minutes.BTW: @byo
Maybe you don't know, but I'm with PB since spring 2001 and have contributed a lot to PB, specially when PB only had a handful of users.
You joined 01 Apr 2007, so what was your request again?
You are right, and of top of that I overreacted myself, sorry.byo wrote:OK, let's end it here before this topic turns into childish better-than-you arguments.