当前位置:网站首页>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
边栏推荐
- China's plastic processing machinery market trend report, technological innovation and market forecast
- Using celery in projects
- Socks agent tools earthworm, ssoks
- Detailed process of DC-2 range construction and penetration practice (DC range Series)
- Selenium element interaction
- ONgDB图数据库与Spark的集成
- China's roof ladder market trend report, technological innovation and market forecast
- Hidden communication tunnel technology: intranet penetration tool NPS
- Accounting regulations and professional ethics [8]
- Talking about Net core how to use efcore to inject multiple instances of a context annotation type for connecting to the master-slave database
猜你喜欢
error: ‘connect‘ was not declared in this scope connect(timer, SIGNAL(timeout()), this, SLOT(up
Transformer中position encoding实践
What is the catalog of SAP commerce cloud
Filtered off site request to
Statistical learning: logistic regression and cross entropy loss (pytoch Implementation)
Stress, anxiety or depression? Correct diagnosis and retreatment
The new generation of domestic ORM framework sagacity sqltoy-5.1.25 release
Scientific research cartoon | what else to do after connecting with the subjects?
The 17 year growth route of Zhang Liang, an open source person, can only be adhered to if he loves it
Anta is actually a technology company? These operations fool netizens
随机推荐
[hcie TAC] question 5 - 1
Research Report on plastic recycling machine industry - market status analysis and development prospect forecast
Market trend report, technical innovation and market forecast of taillight components in China
Understand asp Net core - Authentication Based on jwtbearer
Accounting regulations and professional ethics [11]
Hair and fuzz interceptor Industry Research Report - market status analysis and development prospect forecast
Penetration test --- database security: detailed explanation of SQL injection into database principle
[Previous line repeated 995 more times]RecursionError: maximum recursion depth exceeded
APOC自定义函数和过程
话里话外:流程图绘制初级:六大常见错误
Change the mouse pointer on ngclick - change the mouse pointer on ngclick
165 webmaster online toolbox website source code / hare online tool system v2.2.7 Chinese version
Stress, anxiety or depression? Correct diagnosis and retreatment
Research Report on market supply and demand and strategy of China's well completion equipment industry
基于check-point机制的任务状态回滚和数据分块任务
Application and Optimization Practice of redis in vivo push platform
一图看懂ThreadLocal
Vscode prompt Please install clang or check configuration 'clang executable‘
Using celery in projects
Understand Alibaba cloud's secret weapon "dragon architecture" in the article "science popularization talent"