[host_id]

Description

Link: [host_id]
Author: Jason Huck
Category: Administration
Version: 8.x
License:
Posted: Nov. 21, 2006
Updated: Jan. 01, 0001
More by this author...
Returns the id for the given host name or alias from Lasso's internal database. Requires authentication as a user with permissions on that database, i.e., with [auth_admin].

Parameters

none


Sample Usage

host_id('Local MySQL');

-> 5
						

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
define_tag(
	'id',
	-namespace='host_',
	-req='name',
	-priority='replace',
	-description='Returns the id for the given host name or alias.'
);
	inline( -database='lasso_internal', -sql='SELECT 1');
		local('sql' = '
			SELECT store_key
			FROM global_prefs
			WHERE data = \'' + #name + '\'
		');
		
		inline( -sql=#sql);
			if(found_count);
				local('id') = field('store_key');
				#id->removeleading('_admin_host_alias:');
			else;
				local('sql' = '
					SELECT id 
					FROM security_datasource_hosts 
					WHERE name = \'' + #name + '\'
				');
				
				inline( -sql=#sql);
					found_count ? local('id') = field('id') | return(false);
				/inline;
			/if;
		/inline;
	/inline;
	
	return(integer(#id));
/define_tag;

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular