📄 lobsample.cpp
字号:
/*****************************************************************************************
@author Chandar
@version 1.0
Development Environment : Visual C++ 6.0
Name of the File : LOBSample.cpp
Creation/Modification History :
01-Aug-2001 Created
Sample Overview
---------------
This sample uses ADO functionality with OraOLEDB to communicate to database.
The sample aims at demonstrating the feature of Oracle OLEDB provider for Oracle to
pass LOB parameters to and from a database stored procedure. It also demonstrates
that Oracle provider for OLEDB bypasses PL/SQL limitation of parameter size greater
than 32K to a database stored procedure.The image passed to and from the stored procedure
could be of size greater than 32K.
The property 'SPPrmsLOB' is to be set to true when LOB parameter is used in stored
procedure. The sample shows how to set this property for the command object
When this application is run, product names are retrieved from "Product_Information" table
and shown in the list box in dialog box. When a product is selected from the list its image
is retrieved from database using stored procedure and displayed in "Existing Image "
frame.
In case the product image needs to be changed, the user can select an image by clicking
the "Browse" button, the selected image from the common file dialog is displayed in the
"New Image" frame. To update the the new image in the database "Update" button can be
clicked. The selected image is converted to binary form before insertion. Then a
database stored procedure "setProductImage" is called, to which the selected image is
passed as LOB parameter. The image passed to the stored procedure could be of
size greater than 32K also. This bypasses the PL/SQL limitation of passing parameters
greater than 32K.
Note : The maximum size of image (LOB) that can be passed as OUT parameter to stored
procedure with OraOLEDB is 64K. Images greater than this size may not be
retrieved properly from database.
*******************************************************************************************/
#include "stdafx.h"
#include "LOBSample.h"
#include "LOBSampleDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLOBSampleApp
BEGIN_MESSAGE_MAP(CLOBSampleApp, CWinApp)
//{{AFX_MSG_MAP(CLOBSampleApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLOBSampleApp construction
CLOBSampleApp::CLOBSampleApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CLOBSampleApp object
CLOBSampleApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CLOBSampleApp initialization
BOOL CLOBSampleApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CLOBSampleDlg dlg; //Create dialog box class object
m_pMainWnd = &dlg;
dlg.DoModal(); // Display the dialog box
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -