TSQLDBLibraryLoader: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: TSQLDBLibraryLoader
| Old | New | Line | |
|---|---|---|---|
| 1 | + | > **Warning:** This article is still a rough draft; please compare with the official announcement by Michael Van Canneyt on the Free Pascal mailing list and update this page. | |
| 2 | + | ||
| 3 | + | **TSQLDBLibraryLoader**  is a Lazarus and FPC component that specifies the names and locations of SQLDB database libraries (DLLs/.sos/.dylibs) should be loaded from where. The TSQLDBLibraryLoader component is available on the [[SQLdb tab]] of the [[Component Palette]]. | |
| 4 | + | ||
| 5 | + | ## Use and alternatives | |
| 6 | + | ||
| 7 | + | For SQLDB database connectors, at least recent FPC versions try to load some default library names, but may fail. Using SQLDBLibraryLoader, you can specify the exact filename to load. | |
| 8 | + | ||
| 9 | + | SQLDBLibraryLoader needs to be called *before* loading/enabling TSQLConnection components. | |
| 10 | + | ||
| 11 | + | Note that often you can do a similar thing by setting the library name for the TSQLConnection descendant you are using. This does depend on that TSQLConnection descendant supporting that functionality. | |
| 12 | + | ||
| 13 | + | > **Note:** Support for using SQlite with SQLDBLibraryLoader was added to FPC trunk (2.7.1) and is not available in earlier FPC versions. Possible alternative: InitializeSQLite function in unit sqlite3dyn. *Please remove this text if tested.* | |
| 14 | + | ||
| 15 | + | ## Sample code | |
| 16 | + | ||
| 17 | + | ``` pascal | |
| 18 | + | SQLDBLibraryLoader1.ConnectionType:='SQLite3'; | |
| 19 | + | // Note: .ConnectionType resets the LibraryName, so set LibraryName after | |
| 20 | + | // setting ConnectionType!! | |
| 21 | + | SQLDBLibraryLoader1.LibraryName := 'c:\path_to_sqllite_library\sqlite3.dll'; | |
| 22 | + | SQLDBLibraryLoader1.Enabled := true; | |
| 23 | + | SQLDBLibraryLoader1.LoadLibrary; | |
| 24 | + | ``` | |
| 25 | + | ||
| 26 | + | ## See also | |
| 27 | + | ||
| 28 | + | - [[TSQLConnector]] | |
| 29 | + | ||
| 30 | + | --- | |
| 31 | + | *From the Free Pascal wiki, page "TSQLDBLibraryLoader", as it stood on 2020-03-02 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
