将MySQL模式转换为Github Wiki?

我正在使用GitHub Wiki页面记录一个项目,现在我想将MySQL数据库模式导出为markdown格式。有没有办法将CLI输出转换为GitHub Wiki md?理想情况下作为表格。

慕容3067478
浏览 621回答 2
2回答

GCT1015

此代码很长。我道歉。它由两个存储过程组成。您可能会满意只运行第一个。第二个使用第一个的输出(数据在表中第一个保留)。您可能还希望将代码合并为一个。但是我将它们分开。第二个存储的proc产生类似于的输出describe myTable。但是它将对您需要此类输出的数据库中的所有表执行此操作。通过为数据库传递要报告的参数(字符串)来使用它。我创建了一个单独的数据库,并且代码按名称显式引用了该数据库中的表。因此,如果您EXECUTE对此存储过程有特权,则可以从任何当前数据库中运行它。因此,作为一个简单的测试,不要将报告数据库设置为当前数据库,而只需按名称(使用报告数据库名称限定)来调用存储过程。这全部显示在下面的测试块中。两种存储过程CREATE SCHEMA Reporting101a;&nbsp; &nbsp; -- See **Note1**DROP PROCEDURE IF EXISTS `Reporting101a`.`describeTables_v2a`;DELIMITER $$CREATE DEFINER=`root`@`localhost` PROCEDURE `Reporting101a`.`describeTables_v2a`(&nbsp; &nbsp; IN dbName varchar(100), -- the dbname to report table structures&nbsp; &nbsp; OUT theSession int, -- OUT parameter for session# assigned&nbsp; &nbsp; IN deleteSessionRows BOOL, -- true for delete rows when done from main reporting table for this session#&nbsp; &nbsp; IN callTheSecondStoredProc BOOL -- TRUE = output is from Pretty output in Second Stored Proc. FALSE= not so pretty output)BEGIN&nbsp; &nbsp; DECLARE thisTable CHAR(100);&nbsp; &nbsp; DROP TEMPORARY TABLE IF EXISTS Reporting101a.tOutput;&nbsp; &nbsp; CREATE TEMPORARY TABLE Reporting101a.tOutput&nbsp; &nbsp; (&nbsp; &nbsp;id int auto_increment primary key,&nbsp; &nbsp; &nbsp; &nbsp; tblName varchar(100) not null,&nbsp; &nbsp; &nbsp; &nbsp; ordVal int not null,&nbsp; &nbsp; &nbsp; &nbsp; cField varchar(100) not null,&nbsp; &nbsp; &nbsp; &nbsp; cType varchar(100) not null,&nbsp; &nbsp; &nbsp; &nbsp; cNull varchar(100) not null,&nbsp; &nbsp; &nbsp; &nbsp; cKey varchar(100) not null,&nbsp; &nbsp; &nbsp; &nbsp; cDefault varchar(100) null,&nbsp; &nbsp; &nbsp; &nbsp; cExtra varchar(100) null&nbsp; &nbsp; );&nbsp; &nbsp; DROP TEMPORARY TABLE IF EXISTS Reporting101a.tOutput2;&nbsp; &nbsp; CREATE TEMPORARY TABLE Reporting101a.tOutput2&nbsp; &nbsp; (&nbsp; &nbsp;tblName varchar(100) primary key,&nbsp; &nbsp; &nbsp; &nbsp; colCount int not null,&nbsp; &nbsp; &nbsp; &nbsp; cFieldMaxLen int not null,&nbsp; &nbsp; &nbsp; &nbsp; cTypeMaxLen int not null,&nbsp; &nbsp; &nbsp; &nbsp; cNullMaxLen int not null,&nbsp; &nbsp; &nbsp; &nbsp; cKeyMaxLen int not null,&nbsp; &nbsp; &nbsp; &nbsp; cDefaultMaxLen int not null,&nbsp; &nbsp; &nbsp; &nbsp; cExtraMaxLen int not null&nbsp; &nbsp; );&nbsp; &nbsp; INSERT Reporting101a.tOutput(tblName,ordVal,cField,cType,cNull,cKey,cDefault,cExtra)&nbsp; &nbsp; SELECT TABLE_NAME,ORDINAL_POSITION,COLUMN_NAME AS Field, COLUMN_TYPE AS TYPE, RPAD(IS_NULLABLE,4,' ') AS 'Null',&nbsp;&nbsp; &nbsp; RPAD(COLUMN_KEY,3,' ') AS 'Key',RPAD(COLUMN_DEFAULT,7,' ') AS 'DEFAULT',EXTRA AS Extra&nbsp; &nbsp; FROM information_schema.columns WHERE table_schema = dbName ORDER BY table_name,ordinal_position;&nbsp;&nbsp; &nbsp; -- select * from information_schema.columns WHERE table_schema = '57security' order by table_name,ordinal_position;&nbsp;&nbsp; &nbsp; UPDATE Reporting101a.tOutput&nbsp; &nbsp; SET cExtra='&nbsp; &nbsp; &nbsp;'&nbsp; &nbsp; WHERE cExtra='';&nbsp; &nbsp; UPDATE Reporting101a.tOutput&nbsp; &nbsp; SET cField=RPAD(cField,5,' ')&nbsp; &nbsp; WHERE LENGTH(cField)<5;&nbsp; &nbsp; INSERT Reporting101a.tOutput2(tblName,colCount,cFieldMaxLen,cTypeMaxLen,cNullMaxLen,cKeyMaxLen,cDefaultMaxLen,cExtraMaxLen)&nbsp; &nbsp; SELECT tblName,COUNT(*),0,0,0,0,0,0&nbsp;&nbsp; &nbsp; FROM Reporting101a.tOutput&nbsp;&nbsp; &nbsp; GROUP BY tblName;&nbsp; &nbsp; UPDATE tOutput2 t2&nbsp; &nbsp; JOIN&nbsp; &nbsp; (&nbsp; &nbsp;SELECT tblName,MAX(LENGTH(cField)) AS mField,MAX(LENGTH(cType)) AS mType,MAX(LENGTH(cNull)) AS mNull,&nbsp; &nbsp; &nbsp; &nbsp; IFNULL(MAX(LENGTH(cKey)),0) AS mKey,IFNULL(MAX(LENGTH(cDefault)),0) AS mDefault,IFNULL(MAX(LENGTH(cExtra)),0) AS mExtra&nbsp; &nbsp; &nbsp; &nbsp; FROM Reporting101a.tOutput&nbsp; &nbsp; &nbsp; &nbsp; GROUP BY tblName&nbsp; &nbsp; ) x&nbsp; &nbsp; ON x.tblName=t2.tblName&nbsp; &nbsp; SET t2.cFieldMaxLen=x.mField,t2.cTypeMaxLen=x.mType,cNullMaxLen=x.mNull,&nbsp; &nbsp; cKeyMaxLen=x.mKey,cDefaultMaxLen=x.mDefault,cExtraMaxLen=x.mExtra;&nbsp; &nbsp; -- DROP TABLE Reporting101a.reportDataDefsSession; -- useful for quick change of structure of table&nbsp; &nbsp; -- note, keep above drop call remmed out ! Just use it for quick tweaks to structure&nbsp; &nbsp; CREATE TABLE IF NOT EXISTS Reporting101a.reportDataDefsSession&nbsp; &nbsp; (&nbsp; &nbsp;-- for the sole purpose of safe session auto_inc usage&nbsp; &nbsp; &nbsp; &nbsp; -- Please don't delete unless you want the sessions to experience aberant behavior&nbsp; &nbsp; &nbsp; &nbsp; sessionId INT AUTO_INCREMENT PRIMARY KEY,&nbsp; &nbsp; &nbsp; &nbsp; dummy CHAR(1) NOT NULL,&nbsp; &nbsp; &nbsp; &nbsp; creationDT datetime not null&nbsp; &nbsp; );&nbsp; &nbsp; CREATE TABLE IF NOT EXISTS Reporting101a.reportDataDefs&nbsp; &nbsp; (&nbsp; &nbsp;sessionId INT NOT NULL,&nbsp; &nbsp; &nbsp; &nbsp; tblName VARCHAR(100) NOT NULL,&nbsp; -- Tablename&nbsp; &nbsp; &nbsp; &nbsp; ordVal INT NOT NULL,&nbsp; &nbsp; -- the "position number" of the Column&nbsp; &nbsp; &nbsp; &nbsp; cField VARCHAR(100) NOT NULL,&nbsp; &nbsp;-- The Column&nbsp; &nbsp; &nbsp; &nbsp; cType VARCHAR(100) NOT NULL,&nbsp; &nbsp; -- Datatype&nbsp; &nbsp; &nbsp; &nbsp; cNull VARCHAR(100) NOT NULL,&nbsp; &nbsp; -- Nullability&nbsp; &nbsp; &nbsp; &nbsp; cKey VARCHAR(100) NOT NULL, -- Key info&nbsp; &nbsp; &nbsp; &nbsp; cDefault VARCHAR(100) NULL, -- Default value&nbsp; &nbsp; &nbsp; &nbsp; cExtra VARCHAR(100) NULL,&nbsp; &nbsp;-- Extra output&nbsp; &nbsp; &nbsp; &nbsp; colCount INT NOT NULL,&nbsp; -- the columns here and below are de-normalize data&nbsp; &nbsp; &nbsp; &nbsp; cFieldMaxLen INT NOT NULL,&nbsp; &nbsp; &nbsp; &nbsp; cTypeMaxLen INT NOT NULL,&nbsp; &nbsp; &nbsp; &nbsp; cNullMaxLen INT NOT NULL,&nbsp; &nbsp; &nbsp; &nbsp; cKeyMaxLen INT NOT NULL,&nbsp; &nbsp; &nbsp; &nbsp; cDefaultMaxLen INT NOT NULL,&nbsp; &nbsp; &nbsp; &nbsp; cExtraMaxLen INT NOT NULL&nbsp; &nbsp; );&nbsp; &nbsp; -- For lack of a better notion, we are calling calls "sessions". The programmer calls the&nbsp; &nbsp; -- First Stored Proc, and we call that a session after we get a unique next incrementing number.&nbsp; &nbsp; -- That number is the session #. House all output with that as a column value. This allows us to&nbsp;&nbsp; &nbsp; -- move between stored procs, have safe output, have historical snapshots, and retain the data&nbsp;&nbsp; &nbsp; -- via a session # for later use, whatever use.&nbsp; &nbsp; INSERT Reporting101a.reportDataDefsSession(dummy,creationDT) VALUES ('X',now());&nbsp; &nbsp; SET @mySession=LAST_INSERT_ID(); -- there it is, our session # (read the above paragraph)&nbsp; &nbsp; INSERT Reporting101a.reportDataDefs(sessionId,tblName,ordVal,cField,cType,cNull,cKey,cDefault,cExtra,&nbsp; &nbsp; colCount,cFieldMaxLen,cTypeMaxLen,cNullMaxLen,cKeyMaxLen,cDefaultMaxLen,cExtraMaxLen)&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; SELECT @mySession,t1.tblName,t1.ordVal,t1.cField,t1.cType,t1.cNull,t1.cKey,t1.cDefault,t1.cExtra,&nbsp; &nbsp; t2.colCount,t2.cFieldMaxLen,t2.cTypeMaxLen,t2.cNullMaxLen,t2.cKeyMaxLen,t2.cDefaultMaxLen,t2.cExtraMaxLen&nbsp;&nbsp; &nbsp; FROM Reporting101a.tOutput t1&nbsp; &nbsp; JOIN Reporting101a.tOutput2 t2&nbsp; &nbsp; ON t2.tblName=t1.tblName&nbsp; &nbsp; ORDER BY t1.tblName,t1.id;&nbsp; &nbsp; DROP TEMPORARY TABLE Reporting101a.tOutput;&nbsp; &nbsp; DROP TEMPORARY TABLE Reporting101a.tOutput2;&nbsp; &nbsp; SET theSession=@mySession; -- the OUT var that came in as a parameter&nbsp; &nbsp; -- ***************************************************************************&nbsp; &nbsp; -- ***************************************************************************&nbsp; &nbsp; -- Label "Some_Sort_of_Output":&nbsp; &nbsp; IF callTheSecondStoredProc=TRUE THEN&nbsp; &nbsp; &nbsp; &nbsp; -- The caller says to call the second stored proc (for Pretty Printing)&nbsp; &nbsp; &nbsp; &nbsp; -- This will generate output similar to `DESCRIBE myTable`&nbsp; &nbsp; &nbsp; &nbsp; -- But remember, it will do it&nbsp; for EVERY table in referenced database&nbsp; &nbsp; &nbsp; &nbsp; CALL Reporting101a.`Print_Tables_Like_Describe`(@mySession);&nbsp; &nbsp; &nbsp; &nbsp; -- The above call just gave you output.&nbsp; &nbsp; ELSE&nbsp; &nbsp; &nbsp; &nbsp; -- The caller chose to not auto call the Pretty Printing second stored procedure.&nbsp; &nbsp; &nbsp; &nbsp; -- Note, the caller can easily call it right after using the OUT parameter.&nbsp; &nbsp; &nbsp; &nbsp; -- So our output will be a resultset of out reportDataDefs table for this session #&nbsp; &nbsp; &nbsp; &nbsp; SELECT *&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; FROM Reporting101a.reportDataDefs&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; WHERE sessionId=@mySession&nbsp; &nbsp; &nbsp; &nbsp; ORDER BY tblName,ordVal;&nbsp; &nbsp; END IF;&nbsp; &nbsp; -- ***************************************************************************&nbsp; &nbsp; -- ***************************************************************************&nbsp; &nbsp; IF deleteSessionRows=TRUE THEN&nbsp; &nbsp; &nbsp; &nbsp; -- The caller says output rows are NOT needed at this point. Delete them.&nbsp; &nbsp; &nbsp; &nbsp; -- Note, if this boolean comes in TRUE, you can't call Pretty Printing&nbsp; &nbsp; &nbsp; &nbsp; -- second stored procedure with the session # because the data is gone.&nbsp; &nbsp; &nbsp; &nbsp; --&nbsp; &nbsp; &nbsp; &nbsp; -- Regardless, you are getting something back from "Some_Sort_of_Output" above.&nbsp; &nbsp; &nbsp; &nbsp; DELETE FROM Reporting101a.reportDataDefs&nbsp; &nbsp; &nbsp; &nbsp; WHERE sessionId=@mySession;&nbsp; &nbsp; END IF;END$$DELIMITER ;DROP PROCEDURE IF EXISTS `Reporting101a`.`Print_Tables_Like_Describe`;DELIMITER $$CREATE DEFINER=`root`@`localhost` PROCEDURE `Reporting101a`.`Print_Tables_Like_Describe`(&nbsp; &nbsp; pSessionId INT)BEGIN&nbsp; &nbsp; DECLARE done INT DEFAULT FALSE;&nbsp; &nbsp; DECLARE curTable VARCHAR(100) DEFAULT '';&nbsp; &nbsp; DECLARE bFirst BOOL DEFAULT TRUE;&nbsp; &nbsp; DECLARE lv_tblName,lv_cField,lv_cType,lv_cNull,lv_cKey,lv_cDefault,lv_cExtra VARCHAR(100);&nbsp; &nbsp; DECLARE lv_ordVal,lv_colCount,lv_cFieldMaxLen,lv_cTypeMaxLen,lv_cNullMaxLen,lv_cKeyMaxLen,lv_cDefaultMaxLen,lv_cExtraMaxLen INT;&nbsp; &nbsp; DECLARE cur1 CURSOR FOR SELECT tblName,ordVal,cField,cType,cNull,cKey,cDefault,cExtra,&nbsp; &nbsp; colCount,cFieldMaxLen,cTypeMaxLen,cNullMaxLen,cKeyMaxLen,cDefaultMaxLen,cExtraMaxLen&nbsp;&nbsp; &nbsp; FROM Reporting101a.reportDataDefs&nbsp; &nbsp; WHERE sessionId=pSessionId&nbsp; &nbsp; ORDER BY tblName,ordVal;&nbsp; &nbsp; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;&nbsp; &nbsp; -- Please note in the above, CURSOR stuff must come last else "Error 1337: Variable or condition decl aft curs"&nbsp;&nbsp; &nbsp; CREATE TABLE IF NOT EXISTS Reporting101a.reportOutput&nbsp; &nbsp; (&nbsp; &nbsp;lineNum INT AUTO_INCREMENT PRIMARY KEY,&nbsp; &nbsp; &nbsp; &nbsp; sessionId INT NOT NULL,&nbsp; &nbsp; &nbsp; &nbsp; lineOut varchar(100) NOT NULL&nbsp; &nbsp; );&nbsp; &nbsp; -- INSERT Reporting101a.reportOutput(sessionId,lineOut)&nbsp; &nbsp; -- SELECT&nbsp;&nbsp; &nbsp; -- SET curTable='';&nbsp; &nbsp; DELETE FROM Reporting101a.reportOutput&nbsp; &nbsp; WHERE sessionId=pSessionId;&nbsp; &nbsp; OPEN cur1;&nbsp; &nbsp; read_loop: LOOP&nbsp; &nbsp; &nbsp; &nbsp; FETCH cur1 INTO lv_tblName,lv_ordVal,lv_cField,lv_cType,lv_cNull,lv_cKey,lv_cDefault,lv_cExtra,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lv_colCount,lv_cFieldMaxLen,lv_cTypeMaxLen,lv_cNullMaxLen,lv_cKeyMaxLen,lv_cDefaultMaxLen,lv_cExtraMaxLen ;&nbsp; &nbsp; &nbsp; &nbsp; IF done THEN&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LEAVE read_loop;&nbsp; &nbsp; &nbsp; &nbsp; END IF;&nbsp; &nbsp; &nbsp; &nbsp; IF lv_tblName<>curTable THEN&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IF bFirst=FALSE THEN&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INSERT Reporting101a.reportOutput(sessionId,lineOut)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT pSessionId,'';&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ELSE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SET bFirst=FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; END IF;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INSERT Reporting101a.reportOutput(sessionId,lineOut)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT pSessionId,lv_tblName;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INSERT Reporting101a.reportOutput(sessionId,lineOut)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT pSessionId,CONCAT('+-',&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT('-',GREATEST(5,lv_cFieldMaxLen)),&nbsp; '-+-',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT('-',GREATEST(4,lv_cTypeMaxLen)), '-+-',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT('-',GREATEST(4,lv_cNullMaxLen)), '-+-',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT('-',GREATEST(3,lv_cKeyMaxLen)),&nbsp; '-+-',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT('-',GREATEST(7,lv_cDefaultMaxLen)),&nbsp; '-+-',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT('-',GREATEST(5,lv_cExtraMaxLen)),&nbsp; &nbsp; '-+');&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SET @dashLineNumRow=LAST_INSERT_ID();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INSERT Reporting101a.reportOutput(sessionId,lineOut)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT pSessionId,CONCAT('| ',&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Field',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT(' ',GREATEST(0,lv_cFieldMaxLen-5)),&nbsp; ' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Type',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT(' ',GREATEST(0,lv_cTypeMaxLen-4)),&nbsp; &nbsp;' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Null',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT(' ',GREATEST(0,lv_cNullMaxLen-4)),&nbsp; &nbsp;' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Key',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT(' ',GREATEST(0,lv_cKeyMaxLen-3)),&nbsp; &nbsp; ' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Default',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT(' ',GREATEST(0,lv_cDefaultMaxLen-7)),&nbsp; &nbsp; ' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'Extra',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; REPEAT(' ',GREATEST(0,lv_cExtraMaxLen-5)),&nbsp; ' |');&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; INSERT Reporting101a.reportOutput(sessionId,lineOut)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT pSessionId,lineOut&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM Reporting101a.reportOutput&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHERE lineNum=@dashLineNumRow;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- SELECT * FROM Reporting101a.reportDataDefs WHERE sessionId=24;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SET curTable=lv_tblName;&nbsp; &nbsp; &nbsp; &nbsp; END IF;&nbsp; &nbsp; &nbsp; &nbsp; INSERT Reporting101a.reportOutput(sessionId,lineOut)&nbsp; &nbsp; &nbsp; &nbsp; SELECT pSessionId,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CONCAT('| ',&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(lv_cField,''),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(REPEAT(' ',GREATEST(0,lv_cFieldMaxLen-LENGTH(lv_cField))),''),' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(lv_cType,''),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(REPEAT(' ',GREATEST(0,lv_cTypeMaxLen-LENGTH(lv_cType))),''),' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(lv_cNull,''),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(REPEAT(' ',GREATEST(0,lv_cNullMaxLen-LENGTH(lv_cNull))),''),' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(lv_cKey,'&nbsp; &nbsp;'),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(REPEAT(' ',GREATEST(0,lv_cKeyMaxLen-LENGTH(lv_cKey))),''),' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(lv_cDefault,'&nbsp; &nbsp; &nbsp; &nbsp;'),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(REPEAT(' ',GREATEST(0,lv_cDefaultMaxLen-LENGTH(lv_cDefault))),''),' | ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(lv_cExtra,'&nbsp; &nbsp; &nbsp;'),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COALESCE(REPEAT(' ',GREATEST(0,lv_cExtraMaxLen-LENGTH(lv_cExtra))),''),' |');&nbsp; &nbsp; &nbsp; &nbsp; INSERT Reporting101a.reportOutput(sessionId,lineOut)&nbsp; &nbsp; &nbsp; &nbsp; SELECT pSessionId,lineOut&nbsp; &nbsp; &nbsp; &nbsp; FROM Reporting101a.reportOutput&nbsp; &nbsp; &nbsp; &nbsp; WHERE lineNum=@dashLineNumRow;&nbsp; &nbsp; END LOOP;&nbsp; &nbsp; CLOSE cur1;&nbsp; &nbsp; select lineOut as '' from Reporting101a.reportOutput where sessionId=pSessionId order by lineNum;END$$DELIMITER ;测试测试:-- See **Note2**SET @theOutVar =-1; -- A variable used as the OUT variable below-- See **Note3**-- Note: with `TRUE` as the 4th parameter, this is a one call deal. Meaning, you are done.call Reporting101a.describeTables_v2a('stackoverflow',@theOutVar,false,true);-- See **Note4**-- Primarily used if the 4th parameter above is falsecall Reporting101a.Print_Tables_Like_Describe(@theOutVar); -- loads data for prettier results in chunk format.输出量+--------------------------------------------------------------------------------------------+|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |+--------------------------------------------------------------------------------------------+| course&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || | Field&nbsp; &nbsp; &nbsp; | Type&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Null | Key | Default | Extra&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +------------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || | courseId&nbsp; &nbsp;| int(11)&nbsp; &nbsp; &nbsp; | NO&nbsp; &nbsp;| PRI |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| auto_increment |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +------------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || | deptId&nbsp; &nbsp; &nbsp;| int(11)&nbsp; &nbsp; &nbsp; | NO&nbsp; &nbsp;| MUL |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +------------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || | courseName | varchar(100) | NO&nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +------------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ||&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || dept&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +----------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || | Field&nbsp; &nbsp; | Type&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Null | Key | Default | Extra&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +----------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || | deptId&nbsp; &nbsp;| int(11)&nbsp; &nbsp; &nbsp; | NO&nbsp; &nbsp;| PRI |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| auto_increment |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +----------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || | deptName | varchar(100) | NO&nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +----------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ||&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || scjunction&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+---------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | Field&nbsp; &nbsp; &nbsp; | Type&nbsp; &nbsp; | Null | Key | Default | Extra&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+---------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | id&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| int(11) | NO&nbsp; &nbsp;| PRI |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| auto_increment |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+---------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | studentId&nbsp; | int(11) | NO&nbsp; &nbsp;| MUL |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+---------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | courseId&nbsp; &nbsp;| int(11) | NO&nbsp; &nbsp;| MUL |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+---------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | term&nbsp; &nbsp; &nbsp; &nbsp;| int(11) | NO&nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+---------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | attendance | int(11) | NO&nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+---------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | grade&nbsp; &nbsp; &nbsp; | int(11) | NO&nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +------------+---------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;||&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || student&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +-----------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | Field&nbsp; &nbsp; &nbsp;| Type&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Null | Key | Default | Extra&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +-----------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | studentId | int(11)&nbsp; &nbsp; &nbsp; | NO&nbsp; &nbsp;| PRI |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| auto_increment |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +-----------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | fullName&nbsp; | varchar(100) | NO&nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +-----------+--------------+------+-----+---------+----------------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;||&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || testtable&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || +-----------------------------------------+---------------+------+-----+---------+-------+ || | Field&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| Type&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | Null | Key | Default | Extra | || +-----------------------------------------+---------------+------+-----+---------+-------+ || | noPKhere&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | int(11)&nbsp; &nbsp; &nbsp; &nbsp;| NO&nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp;| || +-----------------------------------------+---------------+------+-----+---------+-------+ || | veryLongColumnName_And_Then.Some_%_More | decimal(12,2) | YES&nbsp; |&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp;| || +-----------------------------------------+---------------+------+-----+---------+-------+ || | limit&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| int(11)&nbsp; &nbsp; &nbsp; &nbsp;| NO&nbsp; &nbsp;|&nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp;| || +-----------------------------------------+---------------+------+-----+---------+-------+ ||&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || testtable2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +-------+---------+------+-----+---------+-------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | Field | Type&nbsp; &nbsp; | Null | Key | Default | Extra |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +-------+---------+------+-----+---------+-------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| | id&nbsp; &nbsp; | int(11) | NO&nbsp; &nbsp;| PRI |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp;|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| +-------+---------+------+-----+---------+-------+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|+--------------------------------------------------------------------------------------------+注意1:将Reporting101a创建一个名为的数据库来容纳两个存储过程和一些支持表。这些例程通过调用存储过程来开始,该存储过程引用要使用字符串报告的数据库。通过专用INFORMATION_SCHEMA数据库以只读安全方式访问产生输出的数据。因此,不会影响正在报告的数据库。此数据库中保留了三个非临时表。reportDataDefsSession -用于获取会话的简单表格#reportDataDefs-数据返回INFORMATION_SCHEMA并进行了一些处理。它是基于会话的。reportOutput-用于MySQL的打印打印的表DESCRIBE。它只是用于将输出放在一起的表。它是基于会话的。注2:该INT变量作为OUT参数目标被包括在内,并写入其中,并允许您在First存储过程准备好数据之后插入其他代码。它代表一个会话#,该会话隔离输出以供以后报告。某些环境(例如PHP)具有某些技巧,这些技巧使某些程序员无法理解。因此,如果您需要自己组合两个存储过程,则可以这样做(或者如果您感到困惑,请分别询问我)。无论如何,它显示了数据或工作量如何将存储过程调用链接在一起。坦白地说,我使用会话#作为OUT参数的主要原因之一是,我知道我必须创建一个CURSOR才能获得漂亮的输出。而这需要Cursor DECLARE在第二个存储过程的顶部。并且DECLAREs必须出现在存储过程的顶部。所以双手合十,我走了这条路。注意3:这是对第一个存储过程的调用。很有可能您将在此调用后以TRUE作为第四个参数来完成操作。存储过程在其中非常有据可查。第三个参数用于确定是否要从会话号的报告表中删除数据。删除发生在任何输出作为结果集之后。因此,这取决于您的选择。参数:描述所有表的数据库名称,例如 describe myTableINT OUT用来保存会话的参数布尔值:是否要在最后从报表中删除数据布尔值:我们是否应该自动调用生成describe类似输出的漂亮打印存储过程。如果您决定将参数4传递为FALSE,那么您的输出可能类似于以下内容:注意4:在需要不同输出但希望使用会话编号的情况下使用。您通常不需要这个。

慕盖茨4494581

你只需要删除表输出的第一个和最后一个行和替代+的|,以有表降价格式。像这样:|Field|Type|Null|Key|Default|Extra||-----|----|----|---|-------|-----||blockheight|int(11)|No|PRI|NULL||...
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

MySQL