Lasso Soft Inc. > Home


AuthorMarc Vos
LicensePublic Domain
Posted14 Feb 2013
Updated14 Feb 2013
More by this author...


Read more here:

Sample Usage

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.



var('zzsql' = '',
	'svdb' = '',
	'delflag' = false

// Get the list of TEMP tables currently in Lasso
$zzsql = "
	select as dbname, as tblid, as tblname 
	from security_database_tables t 
	join security_datasource_databases d on 
	where like 'REP%'
	order by,";
inline(-database='lasso_internal', -sql=$zzsql, -maxrecords='all');
		$delflag = false;
		if($svdb != field('dbname'));
			// Get the list of tables currently in MySQL + their last update date
			$zzsql = "
				show table status 
				from " + field('dbname') + " 
				like 'REP%'";
			inline(-Host=Array(-datasource='mysqlds', -name='', -username='lasso', -password='secret'), -sql=$zzsql, -maxrecords='all');
				var('in_mysql' = records_map);
			$svdb = field('dbname');
		// Check if Lasso-defined table still present in MySQL.
		// If not, delete all references from Lasso
		if($in_mysql->find(field('tblname'))->size == 0);
			$delflag = true;
		else(date_difference($in_mysql->find(field('tblname'))->find('Update_time'), date, -day) < -2);	// Older than 2 days = delete
			// Remove table from MySQL
			$zzsql = 'drop table ' + field('dbname') + '.' + field('tblname');
			inline(-Host=Array(-datasource='mysqlds', -name='', -username='lasso', -password='secret'), -sql=$zzsql);

			$delflag = true;
			// Delete all security_table_fields entries
			$zzsql = 'delete from security_table_fields where id_table=' + field('tblid');
			inline(-sql=$zzsql); /inline;
			// Delete all security_group_table_map entries
			$zzsql = 'delete from security_group_table_map where id_table=' + field('tblid');
			inline(-sql=$zzsql); /inline;
			// Delete the security_database_tables entry
			$zzsql = 'delete from security_database_tables where id=' + field('tblid');
			inline(-sql=$zzsql); /inline;



No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home



©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft