ODBC and JDBC Developer’s Guide
Table Of Contents
- Chapter 1 Introduction
- Chapter 2 Using ODBC to share FileMaker data
- Chapter 3 Using JDBC to share FileMaker data
- Chapter 4 Supported standards
- Appendix A Mapping FileMaker fields to ODBC data types
- Appendix B Mapping FileMaker fields to JDBC data types
- Appendix C ODBC and JDBC error messages
- Index
26 FileMaker ODBC and JDBC Developer’s Guide
Retrieving the contents of a container field: CAST() function and GetAs() function
You can retrieve binary data, file reference information, or data of a specific file type from a container field.
To retrieve binary data, use a standard SELECT statement. For example:
SELECT Company_Brochures FROM Sales_Data
If file or JPEG data exists, the SELECT statement retrieves the data in binary form; otherwise, the SELECT
statement returns <null>.
To retrieve file reference information (such as the file path), use the CAST function with a SELECT statement.
For example:
SELECT CAST(Company_Brochures AS VARCHAR(NNN)) FROM Sales_Data
In this example, if you:
1 Inserted a file into the container field using FileMaker Pro but stored only a reference to the file, the
SELECT statement retrieves the file reference information as type SQL_VARCHAR.
1 Inserted the contents of a file into the container field using FileMaker Pro, the SELECT statement retrieves
the name of the file.
1 Imported a file into the container field from another application, the SELECT statement displays '?' (the file
displays as Untitled.dat in FileMaker Pro).
To retrieve data of a specific file type from a container field, use the GetAs function and specify the file’s type.
For example:
SELECT GetAs(Company_Logo, 'JPEG') FROM Sales_Data
The possible file types (case sensitive) you can retrieve from a container field in a FileMaker database file are:
File Type Description File Type Description
'BMPf' Bitmap 'PCD ' Kodak PhotoCD
'EMBO' OLE container data 'PDF ' Portable Document Format
'EPS ' Embedded PostScript 'PICT' Mac OS (does not have 512-byte file-based header)
'FILE' Result of an Insert File command 'PNGf' Bitmap image format
'FPix' Flash (FPX) 'PNTG' MacPaint
'FORK' Resource fork (Mac OS) 'qtif' QuickTime image file
'GIFf' Graphics Interchange Format '.SGI' Generic bitmap format
'JPEG' Photographic images 'snd ' Standard sound (Mac OS raw format)
'JP2 ' JPEG 2000 'TIFF' Raster file format for digital images
'META' Windows Metafile (enhanced) 'TPIC' Targa
'METO' Windows Metafile (original) 'XMLO' Layout objects
'moov' Old QuickTime format (Mac OS) '8BPS' PhotoShop (PSD)