New topic: 

about using interfaces...

<http://forums.realsoftware.com/viewtopic.php?t=47822>

         Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic          Author  
Message        BrianOBrien          Post subject: about using 
interfaces...Posted: Wed May 08, 2013 1:13 pm                                 
Joined: Wed Jul 07, 2010 2:55 pm
Posts: 703
Location: University Of Calgary, Faculty Of Medicine                I have a 
class property that is defined as:database As DatabaseConnectionInterfaceI try 
to set the interface to 'point' to the actual instance of the database 
connection class and get the following error message:Quote:Code, 
ReportWindow.getBitsiReport, line 19, Type mismatch error.  Expected 
DatabaseConnectionInterface, but got MySQLCommunityServer, 
MySQLThread2.database = mDatabaseConnectionHow to i set the interface to point 
to the database object?      
_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try 
Xojo.  
                             Top                timhare          Post subject: 
Re: about using interfaces...Posted: Wed May 08, 2013 1:46 pm                   
      
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12299
Location: Portland, OR  USA                DatabaseConnectionInterface is an 
internal thing that is probably intended for use in creating database plugins.  
You really shouldn't use it in your own code.

In particular, an MysqlCommunityServer object does not implement 
DatabaseConnectionInterface directly, so it isn't a valid assignment.

Why do you want to use that particular interface?  
What problem are you trying to solve here?
Is there a reason that using the generic Database class would not work?   
                             Top                BrianOBrien          Post 
subject: Re: about using interfaces...Posted: Wed May 08, 2013 1:56 pm          
                       
Joined: Wed Jul 07, 2010 2:55 pm
Posts: 703
Location: University Of Calgary, Faculty Of Medicine                I have two 
types of database connections ASEDatabase and MySQLCommunityServer.

Both of these database connection classes have pretty much the same 
interface... But I want one class that handle both.
Foolish me i thought that that was what the databaseconnectioninteface would be 
for... I guess not....
but I guess I could define my own interface and use it...
I just think I've forgotten how.      
_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try 
Xojo.  
                             Top                Jason_Adams          Post 
subject: Re: about using interfaces...Posted: Wed May 08, 2013 2:48 pm          
                       
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1820
Location: Michigan, USA                Since they're both inherited from the 
Database class, why not just use that?

Otherwise, you can create an Interface like you would a class from the Project 
tab. Right click->Add to Project->Class Interface.

Hope this helps.     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top                BrianOBrien          Post 
subject: Re: about using interfaces...Posted: Wed May 08, 2013 3:00 pm          
                       
Joined: Wed Jul 07, 2010 2:55 pm
Posts: 703
Location: University Of Calgary, Faculty Of Medicine                Which is 
what I did.
and in that class interface I added two or three methods:
Function Error() As Boolean
End Function
Function ErrorCode() As integer
End Function
Function ErrorMessage() As String
End Function
Function SQLSelect(SelectString as String) As RecordSet
End Function
I'm not quite sure this is correct as Error, ErrorCode and ErrorMessage are 
properties.

I add a property of this new interface type to my class. and try to set it to 
the instance of the MySQL or PostGres database and get and error:
Quote:Code, ReportWindow.getBitsiReport, line 20, Type mismatch error.  
Expected databaseInterface, but got MySQLCommunityServer, 
MySQLThread2.databaseinterface = mBitsiDatabaseConnection      
_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try 
Xojo.  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to