| Database Toolbox™ | ![]() |
This toolbox is an object-oriented application. You do not need to be familiar with the product's object-oriented implementation to use it; this information is provided for reference purposes.
The Database Toolbox™ software includes the following objects:
Cursor
Database
Database metadata
Driver
Drivermanager
Resultset
Resultset metadata
Each object has its own method directory, whose name begins with an @ sign, in the matlabroot/toolbox/database/database directory. M-file functions in the directory for each object provide methods for operating on the object.
Object-oriented characteristics of the toolbox enable you to:
Use constructor functions to create and return information about objects.
For example, to create a cursor object containing query results, run the fetch (cursor.fetch) function. The object and stored information about the object are returned. Because objects are MATLAB® structures, you can view elements of the returned object.
This example uses the fetch function to create a cursor object curs.
curs =
Attributes: []
Data: {10x1 cell}
DatabaseObject: [1x1 database]
RowLimit: 0
SQLQuery: 'select country from customers'
Message: []
Type: 'Database Cursor Object'
ResultSet: [1x1 sun.jdbc.odbc.JdbcOdbcResultSet]
Cursor: [1x1 com.mathworks.toolbox.database.sqlExec]
Statement: [1x1 sun.jdbc.odbc.JdbcOdbcStatement]
Fetch: [1x1 com.mathworks.toolbox.database.fetchTheData]
View the contents of the Data element in the cursor object.
curs.Data
ans =
'Germany'
'Mexico'
'Mexico'
'UK'
'Sweden'
'Germany'
'France'
'Spain'
'France'
Use overloaded functions.
Objects allow the use of overloaded functions, which simplify usage because you only need to use one function to operate on objects. For example, use the get function to view properties of an object.
Create custom methods that operate on Database Toolbox objects and store them in the MATLAB workspace as M-files. For more information, see Methods — Defining Class Operations in the Developing MATLAB Classes documentation.
![]() | Using Driver Functions | Function Reference | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |