社区
数据库及相关技术
帖子详情
怎样将Variant类型的数据存入BLOB字段又如何从数据库的BLOB字段读取数据存入Variant类型的变量中
Songzhiq
2004-10-10 12:46:14
如何将Variant类型的数据存入BLOB字段又如何从数据库的BLOB字段读取数据存入Variant类型的变量中?
能提供一些源码吗?十分感谢!!
...全文
122
4
打赏
收藏
怎样将Variant类型的数据存入BLOB字段又如何从数据库的BLOB字段读取数据存入Variant类型的变量中
如何将Variant类型的数据存入BLOB字段又如何从数据库的BLOB字段读取数据存入Variant类型的变量中? 能提供一些源码吗?十分感谢!!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
robbyzi
2004-12-14
打赏
举报
回复
我这有一篇收集的文章你可以看看:
我想把一些文件存进数据库中,这些文件的类型也不统一,有图片,有文档,也有其他格式的,请问数据库的表中,存取这些文件的字段应该选取什么数据类型呀?是sql_variant吗?另外应该怎么在程序中用代码存取呢
下面是一个使用TQuery往content表(主键file_id)中插入一条记录的例子,
script为一个BLOB字段:
TBlobStream *pScriptStream;
//插入一条记录
strSQL1="insert into content(file_id,script,key_image) values('";
strSQL1=strSQL1+m_szFileID+"',null,null)";
dmStoryEditor->qryExec->SQL->Clear();
dmStoryEditor->qryExec->SQL->Add(strSQL1);
dmStoryEditor->qryExec->ExecSQL();
dmStoryEditor->qryExec->Close();
//整理要写入的Blob数据
LockMemories(NewsScript);
NewsScript.GetEdition(NewsScript.m_ScriptHead.byteEditionNum);
NewsScript.m_pScript=(BYTE *)GlobalLock(NewsScript.m_hScript);
if(NewsScript.m_pScript!=NULL)
{
//再将刚插入的记录读出来,使该Query与该条记录关联
strSQL1="select file_id,script from content where file_id='"+
m_szFileID+"'";
//允许该Query写
dmStoryEditor->qryExec->RequestLive=true;
dmStoryEditor->qryExec->SQL->Clear();
dmStoryEditor->qryExec->SQL->Add(strSQL1);
dmStoryEditor->qryExec->Open();
dmStoryEditor->qryExec->First();
//将该Query置为可写
dmStoryEditor->qryExec->Edit();
pScriptStream=new TBlobStream((TBlobField*)dmStoryEditor->
qryExec->FieldByName("script"),bmReadWrite);
pScriptStream->Write(NewsScript.m_pScript,
NewsScript.m_lScriptRealSize);
dmStoryEditor->qryExec->Post();
dmStoryEditor->qryExec->RequestLive=false;
delete pScriptStream;
}
GlobalUnlock(NewsScript.m_hScript);
UnLockMemories(NewsScript);
sqlserver用image数据类型就可以地
lihongxing2002
2004-12-14
打赏
举报
回复
up,把你的代码贴出来啊
Songzhiq
2004-10-10
打赏
举报
回复
我的Variant变量中保存的是二进制流,我不知道如何存入数据库中,又如何从数据库的BLOB类型的字段中
读取数据至Variant变量中。
有高手知道吗?急!!
COKING
2004-10-10
打赏
举报
回复
帖出你存的代码!
FastReport问题集
FastReport问题集 Q: 我怎样添加我的自定义函数? A: 使用 TfrReport.OnUserFunction 事件. 这里有一个简单的例子: procedure TForm1.frReport1UserFunction(const Name: String; p1, p2, p3:
Variant
; var val:
Variant
); begin if AnsiCompareText(‘SUMTOSTR‘, Name) = 0 then val := My_Convertion_Routine(frParser.Calc(p1)); end; 然后,你就可以在报表(任何表达式或脚本)的任何地方使用 SumToStr 函数了。 Q: 但是它仅仅能工作在一个TfrReport组件
中
。可我想在任何地方(在所有的TfrReport组件
中
)使用的我的自定义函数? A: 使 OnUserFunction event 句柄作为所有组件的公用句柄。如果你不能做到这一点,你需要创建函数库: type TMyFunctionLibrary = class(TfrFunctionLibrary) public constructor Create; override; procedure DoFunction(Fno: Integer; p1, p2, p3:
Variant
; var val:
Variant
); override; end; constructor TMyFunctionLibrary.Create; begin inherited Create; with List do begin Add(‘DATETOSTR‘); Add(‘SUMTOSTR‘); end; end; procedure TMyFunctionLibrary.DoFunction(Fno: Integer; p1, p2, p3:
Variant
; var val:
Variant
); begin val := 0; case Fno of 0: val := My_DateConvertion_Routine(frParser.Calc(p1)); 1: val := My_SumConvertion_Routine(frParser.Calc(p1)); end; end; 要注册函数库,调用 frRegisterFunctionLibrary(TMyFunctionLibrary); 要卸载函数库,调用 frUnRegisterFunctionLibrary(TMyFunctionLibrary); Q: 我怎样将我的函数添加到函数列表
中
(用表达式生成器)? A: 使用 frAddFunctionDesc 过程 (在FR_Class 单元
中
): frAddFunctionDesc(FuncLib, ‘SUMTOSTR‘, ‘My functions‘, ‘SUMTOSTR(
)/Converts number to its verbal presentation.‘); 注意: "/" 符号是必须的! 它从它的描述
中
分隔函数语法。 FuncLib 被声明为你自己的函数库 (如果你不使用函数库可以将其设置为nil). 当函数库未注册时,所有它的函数将自动从函数列表
中
删除。 ---------------- 使用
变量
------------------------------------- Q: 我怎样编程实现填充
变量
列表(在
数据
词典
中
)? A:
数据
词典
中
的所有
变量
及分类都被存储在 TfrReport.Dictionary.Variables
中
. with frReport1.Dictionary do begin // 创建分类(名称用空白) Variables[‘ New category‘] := ‘‘; // 创建
变量
Variables[‘New Variable‘] := ‘CustomerData.Customers."CustNo"‘; Variables[‘Another Variable‘] := ‘Page#‘; end; Q: 我定义了字符串
变量
: with frReport1.Dictionary do Variables[‘Month‘] := ‘March‘; 但是当我运行报表是,出现了错误,为什么? A: 因为 FastReport 假定
数据
词典
中
的字符串
变量
值是一个表达式,它需要分析、计算它。 可以使用其它的方法: with frReport1.Dictionary do Variables[‘Month‘] := ‘‘‘‘ + ‘March‘ + ‘‘‘‘; 或者, 使用 frVariables 来传输固定
数据
到报表。 Q: 我不想在
数据
词典
中
显示某些
数据
集? A: 使用 TfrReport.Dictionary.DisabledDatasets: with frReport1.Dictionary do begin // 关闭该
数据
集 DisabledDatasets.Add(‘CustomerData.Bio‘); // 或者, 关闭整个
数据
模块/窗体 DisabledDatasets.Add(‘CustomerData*‘); end; Q: 我怎样将
数据
传送到报表? A: 有几个方法可以实现它. 第一是使用全局对象 frVariables (在 FR_Class 单元
中
被定义): frVariables[‘My variable‘] := 10; 这段代码创建了一个名称为“My variable”,值为 10 的
变量
。这是最好的传输固定
数据
的报表的方法。 第二种方法是使用 TfrReport.OnGetValue 事件. 这可以使用这个方法来传送动态
数据
、记录等。 procedure TForm1.frReport1GetValue(ParName: String; var ParValue:
Variant
); begin if ParName = ‘MyField‘ then ParValue := Table1MyField.Value; end; 最后, 第三种方法是通过编程在
数据
词典
中
定义
变量
(可以参考以前的问题): with frReport1.Dictionary do begin Variables[‘MyVariable‘] := ‘CustomerData.Customers."CustNo"‘; Variables[‘Another Variable‘] := ‘10‘; end; Q: 我能在报表和程序间传送
数据
吗? A: 使用 frVariables 对象. 如果你在报表的任何对象的脚本
中
写入以下代码: MyVariable := 10 那么,在你的程序
中
,你可以使用以下代码来获取 MyVariable 的值: v := frVariables[‘MyVariable‘]; ---------------- 脚本 (FastReport Pascal) --------------------------------- Q: Band
中
是否可以使用脚本? A: 当然. 选择 band ,然后按 Ctrl+Enter 或在对象浏览器
中
选择 "OnBeforePrint" 属性。 Q: 报表页
中
是否可以使用脚本? A: 当然. 选择页 (在空白处单击) ,然后在对象浏览器
中
选择 "OnBeforePrint" 属性。如果该页是一个对话框窗体,那么这个属性就是 "OnActivate". Q: 我有两个对象: Memo1 和 Memo2. 我能否在 Memo1 的脚本
中
调用 Memo2 的属性和方法? A: 当然, 例如,你可以这样做: 对象名.属性名. Q: 在脚本
中
,我可以使用对象的哪些属性? A: 几乎所有你能在对象浏览器
中
看到的属性。例如,可以使用 Font.Name, Font.Size等来存取字体属性。 ---------------- 其它问题 -------------------------------------------- Q: 怎样改变多页报表
中
某一页的顺序? A: 拖动页标签到目的位置。 Q: 我想查看所有的
字段
及
变量
,我想在报表
中
使用列表来实现它? A: 设置 TfrReport.MixVariablesAndDBFields := True.现在,所有的
数据
字段
及
变量
可在“插入
数据
字段
”对话框
中
可存取了。 Q: 我不想显示导入选项对话框? A: 在导入组件(比如,TfrTextExport)
中
设置所有必需的选项,然后通过设置ShowDialog属性为False来关闭此对话框。 Q: 为什么 TotalPages
变量
不起作用? 它总是返回 0. A: 在你的报表
中
设置 Two-pass 选项. 要设置它,你需要在报表设计器的“文件”菜单
中
,打开“报表选项”对话框。 Q: 我用
BLOB
字段
来存储我的报表。当我运行报表设计器时,它显示我的报表未命名? A: 在运行报表设计器前,这样做: frReport1.FileName := ‘Name of my report‘; Q: 我想在重新定义报表设计器
中
的“打开”及“保存”按钮的功能? A: 查看 TfrDesigner 组件. 它有几个必需的事件: OnLoadReport 和 OnSaveReport. 这里有一小段代码例子: procedure TForm1.frDesigner1LoadReport(Report: TfrReport; var ReportName: String; var Opened: Boolean); begin with MyOpenDialog do begin Opened := ShowModal = mrOk; if Opened then begin Report.LoadFrom
Blob
Field(…); ReportName := …; end; end; end; procedure TForm1.frDesigner1SaveReport(Report: TfrReport; var ReportName: String; SaveAs: Boolean; var Saved: Boolean); begin if SaveAs then with MySaveDialog do begin Saved := ShowModal = mrOk; if Saved then begin Report.SaveTo
Blob
Field(…); ReportName := …; end; end else Report.SaveTo
Blob
Field(…); end; Q: 在 QR
中
, 我可以写这样的代码: QRLabel1.Caption := ‘Some text‘. 我可以用FR这样做吗? A: FR 对象并不是一个组件 (这并不像 QR, RB). 但使用 TfrReport.FindObject 方法可以通过对象名称找到该对象。 var t: TfrMemoView; begin t := TfrMemoView(frReport1.FindObject(‘Memo1‘)); if t <> nil then t.Memo.Text := ‘FastReport‘; end; Q: 我想在用户预览(TfrPreview组件)
中
自定义热键? A: 这个组件有个窗口: Tform 属性. 将自定义句柄指定到 Window.OnKeyDown 属性. Q: Fast Report 2.4 不能装载 FreeReport 2.21 文件? A: 这仅需要使用16进制数改变报表文件的第一字节,然后在源代码
中
修改下面的部分。在这些修改之后, 装载报表并保存它. 最后,返回到源代码处. FR_Class: function ReadString(Stream: Tstream): String; begin { if frVersion >= 23 then} Result := frReadString(Stream) {else Result := frReadString22(Stream);} end; procedure ReadMemo(Stream: Tstream; Memo: Tstrings); begin { if frVersion >= 23 then} frReadMemo(Stream, Memo){ else frReadMemo22(Stream, Memo);} end; FR_Utils: procedure frReadMemo(Stream: Tstream; l: Tstrings); var s: String; b: Byte; n: Word; begin l.Clear; l.Text := frReadString(Stream); exit; Stream.Read(n, 2); if n > 0 then repeat Stream.Read(n, 2); SetLength(s, n); Stream.Read(s[1], n); l.Add(s); Stream.Read(b, 1); until b = 0 else Stream.Read(b, 1); end; function frReadString(Stream: Tstream): String; var s: String; n: Integer; b: Byte; begin Stream.Read(n, 4); SetLength(s, n); Stream.Read(s[1], n); if (n > 0) and (s[n] = #$0A) then SetLength(s, n - 2); // Stream.Read(b, 1); Result := s; end; Q: 怎样不在打印预览
中
打印报表? A: 这里有一段代码: frReport1.PrepareReport; frReport1.PrintPreparedReport(‘‘, 1, True, frAll); 或 frReport1.PrintPreparedReportDlg; Q: 我想在报表
中
旋转图片。问题是这张图片是由我的应用程序生成的。是否有方法可以在打印前将这幅图片装载到报表
中
? A: 使用 TfrReport.OnBeforePrint 事件: if View.Name = ‘Picture1‘ then TfrPictureView(View).Picture.LoadFromFile(…) 或 .Assign 或 .你所想要做的任何事情
GenomicsDB:C ++
中
的高性能
数据
存储,用于导入,查询和转换带有CC ++ JavaSpark绑定的变体
数据
。 在gatk4
中
使用
主 开发 GenomicsDB(最初来自 )建立在和基于图块的阵列存储系统的基础上,用于导入,查询和转换变体
数据
。 变异
数据
本质上是稀疏的(相对于整个基因组稀疏),并且使用稀疏数组
数据
存储非常适合存储此类
数据
。 GenomicsDB是用C ++编写的高性能可扩展
数据
存储,用于导入,查询和转换基因组变异
数据
。 支持的平台:Linux和MacOS。 支持的文件系统:POSIX,HDFS,EMRFS(S3),GCS和Azure
Blob
。 包括 JVM / Spark包装器,除其他功能外,还允许将缓冲区与C ++层进行流传输。 带有本机库且仅zlib依赖项的GenomicsDB jar定期在
Delphi7.1 Update
Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver
org.eclipse.swt.win32
org.eclipse.swt.SWT.class org.eclipse.swt.SWTError.class org.eclipse.swt.SWTException.class org.eclipse.swt.accessibility.ACC.class org.eclipse.swt.accessibility.Accessible.class org.eclipse.swt.accessibility.AccessibleActionAdapter.class org.eclipse.swt.accessibility.AccessibleActionEvent.class org.eclipse.swt.accessibility.AccessibleActionListener.class org.eclipse.swt.accessibility.AccessibleAdapter.class org.eclipse.swt.accessibility.AccessibleAttributeAdapter.class org.eclipse.swt.accessibility.AccessibleAttributeEvent.class org.eclipse.swt.accessibility.AccessibleAttributeListener.class org.eclipse.swt.accessibility.AccessibleControlAdapter.class org.eclipse.swt.accessibility.AccessibleControlEvent.class org.eclipse.swt.accessibility.AccessibleControlListener.class org.eclipse.swt.accessibility.AccessibleEditableTextAdapter.class org.eclipse.swt.accessibility.AccessibleEditableTextEvent.class org.eclipse.swt.accessibility.AccessibleEditableTextListener.class org.eclipse.swt.accessibility.AccessibleEvent.class org.eclipse.swt.accessibility.AccessibleHyperlinkAdapter.class org.eclipse.swt.accessibility.AccessibleHyperlinkEvent.class org.eclipse.swt.accessibility.AccessibleHyperlinkListener.class org.eclipse.swt.accessibility.AccessibleListener.class org.eclipse.swt.accessibility.AccessibleTableAdapter.class org.eclipse.swt.accessibility.AccessibleTableCellAdapter.class org.eclipse.swt.accessibility.AccessibleTableCellEvent.class org.eclipse.swt.accessibility.AccessibleTableCellListener.class org.eclipse.swt.accessibility.AccessibleTableEvent.class org.eclipse.swt.accessibility.AccessibleTableListener.class org.eclipse.swt.accessibility.AccessibleTextAdapter.class org.eclipse.swt.accessibility.AccessibleTextAttributeEvent.class org.eclipse.swt.accessibility.AccessibleTextEvent.class org.eclipse.swt.accessibility.AccessibleTextExtendedAdapter.class org.eclipse.swt.accessibility.AccessibleTextExtendedListener.class org.eclipse.swt.accessibility.AccessibleTextListen
QT通过MySQL
BLOB
字段
类型
插入或者读取图片
MySQL
数据
库
要想插入图片,其
字段
需要是
BLOB
类型
。
BLOB
(binary large object),二进制大对象,是一个可以存储二进制文件的容器。 在计算机
中
,
BLOB
常常是
数据
库
中
用来存储二进制文件的
字段
类型
。
BLOB
是一个大文件,典型的
BLOB
是一张图片或一个声音文件,由于它们的尺寸,必须使用特殊的方式来处理(例如:上传、下载或者存放到一个
数据
库
)。 MySQL
中
,
BLOB
是个
类型
系列,包括:Tiny
Blob
、
Blob
、Medium
Blob
、Long
Blob
,这几个
类型
之间的唯一区别
数据库及相关技术
1,178
社区成员
18,939
社区内容
发帖
与我相关
我的任务
数据库及相关技术
C++ Builder 数据库及相关技术
复制链接
扫一扫
分享
社区描述
C++ Builder 数据库及相关技术
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章