当前位置:网站首页>Firebird experience summary
Firebird experience summary
2022-07-04 16:40:00 【Full stack programmer webmaster】
Recently, I am rewriting a paragraph ms sql Stored procedure to firebird, Sum up some experience , firebird It can be said to be the smallest database in the world that supports stored procedures , only 2.3M nothing more , If you do small applications , Than ms sql Desktop version is also available 70 many M(+sp3), mysql Also have 20-30M, It's too inconvenient .
1. Custom function problem .Access to UDF library “rfunc.dll” is denied by server administrator It took a long time , I don't understand why , take rfunc.dll Kao to udf Catalog ,bin Catalog ,windows\system32 Directories can't solve the problem ,google once , There are the same problems online , But there is no solution , As a result, I reinstalled firebird It's settled. .
2. Definition of variables in stored procedures ms sql New variables can be defined anywhere in the stored procedure , But in firebird in , Only in as And begin Between .firebird The variable of cannot be used @ Symbol , I will @ All become a Just fine .
3. Use of variables in stored procedures select @i=count(*) from table1 //ms sqlselect count(*) from table1 into :i//firebird Reference variables use colons 4. The embedded sql, firebird Support select * from table exists (select …) or select * from table in (select …) But does not support select * from (select * from …) a, I solve this problem by rewriting it as a view
5.case sentence mssql You can use field= case (), but firebbird Support only case () as field, 6.mssql getdate() become CURRENT_DATE+CURRENT_TIME select * from snartleave where dt_starttime<CURRENT_DATE+CURRENT_TIME or select * from snartleave where dt_starttime<CURRENT_DATE||’ ‘ ||CURRENT_TIME
7. Write the stored procedure of the returned data set (firebird It's a bit troublesome to write ) CREATE PROCEDURE SPVARTST2 ( VAR_IPTARTNO CHAR(6))RETURNS ( VAR_ARTNAME CHAR(10))ASbeginfor select v_name1 from snart where v_artNo=:var_iptartno into :var_artname dosuspend;end
8. Use of automatic growth fields (autoincrement) firebird There is a generator (generator) The east east , Record the increase of the value in the generator , Then use trigger to realize beginif (new.i_seqno is null) thenbegin NEW.i_seqno = GEN_ID(GEN_T_DB_ARTSEQNO_ID,1);endend //GEN_T_DB_ARTSEQNO_ID Is the generator created , See no , In other words, different tables and fields can share a generator ,gen_id amount to identity, Looks like mssql complex , It's also very simple .
9. Generator reset mssql It seems troublesome to reset the automatically added fields in , More difficult to control , firebird It can be like this ( Stored procedure ) agenerator=Gen_ID(GEN_T_DB_ARTSEQNO_ID,Gen_ID(GEN_T_DB_ARTSEQNO_ID,0)*-1+1); //agenerator It's a plastic variable , It seems that you must pretend gen_id The value symbol of is given to a variable , I don't know if there's a better way , Don't define an extra variable Please refer to the following website :http://www.fingerbird.de/generatorguide_body.htm
10 Change the data of another table through one table mssql:update table1 set cname=b.cname from table1 a inner join table2 as b where a.id=b.id firebird:update table1 a set cname=(select cname from table 2 b where b where a.id=b.id) 11. How to select the first few records mssql: select top 10 * from table1 firebird:select first 10 * from table1 IB:select * from table rows 10 12.Firebird Storing transactions in stored procedures In stored procedures ib/fb Starting or ending a transaction is not supported . The submission is submitted by the caller . That is to say ,fb/ib Stored procedures should be designed in a transaction . stay sql server in , Stored procedures or such transactions : begin trancstion commit trancstion But in fb/ib There is no such thing in You need to start a transaction in the transferred program Such as : pFIBDtbsMain.StartTransaction; pFIBDtbsMain.Commit;
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/110912.html Link to the original text :https://javaforall.cn
边栏推荐
- 嵌入式软件架构设计-函数调用
- std::shared_ ptr initialization: make_ shared&lt; Foo&gt; () vs shared_ ptr&lt; T&gt; (new Foo) [duplicate]
- Variable cannot have type 'void'
- 基于check-point实现图数据构建任务
- Interpretation of the champion scheme of CVPR 2020 night target detection challenge
- What is torch NN?
- Selenium element interaction
- Penetration test --- database security: detailed explanation of SQL injection into database principle
- Understand asp Net core - Authentication Based on jwtbearer
- [flask] ORM one to many relationship
猜你喜欢

程序员怎么才能提高代码编写速度?
![[North Asia data recovery] a database data recovery case where the partition where the database is located is unrecognized due to the RAID disk failure of HP DL380 server](/img/21/513042008483cf21fc66729ae1d41f.jpg)
[North Asia data recovery] a database data recovery case where the partition where the database is located is unrecognized due to the RAID disk failure of HP DL380 server

多年锤炼,迈向Kata 3.0 !走进开箱即用的安全容器体验之旅| 龙蜥技术
![[tutorial] yolov5_ DeepSort_ The whole process of pytoch target tracking and detection](/img/a7/92d670776e3fd3d5add3aa144617c7.jpg)
[tutorial] yolov5_ DeepSort_ The whole process of pytoch target tracking and detection

Move, say goodbye to the past again

Will the memory of ParticleSystem be affected by maxparticles

Model fusion -- stacking principle and Implementation

The new generation of domestic ORM framework sagacity sqltoy-5.1.25 release

How was MP3 born?

MySQL learning notes - data type (2)
随机推荐
Research Report on market supply and demand and strategy of tetramethylpyrazine industry in China
Accounting regulations and professional ethics [6]
DC-2靶场搭建及渗透实战详细过程(DC靶场系列)
多年锤炼,迈向Kata 3.0 !走进开箱即用的安全容器体验之旅| 龙蜥技术
DIY a low-cost multi-functional dot matrix clock!
Hair and fuzz interceptor Industry Research Report - market status analysis and development prospect forecast
Software Engineer vs Hardware Engineer
Opencv learning -- arithmetic operation of image of basic operation
What should ABAP do when it calls a third-party API and encounters garbled code?
I let the database lock the table! Almost fired!
Daily notes~
[North Asia data recovery] a database data recovery case where the partition where the database is located is unrecognized due to the RAID disk failure of HP DL380 server
FIREBIRD使用经验总结
Summary of database 2
[tutorial] yolov5_ DeepSort_ The whole process of pytoch target tracking and detection
如何为ONgDB核心项目源码做贡献
Application and Optimization Practice of redis in vivo push platform
System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
One question per day 540 A single element in an ordered array
Opencv learning -- geometric transformation of image processing