简体   繁体   English

使用脚本生成Firebird数据库时出现问题

[英]Problems generating Firebird database with script

I have a script to generate the structure of a database for Firebird and use ISQL 我有一个脚本来为Firebird生成数据库的结构并使用ISQL

I have problems with some of the statements I use due to the type of date TIMESTAMP , for example with the external functions: 由于日期TIMESTAMP的类型,我使用的某些语句存在问题,例如外部函数:

DECLARE EXTERNAL FUNCTION F_CUTTIME
TIMESTAMP
RETURNS TIMESTAMP FREE_IT
ENTRY_POINT 'fn_cuttime' MODULE_NAME 'SISUDFIB';

Or for example with the creation of domains: 或例如创建域:

CREATE DOMAIN D_DATE AS TIMESTAMP
CHECK ((VALUE IS NULL) OR (VALUE = F_CUTTIME (VALUE)));

It gives me error and from what I see is by the type TIMESTAMP . 它给了我错误,从我看到的是TIMESTAMP类型。

When I create the structure of my database I generate a script and I get errors in the declarations of external functions, but only in those I use TIMESTAMP tells me this error: 当我创建数据库的结构时,会生成一个脚本,并且在外部函数的声明中会出现错误,但是只有在使用TIMESTAMP的那些错误中,我才会看到此错误:

Stament failed, sqlstate = 39000
 invalid request BLR offset 13 
-function F_CUTTIME is not defined

I get in the functions where TIMESTAMP is, the rest of functions generates me well. 我进入了TIMESTAMP所在的函数,其余函数对我的影响很大。

How do I create my script so that I do not get errors in Firebird with ISQL? 如何创建脚本,以便在使用ISQL的Firebird中不会出现错误?

I give an example: 我举一个例子:

SET SQL DIALECT 1;

CREATE DATABASE 'C: \ SISCONIBSCT.fdb' PAGE_SIZE 8192

USER 'SISCONIB' PASSWORD 'telecoman'

DEFAULT CHARACTER SET WIN1252;

/ * External Function declarations * /

DECLARE EXTERNAL FUNCTION F_CUTTIME
TIMESTAMP
RETURNS TIMESTAMP FREE_IT
ENTRY_POINT 'fn_cuttime' MODULE_NAME 'SISUDFIB';

/ * Domain definitions * /
CREATE DOMAIN D_BOOLEAN AS CHAR (1)
DEFAULT 'T'
CHECK (VALUE IN ('F', 'T')) NOT NULL;
CREATE DOMAIN D_DATE AS TIMESTAMP
CHECK ((VALUE IS NULL) OR (VALUE = F_CUTTIME (VALUE)));
CREATE DOMAIN D_DATETIME AS TIMESTAMP;
CREATE DOMAIN D_TIME AS TIMESTAMP
CHECK ((VALUE IS NULL) OR (F_CUTTIME (VALUE) = F_TIMEBASE ()));


CREATE TABLE SISFASE
(
  CODSCT SMALLINT NOT NULL,
  CODEST CHAR (2) NOT NULL,
  CODPRO SMALLINT NOT NULL,
  CODFAS SMALLINT NOT NULL,
  DESCREAS VARCHAR (30) COLLATE PXW_SPAN,
  PERESP D_TIME,
  CODPLA CHAR (1) NOT NULL,
  CODETG SMALLINT NOT NULL,
 PRIMARY KEY (CODSCT, CODEST, CODPRO, CODFAS)
);

Giving errors both in the declaration of the external function as in domains as in the creation of the table and always giving me error in the dates. 既在域的外部函数声明中(如在域中)(在创建表时)出错,又总是在日期中给我错误。

Do not understand the problem. 不明白问题所在。

About function F_CUTTIME - if it was taken from InterBase 5, I mean, it was compiled for InterBase 5, then it MUST be recompiled for any new InterBase or Firebird. 关于函数F_CUTTIME-如果它是从InterBase 5中获取的,我是说它是为InterBase 5编译的,则必须为任何新的InterBase或Firebird重新编译。 If it cannot be recompiled, then the only way is to move to Dialect 3, and use basic Firebird functions and CAST to work with separate DATE and TIME variables. 如果无法重新编译,则唯一的方法是移至方言3,并使用基本的Firebird函数和CAST与单独的DATE和TIME变量一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM