Firemonkey应用程序的嵌入数据库 [英] Embeded DB for Firemonkey apps
本文介绍了Firemonkey应用程序的嵌入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
创建一个客户端应用程序,希望将整个数据库嵌入软件或单独的dll(即sqlite),而不是像mysql。
Creating a client application, want the whole DB to be embed in the software or in a single standalone dll (ie sqlite), not something like mysql.
Whats
除了TClientDataSet / xml文件之外)
Other than TClientDataSet / xml files :)
推荐答案
您可以使用我的 SQLite包装器(以及我的博客中的一些更多信息),它支持多个平台。在Windows中,您需要在应用程序中部署sqlite3.dll,在OSX上不需要这样做。您可以从svn获取源。用法示例:
You can use my SQLite wrapper (also some more info in my blog) which supports multiple platforms. In Windows you'll need to deploy sqlite3.dll with your application, there is no need for this on OSX. You can get sources from the svn. Example usage:
uses
SQLiteTable3,
{$IFDEF DELPHI16_UP}
System.SysUtils;
{$ELSE}
SysUtils;
{$ENDIF}
procedure Demo;
var
slDBpath: string;
db: TSQLiteDatabase;
pstm TSQLitePreparedStatement;
begin
slDBpath := IncludeTrailingPathDelimiter(GetHomePath) + 'test.db';
db := TSQLiteDatabase.Create(slDBpath);
try
if db.TableExists('testtable') then
begin
pstm := TSQLitePreparedStatement.Create(db,
'insert into testtable (name,number) values (?,?)', //sql statement
['NewRec', 99.99]); //parameter values
try
pstm.ExecSQL;
finally
pstm.Free;
end;
end;
finally
db.Free;
end;
end;
这篇关于Firemonkey应用程序的嵌入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文