|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
MySQL部署迅速,因此移植过程不会导致生产中断。而且,较短的学习曲线可以让你的系统管理员迅速掌握它的运行和维护。而且,MySQL的易于维护和管理意味着目前的职员可以处理目前的工作。静态|语句1.DynamicSQLFormat1
EXECUTEIMMEDIATESQLStatement{USINGTransactionObject};
eg:
stringMysql
Mysql="CREATETABLEEmployee"&
+"(emp_idintegernotnull,"&
+"dept_idintegernotnull,"&
+"emp_fnamechar(10)notnull,"&
+"emp_lnamechar(20)notnull)"
EXECUTEIMMEDIATE:Mysql;
2.DynamicSQLFormat2
PREPAREDynamicStagingAreaFROMSQLStatement{USINGTransactionObject};
EXECUTEDynamicStagingAreaUSING{ParameterList};
eg:
INTEmp_id_var=56
PREPARESQLSA
FROM"DELETEFROMemployeeWHEREemp_id=?";
EXECUTESQLSAUSING:Emp_id_var;
3.DynamicSQLFormat3
DECLARECursor|ProcedureDYNAMICCURSOR|PROCEDUREFORDynamicStagingArea;
PREPAREDynamicStagingAreaFROMSQLStatement{USINGTransactionObject};
OPENDYNAMICCursor{USINGParameterList};
EXECUTEDYNAMICProcedure{USINGParameterList};
FETCHCursor|ProcedureINTOHostVariableList;
CLOSECursor|Procedure;
eg:
integerEmp_id_var
DECLAREmy_cursorDYNAMICCURSORFORSQLSA;
PREPARESQLSAFROM"SELECTemp_idFROMemployee";
OPENDYNAMICmy_cursor;
FETCHmy_cursorINTO:Emp_id_var;
CLOSEmy_cursor;
4.DynamicSQLFormat4
DECLARECursor|ProcedureDYNAMICCURSOR|PROCEDUREFORDynamicStagingArea;
PREPAREDynamicStagingAreaFROMSQLStatement{USINGTransactionObject};
DESCRIBEDynamicStagingAreaINTODynamicDescriptionArea;
OPENDYNAMICCursor|ProcedureUSINGDESCRIPTORDynamicDescriptionArea;
EXECUTEDYNAMICCursor|ProcedureUSINGDESCRIPTORDynamicDescriptionArea;
FETCHCursor|ProcedureUSINGDESCRIPTORDynamicDescriptionArea;
CLOSECursor|Procedure;
eg:
stringStringvar,Sqlstatement
integerIntvar
Sqlstatement="SELECTemp_idFROMemployee"
PREPARESQLSAFROM:Sqlstatement;
DESCRIBESQLSAINTOSQLDA;
DECLAREmy_cursorDYNAMICCURSORFORSQLSA;
OPENDYNAMICmy_cursorUSINGDESCRIPTORSQLDA;
FETCHmy_cursorUSINGDESCRIPTORSQLDA;
//IftheFETCHissuccessful,theoutput
//descriptorarraywillcontainreturned
//valuesfromthefirstrowoftheresultset.
//SQLDA.NumOutputscontainsthenumberof
//outputdescriptors.
//TheSQLDA.OutParmTypearraywillcontain
//NumOutputentriesandeachentrywillcontain
//anvalueoftheenumerateddatatypeParmType
//(suchasTypeInteger!,orTypeString!).
CHOOSECASESQLDA.OutParmType[1]
CASETypeString!
Stringvar=GetDynamicString(SQLDA,1)
CASETypeInteger!
Intvar=GetDynamicNumber(SQLDA,1)
ENDCHOOSE
CLOSEmy_cursor;
据我的观察,现在有一个趋势,那些经过正式培训的数据库管理员DBA更倾向于选择一个专有关系数据库,例如Oracle。对于一些具有专门数据库管理员的比较大的环境来说,MySQL很难得到宠爱,这时候,关于MySQL是否真的具有良好的可扩展性的争论已经没有意义。 |
|