RDBMS code reading notes (1)

xiaoxiao2021-04-01  238

RDBMS is a simple database system that implements a C language that can operate using SQL languages. The author is Li Lishi. Here I start reading the origin master function starting from the program.

/*MSDB.C *

#include

#include

#include

#include "compile.h"

void main ()

{

CHAR Command [1024]; / ​​/ Define array, command line string

INT IN = 1;

// Time_t T;

// Time (& T);

Printf ("Welcome to RDBMS System / N");

/*Welcome Screen*/

PRINTF ("***************************************************** ***************************************

/ N ");

PRINTF ("W W W W W W W W W W W W W W W W W W W

/ N ");

Printf ("w w w w w w w w w w w w

/ N ");

PRINTF ("W W W W W W W W W W W W W W W W W W W

/ N ");

Printf ("w w w w w w w w w w w w

/ N ");

PRINTF ("W W W W W W W W W W W W W W W W W W W W

/ N ");

PRINTF ("***************************************************** ***************************************

/ N ");

Printf ("Please enter a command! / n"); // prompt the input command

/ * Define a loop of an input command * /

DO

{

Printf ("/ nrdbms>");

Gets (command); // input command

/ * Run the SQL command, IN to 1 means execution failure, indicate success * /

IN = CompileSQL (Command); // Execute the command,

IF (in) {

// Printf ("/ nerror! / N"); // Tips to run the command failed

}

Else

{

Printf ("/ nok! / n"); // Tips to run the command success

}

WHILE (1);

}

I feel that there is a question to prompt the format of the SQL command when prompted to enter the command, although it is a console program, but it should also pay attention to human-computer interaction. Next article I will read the code of the compilesql function.

转载请注明原文地址:https://www.9cbs.com/read-131040.html

New Post(0)