Lasso Soft Inc. > Home

[row_count]

Linkrow_count
AuthorJason Huck
CategoryDatabase
Version8.x
LicensePublic Domain
Posted02 Aug 2007
Updated02 Aug 2007
More by this author...

Description

Returns the number of affected rows for the last insert, delete, or update statement against a MySQL datasource. Must be used within an [inline].

Sample Usage

inline( ... );
    'There were ' + row_count + ' records updated.';
/inline;

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.

define_tag(
	'row_count',
	-priority='replace',
	-description='
		Returns the number of affected rows for the last insert, 
		delete, or update statement against a MySQL datasource.
	'
);
	// default to zero
	local('out') = 0;
	
	if(
		lasso_datasourceismysql(database_name)
		&& (
			action_statement >> 'insert' 
			|| action_statement >> 'update' 
			|| action_statement >> 'delete'
		)
	);
		protect;
			inline( -sql='SELECT ROW_COUNT() AS changed');
				#out = integer(field('changed'));
			/inline;
		/protect;
	/if;
	
	return(#out);
/define_tag;

Related Tags

Comments

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