Page 3 of 4

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Tue Apr 17, 2012 12:02 pm
by ts-soft
http://dl.dropbox.com/u/3086026/ADOmate.zip should work for a short time :wink:
I hope srod will fix his webside.

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Tue Apr 17, 2012 12:07 pm
by srod
ts-soft wrote:I hope srod will fix his webside.
He is a lazy bugger at the best of times! :wink:

I'll get on to it tonight... if I can find it!

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Tue Apr 17, 2012 12:19 pm
by jassing
coelhorb wrote:Please could you put ADOmate link available again? http://dl.dropbox.com/u/3086026/ADOmate.zip doesn't work any more and I can't find it anywhere on internet. The nxsoftware's site is out. Thanks and sorry for my poor english.
I just clicked the dropbox url and it downloaded w/o issue.
I mirrored it here: http://jassing.com/temp/adomate.zip -- but this doesn't mean it'll be there forever...

adomate is 3 years old...

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Wed Apr 18, 2012 1:25 am
by coelhorb
Thanks, it will help me a lot.

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Wed Apr 18, 2012 7:13 am
by ts-soft
And http://www.nxsoftware.com/ is working again :D

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Wed Apr 18, 2012 8:25 am
by srod
ts-soft wrote:And http://www.nxsoftware.com/ is working again :D
Yes, but most of the links aren't! :)

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Fri Nov 02, 2012 9:09 pm
by byo
hi, srod.

I'd like to suggest some fixes for using ADOMate with the Windows x64 compiler.

First, as I read in another topic, the EXCEPINFO structure is different in the x64 library so I'd suggest
a code in COMate like this one:

Code: Select all

;The following structure is used in the iDispatch\Invoke() method call to receive detailed errors.
  CompilerIf Defined(EXCEPINFO, #PB_Structure) = 0
  	CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
	  	Structure EXCEPINFO
	      wCode.w
	      wReserved.w
	      pad.b[4] ; Only on x64
	      bstrSource.i                ;BSTR
	      bstrDescription.i
	      bstrHelpFile.i
	      dwHelpContext.l
	      pvReserved.i
	      pfnDeferredFillIn.COMate_ProtoDeferredFillIn
	      scode.l
	      pad2.b[4] ; Only on x64
	   EndStructure
	CompilerElse
		Structure EXCEPINFO
	      wCode.w
	      wReserved.w
	      bstrSource.i                ;BSTR
	      bstrDescription.i
	      bstrHelpFile.i
	      dwHelpContext.l
	      pvReserved.i
	      pfnDeferredFillIn.COMate_ProtoDeferredFillIn
	      scode.l
	   EndStructure		
	CompilerEndIf
CompilerEndIf
Next, there is something wrong when the IDispatch\Invoke is called in the x64 version. There must be an additional error code for this version because every connection that should have caused an error returns "Okay.". I haven't tested it thoroughly but here's what I saw:

Replacing the first code with the second one should do the trick for every version:

Code: Select all

; ADOmate_OpenDatabase method - Line 1099
If SUCCEEDED(*connection\connectionObject\Invoke("Open('" + connection$ + "', " + user$ + ", " + password$ +")"))

Code: Select all

; ADOmate_OpenDatabase method - Line 1099
If *connection\connectionObject\Invoke("Open('" + connection$ + "', " + user$ + ", " + password$ +")") = #S_OK
;)

I hope that helps. With the changes above my code is working great in x86 and x64 versions.
BTW, thank you for this wonderful library.

EDIT: After more time debugging I think the problem resides in a deeper level. The COMateClass_INTERNAL_InvokePlus method returns a negative error number in the x86 compiler while it returns a positive one in x64. That's why the SUCCEEDED macro above always returns TRUE.

Best regards,

Andre Guerreiro Neto

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Fri Nov 02, 2012 9:50 pm
by srod
Thanks byo, good work there.

I wonder if the problem with the error codes is that HRESULT values are actually 32-bit regardless of architecture? If this is the case then PBx64 could be misinterpreting the return values? Will need to get ahold of some c header files to be sure.

EDIT : yes I do think that PB x64 regards HRESULT as 64-bit integers rather than 32-bit longs. This would mean that PB x64 has all in-built interface methods which return HRESULT values incorrect.

I can easily add a workaround to COMate.

**EDIT : COMatePLUS workaround.

Code: Select all

    Macro SUCCEEDED(HRESULT)
      HRESULT & $80000000 = 0
    EndMacro
    Macro FAILED(HRESULT)
      HRESULT & $80000000
    EndMacro
This is only valid whilst the conjectured bug with PB stands.

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Sat Nov 03, 2012 4:09 am
by byo
EDIT : yes I do think that PB x64 regards HRESULT as 64-bit integers rather than 32-bit longs. This would mean that PB x64 has all in-built interface methods which return HRESULT values incorrect.
Ah, so that's what's going on. :)
Thank you for your additional tests.

Interesting macro solution.
I have tested your fix in both compilers and both produce the correct output.
Should we inform Fred/freak about the issue or is there a bug report already filled?

