It is currently Tue May 21, 2013 6:11 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Tue Apr 17, 2012 12:02 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
http://dl.dropbox.com/u/3086026/ADOmate.zip should work for a short time :wink:
I hope srod will fix his webside.

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Tue Apr 17, 2012 12:07 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
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!

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Tue Apr 17, 2012 12:19 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Feb 17, 2010 12:00 am
Posts: 974
Location: Anderson Island, WA
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...


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Wed Apr 18, 2012 1:25 am 
Offline
New User
New User

Joined: Tue Apr 17, 2012 11:23 am
Posts: 2
Thanks, it will help me a lot.


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Wed Apr 18, 2012 7:13 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
And http://www.nxsoftware.com/ is working again :D

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Linux Mint 14 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Wed Apr 18, 2012 8:25 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
ts-soft wrote:
And http://www.nxsoftware.com/ is working again :D


Yes, but most of the links aren't! :)

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Fri Nov 02, 2012 9:09 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 02, 2007 1:43 am
Posts: 627
Location: Brazil
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:
;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:
; ADOmate_OpenDatabase method - Line 1099
If SUCCEEDED(*connection\connectionObject\Invoke("Open('" + connection$ + "', " + user$ + ", " + password$ +")"))


Code:
; 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

_________________
Proud registered Purebasic user.
Because programming should be fun.


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Fri Nov 02, 2012 9:50 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
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:
    Macro SUCCEEDED(HRESULT)
      HRESULT & $80000000 = 0
    EndMacro
    Macro FAILED(HRESULT)
      HRESULT & $80000000
    EndMacro


This is only valid whilst the conjectured bug with PB stands.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Last edited by srod on Sat Nov 03, 2012 9:16 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Sat Nov 03, 2012 4:09 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 02, 2007 1:43 am
Posts: 627
Location: Brazil
Quote:
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

_________________
Proud registered Purebasic user.
Because programming should be fun.


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Sat Nov 03, 2012 9:13 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 9870
Location: Beyond the pale...
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.

_________________
I may look like a mule, but I'm not a complete ass.

eScript
Arctic Reports
nxSoftware


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Sat Nov 03, 2012 11:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 02, 2007 1:43 am
Posts: 627
Location: Brazil
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

_________________
Proud registered Purebasic user.
Because programming should be fun.


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Mon Feb 11, 2013 6:47 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 02, 2007 1:43 am
Posts: 627
Location: Brazil
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:
; The declaration:
Procedure.i ADOmate_DatabaseQuery(*connection._ADOmateConnection, request$, cursorType = #adOpenForwardOnly, cursorLocation = #adUseServer)


Code:
; 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

_________________
Proud registered Purebasic user.
Because programming should be fun.


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Tue Apr 23, 2013 10:17 am 
Offline
User
User

Joined: Sun Apr 21, 2013 10:31 am
Posts: 10
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:
;/////////////////////////////////////////////////////////////////////////////////
;***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


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Tue Apr 23, 2013 10:45 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 683
Location: Cologne / Germany
you must set your password in the Connectionstring:
Code:
[...]
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

_________________
Sorry for my weird english


Top
 Profile  
 
 Post subject: Re: ADOmate - use OLE-DB datasources via ADO - (BLOBs added)
PostPosted: Tue Apr 23, 2013 12:26 pm 
Offline
User
User

Joined: Sun Apr 21, 2013 10:31 am
Posts: 10
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: Exabot [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye