Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
See below code snippet, I wonder what the colons (':') in the SQLite statements mean. I studied at SQLite tutorials but can't figure it out.
The colons are among
sqlite3_prepare_v2
,
sqlite3_bind_int64
and
sqlite3_prepare_v2
statements of the below snippet.

	// delete report file
	iRet = sqlite3_prepare_v2(pDB,  "SELECT " SZ_KEY_PATH" FROM  
 "SZ_KEY_REPORT" "    "WHERE " SZ_KEY_STARTTIME "< :" SZ_KEY_NAME , 
							  -1, &pStmt, NULL);
	if (SQLITE_OK == iRet)
	{
		sqlite3_bind_int64(pStmt, sqlite3_bind_parameter_index(pStmt, ":" SZ_KEY_NAME), LocalTime - 86400 * iDelDay);
		while (SQLITE_ROW == (iRet = sqlite3_step(pStmt)))
		{
			const unsigned char* ReportPath = sqlite3_column_text(pStmt, 0);
//			Execute_Command(iRet, "echo remove %s >> /tmp/log", ReportPath);
			if (0 != (iRet = remove((const char*)ReportPath)))
			{
				goto exit_clamav_schedule;
			}
		}
		sqlite3_finalize(pStmt);
		if(SQLITE_DONE != iRet)
		{
			goto exit_clamav_schedule;
		}
	}
	iRet = sqlite3_prepare_v2(pDB,   "DELETE FROM " SZ_KEY_REPORT" "
							  "WHERE " SZ_KEY_STARTTIME" < :" SZ_KEY_NAME ,
							  -1, &pStmt, NULL);


The 'SZ_KEY_NAME' appearing in above snippet is defined as 'name' some other place of the program.

What I have tried:

I studied at SQLite tutorials in the web and discussed with my coworker but in vain.
Posted
Updated 11-May-23 0:20am
v2

1 solution

 
Share this answer
 
Comments
Stan Huang 11-May-23 0:15am    
I am still got confused about the meaning of thme. Take the 1st sample, "iRet = sqlite3_prepare_v2(pDB, "SELECT " SZ_KEY_PATH" FROM
"SZ_KEY_REPORT" " "WHERE " SZ_KEY_STARTTIME "< :" SZ_KEY_NAME ,
-1, &pStmt, NULL);"
Since SZ_KEY_NAME is defined as 'name' and SZ_KEY_STARTTIME is defined as 'starttime', so what does
"where starttime < :name" means? ':name' means the value gotten from 'name' column?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900