| DotNetFirebird Using Firebird SQL in .NET. |
|
Home
Features
Download
Documentation
FAQ
Tools and Code
About
Blog
|
Wednesday, March 09, 2005
Batch SQL/DDL ExecutionThe FirebirdSql.Data.Firebird.Isql namespace provides classes for batch SQL/DDL execution. This allows you to make such operations as:
Running a batch script is not difficult. First you need to parse the script using FbScript class: FbScript script = new FbScript("employee.sql"); The result is stored in script.Results, one item per command. Now we can use FbBatchExecution class to run the script: FbConnection c = new FbConnection(@"Database=employee.fdb;User=SYSDBA;Password=masterkey"); By default, the transaction is committed after each command. You can disable this by calling fbe.Execute(false). Here is a complete example that uses an embedded Firebird to create a new employee.fdb database and initialize the structure using a DDL script. The DDL script is generated from the example employee.fdb (it's modified on two places because of the current bugs in the provider, see the Known Issues below). On my Athlon XP 2000+ the execution of this batch script takes 0.921 seconds - which is very good I guess. Known Issues
Update The issues are already fixed because my changes were incorporated into the provider. Download
Related
Comments:
I have given a try and it works.
I would like the newly created fb file to be released after the connection.Close() statement but it is not (unable to rename or delete it for example) The file is released only when the application finished. Any solution ? Thanks Vincent QUILLET
This is caused by connection pooling. You need either to:
1) turn off the connection pooling using Pooling=false in the connection string; or 2) close all connections when you are finished using FbConnection.ClearPool() or FbConnection.ClearAllPools(().
Thank you very much !
I have tried to set Pooling=false and it's OK. Now I can't get working character set like ISO8859_1 or DOS863. connection.Open() throws following exception : bad parameters on attach or create database\nCHARACTER SET ISO8859_1 is not defined Setting parameter to 'ASCII' or 'UNICODE_FSS' works fine. Any idea ? Thanks Vincent QUILLET
When using any of the special charsets with embedded Firebird you need to include also the "intl/fbintl.dll" library (remember to put it into the "intl" subdirectory of your app's directory).
I always have trouble finding C# code samples for Firebird.
Here is a link to my an article on my Blog which includes examples: Run an embedded SQL Script against Firebird Your Blog helped me on my way. Many thanks. Wayne Phipps
When I use FbBatchExecution to execute insert statment I got "Execut exception System.NullReferenceException: Object reference not set to an instance of an object...."
If I execute create table statement I won't get this message. Any help appreciated Blog comments are closed.
Previous
Archives
Copyright © 2005 - 2007 DotNetFirebird |