当前位置:网站首页>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
边栏推荐
- Four point probe Industry Research Report - market status analysis and development prospect prediction
- 线程池的使用和原理
- Stress, anxiety or depression? Correct diagnosis and retreatment
- The vscode waveform curve prompts that the header file cannot be found (an error is reported if the header file exists)
- Redis: SDS source code analysis
- FIREBIRD使用经验总结
- Research Report on market supply and demand and strategy of surgical stapler industry in China
- Statistical learning: logistic regression and cross entropy loss (pytoch Implementation)
- Object distance measurement of stereo vision
- . Net delay queue
猜你喜欢
[North Asia data recovery] a database data recovery case where the disk on which the database is located is unrecognized due to the RAID disk failure of HP DL380 server
Qt---error: ‘QObject‘ is an ambiguous base of ‘MyView‘
Detailed process of DC-2 range construction and penetration practice (DC range Series)
Using celery in projects
Principle and general steps of SQL injection
What is the catalog of SAP commerce cloud
Will the memory of ParticleSystem be affected by maxparticles
165 webmaster online toolbox website source code / hare online tool system v2.2.7 Chinese version
Preliminary practice of niuke.com (10)
How was MP3 born?
随机推荐
Model fusion -- stacking principle and Implementation
Principle and general steps of SQL injection
Feature extraction and detection 15-akaze local matching
Summary of database 2
Selenium element interaction
std::shared_ ptr initialization: make_ shared&lt; Foo&gt; () vs shared_ ptr&lt; T&gt; (new Foo) [duplicate]
科普达人丨一文看懂阿里云的秘密武器“神龙架构”
~88 running people practice
Understand asp Net core - Authentication Based on jwtbearer
%F format character
Recommend 10 excellent mongodb GUI tools
System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
Communication mode based on stm32f1 single chip microcomputer
What is torch NN?
Laravel simply realizes Alibaba cloud storage + Baidu AI Cloud image review
JS to realize the countdown function
@EnableAspectAutoJAutoProxy_ Exposeproxy property
What should ABAP do when it calls a third-party API and encounters garbled code?
基于check-point机制的任务状态回滚和数据分块任务
同构图与异构图CYPHER-TASK设计与TASK锁机制