FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
Dudas en la creación de un archivo de texto desde FireBird
Premisas: 1.- Estoy utilizando Delphi 6 y FireBird 1.5 versión final. 2.- Trabajando solamente con sp. 3.- Utilizando "execute statement" 4.- Windows 2000 professional como administrador. Caso:
RDB$RELATION_NAME = :TablaPaso; Donde TablaSal es la Tabla de salida "C:\tabla.txt" Tablapaso esla tabla temporal "Paso<Tabla>"
successful execution of subsequent statements. Access to external file "C:\TABF22.TXT " is denied by server administrator.
Juan Carlos |
#2
|
||||
|
||||
No he trabajado con tablas externas... pero me llama la atención que actualices manualmente el diccionario de datos. Que no debieras hacer un
Create table external file 'filespec' etc, etc. ??? Por otro lado, estas seguro que el usuario con el que corre el servidor de interbase tiene permisos para crear un archivo en la raiz del disco C?? Hasta luego.
__________________
Juan Antonio Castillo Hernández (jachguate) Guía de Estilo | Etiqueta CODE | Búsca antes de preguntar | blog de jachguate |
#3
|
|||
|
|||
Juan Antonio
Respondiendo a tus preguntas te envio sp que clona tablas CREATE PROCEDURE P_CLONATABLA ( TABLA VARCHAR(10), NEDES INTEGER) AS DECLARE VARIABLE CAMPO VARCHAR(100); DECLARE VARIABLE SOURCE VARCHAR(100); DECLARE VARIABLE TOTALCAMPOS INTEGER; DECLARE VARIABLE CONTADOR INTEGER; DECLARE VARIABLE LARGO INTEGER; DECLARE VARIABLE SCALE INTEGER; DECLARE VARIABLE TIPO INTEGER; DECLARE VARIABLE SUBTIPO INTEGER; DECLARE VARIABLE NPRECISION INTEGER; DECLARE VARIABLE CTIPO VARCHAR(20); DECLARE VARIABLE SQL VARCHAR(32000); DECLARE VARIABLE BORRAR VARCHAR(100); DECLARE VARIABLE TABLAPASO VARCHAR(20); DECLARE VARIABLE TABLASAL CHAR(20); begin TablaPaso = 'PASO' || TABLA; TablaSal = 'C:\' || TABLA || '.TXT'; Select Count(*) From rdb$relation_fields where rdb$relation_name = :TablaPaso into :TotalCampos; if (TotalCampos = 0) then Begin Sql = 'CREATE TABLE ' || TablaPaso || ' ('; Contador = 1; Select Count(*) From rdb$relation_fields where rdb$relation_name = :TABLA into :TotalCampos; For Select R.RDB$Field_Name, r.rdb$Field_Source, f.rdb$Field_Length, f.rdb$Field_Scale, f.rdb$Field_Type, f.rdb$Field_Sub_Type, f.rdb$Field_Precision From rdb$relation_fields R, rdb$Fields f where R.rdb$relation_name = :Tabla and r.rdb$Field_Source = f.rdb$Field_Name ORDER BY R.rdb$field_position Into :Campo, :Source, :Largo, :Scale, :Tipo, :SubTipo, :nPrecision Do Begin if (substr(f_lrtrim(Source),1,4) <> 'RDB$') then Begin if (Contador < TotalCampos) then begin Sql = Sql || F_LRTRIm(Campo)|| ' ' || F_LRTRIm(Source) || ','; end else begin Sql = Sql || F_LRTRIm(Campo)|| ' ' || F_LRTRIm(Source); end End else Begin Scale = Abs(Scale); if (Tipo = 7) Then cTipo = 'SMALLINT'; if (Tipo = 8) THEN cTipo = 'INTEGER'; if (Tipo = 10) Then cTipo = 'FLOAT'; if (Tipo = 27) Then cTipo = 'DOUBLE PRECISION'; if (Tipo = 12) THEN cTipo = 'DATE'; if (Tipo = 13) Then cTipo = 'TIME'; if (Tipo = 35) Then cTipo = 'TIMESTAMP'; if (Tipo = 14) THEN cTipo = 'CHAR(' || f_lrtrim(Cast (Largo as VarChar(5))) || ')'; if (Tipo = 37) THEN cTipo = 'VARCHAR(' || f_lrtrim(Cast (Largo as VarChar(5))) || ')'; if (((Tipo = 8) or (Tipo = 16)) and (SubTipo = 1)) Then cTipo = 'NUMERIC('|| f_lrtrim(Cast (nPrecision as VarChar(5))) || ',' || f_lrtrim(Cast (Scale as VarChar(5))) || ')'; if (((Tipo = 8) or (Tipo = 16)) and (SubTipo = 2)) Then cTipo = 'DECIMAL('|| f_lrtrim(Cast (nPrecision as VarChar(5))) || ',' || f_lrtrim(Cast (Scale as VarChar(5))) || ')'; if ((Tipo = 261) and (SubTipo = 0)) Then cTipo = 'BLOB SUB_TYPE 0 SEGMENT SIZE 80'; if ((Tipo = 261) and (SubTipo = 1)) Then cTipo = 'BLOB SUB_TYPE 1 SEGMENT SIZE 80'; if (Contador < TotalCampos) then begin Sql = Sql || F_LRTRIm(Campo)|| ' ' || F_LRTRIm(cTipo) || ','; end else begin Sql = Sql || F_LRTRIm(Campo)|| ' ' || F_LRTRIm(cTipo); end End Contador = Contador + 1; End Sql = Sql || ')'; execute statement Sql; --Update RDB$RELATIONS Set RDB$EXTERNAL_FILE = :TablaSal Where -- RDB$RELATION_NAME = :TablaPaso; End Else Begin Borrar = 'Delete from ' || TablaPaso || ' Where Ne =' || Cast(NeDes as VarChar(5)); execute statement Borrar; End end Este sp clona tabla si existe, con FireBird 1.5 Lo otro estoy de administrador del equipo Juan Carlos Última edición por teletranx fecha: 24-03-2004 a las 17:24:51. |
#4
|
||||
|
||||
Comprueba la variable ExternalFileAccess del fichero de configuración de Firebird, si está a None cámbialo a Full
En las Release Notes encontrarás más información (en este link las encontrarás en castellano) http://www.ibphoenix.com/downloads/F...tesSpanish.pdf Saludos.
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no). |
#5
|
||||
|
||||
Por cierto, el fichero de configuración es el firebird.conf.
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no). |
#6
|
|||
|
|||
lei el pdf con la configuración de los Archivos Externos (External Files), probe Full, nada, también probe Restrict C:\ExternalTables, nada
aún tengo el mismo problema |
|
|
|