[EDIT]: I was using only your macro solution without my altered code and it would still fail to show an error. Only when I changed the ADOmate line to compare the Invoke method result with #S_OK it would work properly for me in x64. :)

Thanks again, Stephen.

Best regards,

Andre Guerreiro Neto

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Sat Nov 03, 2012 9:13 am
by srod
You need to replace the original macro in COMatePLUS with the new one given above. I will post a bug report later.

*EDIT : sorry, the macro above was wrong, please try again with the new version.

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Sat Nov 03, 2012 11:48 pm
by byo
Thank you, srod.

It's working correctly now. I see what you did there but I can't quite understand it. I'm not good in Bitwise operators. :D
Nice work there.

Thanks again for the easy fix.

Best regards,

Andre Guerreiro Neto

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Mon Feb 11, 2013 6:47 pm
by byo
Hi. mr. srod. How's it going? :-D

I have an improvement to suggest. How about adding a new parameter to ADOMate_DatabaseQuery to set the cursorLocation property for the RecordSet?
This can have a huge impact on queries depending on the case, of course. Sometimes, when the cursor is executed at the client side it's faster and takes the burden off the server.

The changes you'd have to make (if you accept it) is:

Code: Select all

; The declaration:
Procedure.i ADOmate_DatabaseQuery(*connection._ADOmateConnection, request$, cursorType = #adOpenForwardOnly, cursorLocation = #adUseServer)

Code: Select all

; The definition (line 423):
If rset\SetProperty("CursorType = " + Str(cursorType)) = #S_OK And rset\SetProperty("CursorLocation = " + Str(cursorLocation)) = #S_OK And rset\Invoke("Open('" + request$ + "', " + Str(*connection\connectionObject) + " As COMateObject)") = #S_OK
Even if you can change that property later, the reason I ask this is because one has to close the connection to be able to change that property and then reopen it so the change will take effect.

Best regards,

Andre Guerreiro Neto

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Tue Apr 23, 2013 10:17 am
by Liqu
Hello,

i tried to use ADOmate to connect to password protected .mdb and .accdb, but failed.
it works great for unprotected .mdb.

here's my code

Code: Select all

;/////////////////////////////////////////////////////////////////////////////////
;***ADOmate*** - access to OLEDB datasources.
;*============
;*
;*Database query demo.
;*This demo requires the "ado.mdb" database file.
;/////////////////////////////////////////////////////////////////////////////////

IncludePath "..\"
XIncludeFile "ADOmate.pbi"


databaseFile$ = "D:\test.mdb"
connectionString$ = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + databaseFile$ + ";"
User$ = ""
Password$ = "test"
;Attempt to open the database.
myConnection = ADOmate_OpenDatabase(connectionString$,User$,Password$)

If myConnection

  ;Attempt to execute a basic query.
    SQL$ = "Select * from Test"
  If ADOmate_DatabaseQuery(myConnection, SQL$, #adOpenStatic)
    ;Let us display a list of columns.
      numColumns = ADOmate_DatabaseColumns(myConnection)
      If numColumns
        Debug "Columns : "
        Debug "--------------"
        For i = 0 To numColumns-1
          Debug "   " + ADOmate_DatabaseColumnName(myConnection, i) + " --> column type = " + Str(ADOmate_DatabaseColumnType(myConnection, i))
        Next
        Debug ""
      EndIf
    ;Now examine all records retrieved in the recordset.
      Debug "Rows : "
      Debug "--------------"
      While ADOmate_IsEOF(myConnection) = 0
        ID$ = ADOmate_GetDatabaseString(myConnection, 0)
        Integer$ = ADOmate_GetDatabaseString(myConnection, 1)
        Text$ = ADOmate_GetDatabaseString(myConnection, 2)
        Memo$ = ADOmate_GetDatabaseString(myConnection, 3)
        Debug "   (ID=" + ID$ + ", IntegerField=" + Integer$ + ", TextField=" + Text$ + ", MemoField=" + Memo$ + ")"
        ADOmate_NextDatabaseRow(myConnection)
      Wend
    ADOmate_FinishDatabaseQuery(myConnection)
  Else
    MessageRequester("ADOmate error!", ADOmate_GetLastErrorDescription())
  EndIf
  ADOmate_CloseDatabase(myConnection)
Else
  MessageRequester("ADOmate error!", ADOmate_GetLastErrorDescription())
EndIf

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Tue Apr 23, 2013 10:45 am
by Kiffi
you must set your password in the Connectionstring:

Code: Select all

[...]
connectionString$ = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + databaseFile$ + ";Jet OLEDB:Database Password=test"
;Attempt to open the database.
myConnection = ADOmate_OpenDatabase(connectionString$, "", "")
[...]
Greetings ... Kiffi

Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)

Posted: Tue Apr 23, 2013 12:26 pm
by Liqu
Your code works great for .mdb
but it still can't connect to unprotected and protected .accdb, its said unrecognized database format.

Thank you very much for the lib srod and the correction Kiffi :D