首页 > 数据库 > 国内数据库 > GBase8s BLOB类型使用操作示例
|
create table "gbasedbt".tab1 ( col1 integer, col2 "gbasedbt".blob ) extent size 16 next size 64 lock mode row;
|
1 )server端blob数据文件插入本地数据库
|
[gbasedbt@test2 ~]$ dbaccess dbutf8 - 数据库已被选用。 > insert into tab1 values (1,filetoblob('/home/gbasedbt/blobtest.png','server')); 1 行被插入。
|
2 )客户端blob数据文件插入数据库:
如下图示例,使用客户端工具查询blob数据 :
|
> ^C[gbasedbt@test2 ~]$ dbaccess dbutf8 - 数据库已被选用。 > select lotofile(col2,'/home/gbasedbt/blobtest2.png','server') from tab1 where col1 = 1; (expression) /home/gbasedbt/blobtest2.png.000000005d6f9d9c 查询到 1 行。
[gbasedbt@test2 ~]$ ls -rlt blobtest2.png.000000005d6f9d9c -rw-rw-rw-. 1 gbasedbt gbasedbt 147571 7 月 21 05:12 blobtest2.png.000000005d6f9d9c |
|
[gbasedbt@test2 ~]$ dbaccess dbutf8 - 数据库已被选用。 > create table tab2(col3 int,col4 blob); 表已建妥。
> insert into tab2 values (1,filetoblob('/home/gbasedbt/blobtest.png','server')); 1 行被插入。
> update tab2(col4) set col4=(select locopy(col2) from tab1 where tab1.col1=1) where tab2.col3=1; 1 行被更新。
|
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69978212/viewspace-2726209/ ,如需转载,请注明出处,否则将追究法律责任。