>Description:
        The following script should insert some files in a table, but load_file seems 
not to work
        I think it is only a small error, but I don't find it.

Command File:

#####################################################################
#!/bin/sh
set -exv
#Fügt die eingescannten Externbefunde in die Datenbank ein

edir=/net/ukh10288/tmpf/externbriefe
cd $edir


rm -f dofile1 dofile2 2>/dev/null
>dofile1
>dofile2


for x in letter*.tif
do
  if [ ! -f $x ]
  then
    break
  fi
  dname=$edir/$x
  echo $dname
  ls -l $dname
  echo "insert into externbefunde values ('XXX111111X', '1901-01-01', NULL, NULL, 
'tif', load_file(\"$dname\"), NULL);" >> dofile1
  echo "rm $dname 2>/dev/null" >> dofile2
done


# echo "delete from externbefunde where izahl = \"XXX111111X\" and bild is null;" >> 
dofile1
/usr/local/bin/mysql -v -v -v -B -u db archiv < dofile1 2>&1
sh dofile2
rm dofile1 dofile2 2>/dev/null
###################################################################################


The output looks like:

ukh3029 ~ [534]$ scan_db.sh 
#Fügt die eingescannten Externbefunde in die Datenbank ein

edir=/net/ukh10288/tmpf/externbriefe
edir=/net/ukh10288/tmpf/externbriefe
cd $edir
+ cd /net/ukh10288/tmpf/externbriefe 


rm -f dofile1 dofile2 2>/dev/null
+ rm -f dofile1 dofile2 
>dofile1
>dofile2


for x in letter*.tif
do
  if [ ! -f $x ]
  then
    break
  fi
  dname=$edir/$x
  echo $dname
  ls -l $dname
  echo "insert into externbefunde values ('XXX111111X', '1901-01-01', NULL, NULL, 
'tif', load_file(\"$dname\"), NULL);" >> dofile1
  echo "rm $dname 2>/dev/null" >> dofile2
done
+ [ ! -f letter0.tif ] 
dname=/net/ukh10288/tmpf/externbriefe/letter0.tif
+ echo /net/ukh10288/tmpf/externbriefe/letter0.tif 
/net/ukh10288/tmpf/externbriefe/letter0.tif
+ ls -l /net/ukh10288/tmpf/externbriefe/letter0.tif 
-rwxrw-rw-   1 nobody4  nogroup  2107944 Apr 30 15:46 
/net/ukh10288/tmpf/externbriefe/letter0.tif
+ echo insert into externbefunde values ('XXX111111X', '1901-01-01', NULL, NULL, 
+'tif', load_file("/net/ukh10288/tmpf/externbriefe/letter0.tif"), NULL); 
+ echo rm /net/ukh10288/tmpf/externbriefe/letter0.tif 2>/dev/null 


# echo "delete from externbefunde where izahl = \"XXX111111X\" and bild is null;" >> 
dofile1
/usr/local/bin/mysql -v -v -v -B -u db archiv < dofile1 2>&1
+ /usr/local/bin/mysql -v -v -v -B -u db archiv 
--------------
insert into externbefunde values ('XXX111111X', '1901-01-01', NULL, NULL, 'tif', 
load_file("/net/ukh10288/tmpf/externbriefe/letter0.tif"), NULL)
--------------

Query OK, 1 row affected (0.01 sec)

Bye
sh dofile2
+ sh dofile2 
rm dofile1 dofile2 2>/dev/null
+ rm dofile1 dofile2 

ukh3029 ~ [535]$ 

#############################################################

The database does not store the file:
mysql> select * from externbefunde where izahl = "XXX111111X" and rowid = 29856;
+------------+------------+------+------+------+------+-------+
| izahl      | datum      | bem1 | bem2 | typ  | bild | rowid |
+------------+------------+------+------+------+------+-------+
| XXX111111X | 1901-01-01 | NULL | NULL | tif  | NULL | 29856 |
+------------+------------+------+------+------+------+-------+
1 row in set (0.00 sec)

mysql> 


What is wrong, and what should I change?


Thank You

Dieter


>How-To-Repeat:
        
>Fix:
        

>Submitter-Id:  <submitter ID>
>Originator:    Dieter Becker
>Organization:
  Dr. med. dipl.-math Dieter Becker           Tel.: (0 / +49) 6841 - 16 3046
  Medizinische Universitaets- und Poliklinik  Fax.: (0 / +49) 6841 - 16 3043
  Innere Medizin III                         
  D - 66421 Homburg / Saar                    Email: [EMAIL PROTECTED]
  
  
>
>MySQL support: email support #791
>Synopsis:      load_file in insert
>Severity:      non-critical
>Priority:      low
>Category:      mysql
>Class:         
>Release:       mysql-3.23.36 (Source distribution)
>Server: /usr/local/bin/mysqladmin  Ver 8.18 Distrib 3.23.36, for sun-solaris2.6 on 
>sparc
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          3.23.36-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 3 days 9 hours 16 min 40 sec

Threads: 42  Questions: 315967  Slow queries: 20  Opens: 28773  Flush tables: 7270  
Open tables: 1 Queries per second avg: 1.080
>Environment:
        
System: SunOS ukh3029 5.6 Generic_105181-17 sun4u sparc SUNW,Ultra-2
Architecture: sun4

Some paths:  /bin/perl /usr/ccs/bin/make /usr/local/bin/gmake /usr/local/bin/gcc 
/d0/workshop/SUNWspro/bin/cc
GCC: Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
gcc version 2.95.2 19991024 (release)
Compilation info: CC='gcc'  CFLAGS=''  CXX='c++'  CXXFLAGS=''  LDFLAGS=''
LIBC: 
-rw-r--r--   1 bin      bin      1607728 Oct 19  1999 /lib/libc.a
lrwxrwxrwx   1 root     root          11 Feb  8  1998 /lib/libc.so -> ./libc.so.1
-rwxr-xr-x   1 bin      bin      1014088 Oct 19  1999 /lib/libc.so.1
-rw-r--r--   1 bin      bin      1607728 Oct 19  1999 /usr/lib/libc.a
lrwxrwxrwx   1 root     root          11 Feb  8  1998 /usr/lib/libc.so -> ./libc.so.1
-rwxr-xr-x   1 bin      bin      1014088 Oct 19  1999 /usr/lib/libc.so.1
Configure command: ./configure  --with-charset=latin1 --with-extra-charsets=all
Perl: This is perl, version 5.005_02 built for sun4-solaris

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to