Location: PHPKode > projects > EXtensible Production Suite (XPS) > xpsdev/core/configs/sql_statements.xml
<?xml version="1.0" encoding="UTF-8"?>
<sql_statements xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\..\xml_schemas\sql_statements.xsd">

<!--USER STATEMENTS-->
	<sql_statement id="select_user">
		<sql db_lang="default">
			SELECT USER_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, NAME_PREFIX, DESCRIPTION, JOIN_DATE, IS_ADMIN, THEME, EMAIL, CONFIRM_GUID FROM {table_prefix}XPS_USER WHERE USER_ID=:USER_ID
        </sql>
    </sql_statement>
    <sql_statement id="count_users">
		<sql db_lang="default">
			SELECT COUNT(USER_ID) AS USER_COUNT FROM {table_prefix}XPS_USER
        </sql>
    </sql_statement>
    <sql_statement id="select_users">
		<sql db_lang="default">
			SELECT USER_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, NAME_PREFIX, DESCRIPTION, JOIN_DATE, ACCOUNT_ACTIVE, IS_ADMIN, THEME, EMAIL
			FROM {table_prefix}XPS_USER ORDER BY {ORDER_BY}
			LIMIT {LIMIT} OFFSET {OFFSET}
		</sql>
		<sql db_lang="oracle">
			SELECT USER_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, NAME_PREFIX, DESCRIPTION, JOIN_DATE, ACCOUNT_ACTIVE, IS_ADMIN, THEME, EMAIL
			FROM {table_prefix}XPS_USER ORDER BY {ORDER_BY}
		</sql>
	</sql_statement>
	<sql_statement id="select_user_login">
		<sql db_lang="default">
			SELECT PASSWORD_TEXT, PASSWORD_SALT, IS_ADMIN, ACCOUNT_ACTIVE, THEME, EMAIL FROM {table_prefix}XPS_USER WHERE USER_ID=:USER_ID
		</sql>
    </sql_statement>
	<sql_statement id="insert_user">
		<sql db_lang="default">
			INSERT INTO {table_prefix}XPS_USER(USER_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, NAME_PREFIX, DESCRIPTION, JOIN_DATE, IS_ADMIN, ACCOUNT_ACTIVE, PASSWORD_TEXT, PASSWORD_SALT, PASSWORD_CREATE_DATE, THEME, EMAIL, CONFIRM_GUID)
			VALUES(:USER_ID, :FIRST_NAME, :MIDDLE_NAME, :LAST_NAME, :NAME_PREFIX, :DESCRIPTION, NOW(), :IS_ADMIN, :ACCOUNT_ACTIVE, :PASSWORD_TEXT, :PASSWORD_SALT, NOW(), :THEME, :EMAIL, 'WHATTHEHELLISACONFIRMGUID')
		</sql>
		<sql db_lang="oracle">
			INSERT INTO {table_prefix}XPS_USER(USER_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, NAME_PREFIX, DESCRIPTION, JOIN_DATE, IS_ADMIN, ACCOUNT_ACTIVE, PASSWORD_TEXT, PASSWORD_SALT, PASSWORD_CREATE_DATE, THEME, EMAIL, CONFIRM_GUID)
			VALUES(:USER_ID, :FIRST_NAME, :MIDDLE_NAME, :LAST_NAME, :NAME_PREFIX, :DESCRIPTION, SYSDATE, :IS_ADMIN, :ACCOUNT_ACTIVE, :PASSWORD_TEXT, :PASSWORD_SALT, SYSDATE, :THEME, :EMAIL, 'WHATTHEHELLISACONFIRMGUID')
		</sql>
    </sql_statement>
    <sql_statement id="insert_user_widget_pref">
		<sql db_lang="default">
			INSERT INTO {table_prefix}XPS_USER_WIDGET_PREF(USER_ID, WIDGET_ID, CONTAINER_ID, STACK_ORDER)VALUES(:USER_ID, :WIDGET_ID, :CONTAINER_ID, :STACK_ORDER)
		</sql>
    </sql_statement>
	<sql_statement id="update_user">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_USER SET FIRST_NAME=:FIRST_NAME, MIDDLE_NAME=:MIDDLE_NAME, LAST_NAME=:LAST_NAME, NAME_PREFIX=:NAME_PREFIX, DESCRIPTION=:DESCRIPTION, IS_ADMIN=:IS_ADMIN, THEME=:THEME, EMAIL=:EMAIL WHERE USER_ID=:USER_ID
		</sql>
    </sql_statement>
    <sql_statement id="update_user_theme">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_USER SET THEME=:THEME WHERE USER_ID=:USER_ID
		</sql>
    </sql_statement>
    <sql_statement id="update_user_password">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_USER SET PASSWORD_TEXT=:PASSWORD_TEXT, PASSWORD_SALT=:PASSWORD_SALT WHERE USER_ID=:USER_ID
		</sql>
    </sql_statement>
    <sql_statement id="update_user_active">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_USER SET ACCOUNT_ACTIVE = :ACCOUNT_ACTIVE WHERE USER_ID=:USER_ID
		</sql>
    </sql_statement>
    <sql_statement id="delete_user">
		<sql db_lang="default">
			DELETE FROM {table_prefix}XPS_USER WHERE USER_ID=:USER_ID
		</sql>
    </sql_statement>
    <sql_statement id="get_user_password">
		<sql db_lang="default">
			SELECT PASSWORD_TEXT, PASSWORD_SALT FROM {table_prefix}XPS_USER WHERE USER_ID=:USER_ID
		</sql>
    </sql_statement>
    <sql_statement id="get_admin_email">
        <sql db_lang="default">
            SELECT EMAIL FROM {table_prefix}XPS_USER WHERE IS_ADMIN=1
        </sql>
    </sql_statement>
    <sql_statement id="enter_user_guid">
        <sql db_lang="default">
            UPDATE {table_prefix}XPS_USER SET CONFIRM_GUID=:CONFIRM_GUID WHERE USER_ID=:USER_ID
        </sql>
    </sql_statement>

<!--FILE STATEMENTS-->
    <sql_statement id="insert_file_blob">
    	<sql db_lang="oracle">
			INSERT INTO {table_prefix}XPS_ATTACHMENT (
                    ATTACHMENT_ID,
                    REPORT_ID,
                    ATTACHMENT_FILE_NM,
                    ATTACHMENT_DESC_TX,
                    ATTACHMENT_BINARY_OBJ)
                    VALUES (:ATTACHMENT_ID, :REPORT_ID, :ATTACHMENT_FILE_NM, :ATTACHMENT_DESC_TX, EMPTY_BLOB())
                    RETURNING ATTACHMENT_BINARY_OBJ INTO :ATTACHMENT_BINARY_OBJ
    	</sql>
	   	<sql db_lang="default">
			INSERT INTO {table_prefix}XPS_ATTACHMENT (
                    ATTACHMENT_ID,
                    REPORT_ID,
                    ATTACHMENT_FILE_NM,
                    ATTACHMENT_DESC_TX,
                    ATTACHMENT_BINARY_OBJ)
                    VALUES (:ATTACHMENT_ID, :REPORT_ID, :ATTACHMENT_FILE_NM, :ATTACHMENT_DESC_TX, :ATTACHMENT_BINARY_OBJ)
    	</sql>
    </sql_statement>
    <sql_statement id="insert_file">
    	<sql db_lang="default">
			INSERT INTO {table_prefix}XPS_ATTACHMENT (
	            ATTACHMENT_ID,
				REPORT_ID,
				ATTACHMENT_FILE_NM,
				ATTACHMENT_DESC_TX)
				VALUES (:ATTACHMENT_ID, :REPORT_ID, :ATTACHMENT_FILE_NM, :ATTACHMENT_DESC_TX)
    	</sql>
    </sql_statement>
    <sql_statement id="delete_file">
    	<sql db_lang="default">
    		DELETE FROM {table_prefix}XPS_ATTACHMENT WHERE ATTACHMENT_ID=:ATTACHMENT_ID
    	</sql>
    </sql_statement>
	<sql_statement id="download_file_obj">
		<sql db_lang="default">
			SELECT FILE_NAME, ATTACHMENT_BINARY_OBJ FROM {table_prefix}ATTACHMENT WHERE ATTACHMENT_ID=:ATTACHMENT_ID
		</sql>
	</sql_statement>
	<sql_statement id="download_file">
		<sql db_lang="default">
			SELECT FILE_NAME {table_prefix}ATTACHMENT WHERE ATTACHMENT_ID=:ATTACHMENT_ID
		</sql>
	</sql_statement>
	<sql_statement id="get_attachment_id">
		<sql db_lang="default">
			SELECT ATTACHMENT_ID FROM {table_prefix}ATTACHMENT WHERE FILE_NAME=:FILE_NAME
		</sql>
	</sql_statement>
	<sql_statement id="get_all_attachment_ids">
		<sql db_lang="default">
			SELECT ATTACHMENT_ID, FILE_NAME {table_prefix}ATTACHMENT
		</sql>
	</sql_statement>

<!--MODULE STATEMENTS-->
	<sql_statement id="update_module_settings">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_MODULE SET MODULE_NAME=:MODULE_NAME, DESCRIPTION=:DESCRIPTION WHERE MODULE_ID=:MODULE_ID
		</sql>
	</sql_statement>
	<sql_statement id="update_module_activation">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_MODULE SET IS_ACTIVE=:IS_ACTIVE WHERE MODULE_ID=:MODULE_ID
		</sql>
	</sql_statement>
	<sql_statement id="module_information">
		<sql db_lang="default">
			SELECT MODULE_NAME, IS_ACTIVE, DESCRIPTION, ACTIVE_DATE, VERSION, ADMIN_ONLY FROM {table_prefix}XPS_MODULE WHERE MODULE_ID=:MODULE_ID
		</sql>
	</sql_statement>
	<sql_statement id="module_update_ver">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_MODULE SET VERSION=:VERSION WHERE MODULE_ID=:MODULE_ID
		</sql>
	</sql_statement>
	<sql_statement id="module_install">
		<sql db_lang="default">
			INSERT INTO {table_prefix}XPS_MODULE
			(MODULE_ID, MODULE_NAME, IS_ACTIVE, DESCRIPTION, ACTIVE_DATE, VERSION, ADMIN_ONLY)
			VALUES
			(:MODULE_ID, :MODULE_NAME, :IS_ACTIVE, :DESCRIPTION, NOW(), :VERSION, :ADMIN_ONLY)
		</sql>
		<sql db_lang="oracle">
			INSERT INTO {table_prefix}XPS_MODULE
			(MODULE_ID, MODULE_NAME, IS_ACTIVE, DESCRIPTION, ACTIVE_DATE, VERSION, ADMIN_ONLY)
			VALUES
			(:MODULE_ID, :MODULE_NAME, :IS_ACTIVE, :DESCRIPTION, SYSDATE, :VERSION, :ADMIN_ONLY)
		</sql>
	</sql_statement>
	<sql_statement id="module_delete">
		<sql db_lang="default">
			DELETE FROM {table_prefix}XPS_MODULE WHERE MODULE_ID=:MODULE_ID
		</sql>
	</sql_statement>
	<sql_statement id="list_inactive_modules">
		<sql db_lang="default">
			SELECT MODULE_ID, MODULE_NAME, DESCRIPTION, ACTIVE_DATE, VERSION FROM {table_prefix}XPS_MODULE WHERE IS_ACTIVE=0 AND MODULE_ID!='core' ORDER BY MODULE_NAME ASC
		</sql>
	</sql_statement>
	<sql_statement id="list_active_modules">
		<sql db_lang="default">
			SELECT MODULE_ID, MODULE_NAME, DESCRIPTION, ACTIVE_DATE, VERSION, ADMIN_ONLY FROM {table_prefix}XPS_MODULE WHERE IS_ACTIVE=1 AND MODULE_ID!='core' ORDER BY MODULE_NAME ASC
		</sql>
	</sql_statement>
	<sql_statement id="list_all_modules">
		<sql db_lang="oracle">
			SELECT MODULE_ID, MODULE_NAME, IS_ACTIVE, DESCRIPTION, ACTIVE_DATE, VERSION
			FROM {table_prefix}XPS_MODULE WHERE MODULE_ID!='core' ORDER BY {ORDER_BY}
        </sql>
        <sql db_lang="sqlserver2005">
            SELECT MODULE_ID, MODULE_NAME, IS_ACTIVE, DESCRIPTION, ACTIVE_DATE, VERSION FROM (
                SELECT TOP {LIMIT} MODULE_ID FROM (
                    SELECT TOP ({LIMIT}+{OFFSET}) columns
                    FROM {TABLE_PREFIX}XPS_MODULE WHERE MODULE_ID != 'core'
                    ORDER BY key ASC
                ) AS FOO ORDER BY key DESC
            ) AS BAR ORDER BY key ASC
        </sql>
        <sql db_lang="default">
			SELECT MODULE_ID, MODULE_NAME, IS_ACTIVE, DESCRIPTION, ACTIVE_DATE, VERSION
			FROM {table_prefix}XPS_MODULE WHERE MODULE_ID!='core' ORDER BY {ORDER_BY}
			LIMIT {LIMIT} OFFSET {OFFSET}
		</sql>
	</sql_statement>
	<sql_statement id="list_installed_modules">
		<sql db_lang="default">
			SELECT MODULE_ID, MODULE_NAME, IS_ACTIVE, DESCRIPTION, ACTIVE_DATE, VERSION
			FROM {table_prefix}XPS_MODULE WHERE MODULE_ID!='core'
		</sql>
	</sql_statement>
	<sql_statement id="module_log_add">
		<sql db_lang="default">
			INSERT INTO {table_prefix}XPS_MODULE_INSTALL_LOG(MODULE_ID, MODULE_OBJECT_NAME, MODULE_OBJECT_TYPE)VALUES(:MODULE_ID,:MODULE_OBJECT_NAME,:MODULE_OBJECT_TYPE)
		</sql>
	</sql_statement>
	<sql_statement id="get_module_log">
		<sql db_lang="default">
			SELECT MODULE_OBJECT_NAME FROM {table_prefix}XPS_MODULE_INSTALL_LOG WHERE MODULE_ID=:MODULE_ID AND MODULE_OBJECT_TYPE=:MODULE_OBJECT_TYPE
		</sql>
	</sql_statement>
	<sql_statement id="remove_log_entry">
		<sql db_lang="default">
			DELETE FROM {table_prefix}XPS_MODULE_INSTALL_LOG WHERE MODULE_OBJECT_NAME=:MODULE_OBJECT_NAME AND MODULE_OBJECT_TYPE=:MODULE_OBJECT_TYPE AND MODULE_ID=:MODULE_ID
		</sql>
	</sql_statement>

<!--WIDGET STATEMENTS-->
	<sql_statement id="list_module_widgets">
		<sql db_lang="default">
			SELECT WIDGET_ID, WIDGET_NAME, URL, DESCRIPTION, ACTIVE_DATE, VERSION, CONTAINER_ID, STACK_ORDER, PREFERENCES FROM {table_prefix}XPS_WIDGET WHERE MODULE_ID=:MODULE_ID
		</sql>
	</sql_statement>
	<sql_statement id="list_widgets">
		<sql db_lang="default">
			SELECT WIDGET_ID, WIDGET_NAME, MODULE_ID, URL, DESCRIPTION, ACTIVE_DATE, VERSION, CONTAINER_ID, STACK_ORDER, PREFERENCES FROM {table_prefix}XPS_WIDGET ORDER BY STACK_ORDER ASC
		</sql>
	</sql_statement>
	<sql_statement id="deactivate_widget">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_WIDGET SET CONTAINER_ID=:CONTAINER_ID WHERE WIDGET_ID=:WIDGET_ID
		</sql>
	</sql_statement>
	<sql_statement id="get_position">
		<sql db_lang="default">
			SELECT CONTAINER_ID, STACK_ORDER FROM {table_prefix}XPS_WIDGET WHERE WIDGET_ID=:WIDGET_ID
		</sql>
	</sql_statement>
	<sql_statement id="set_position">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_WIDGET SET CONTAINER_ID=:CONTAINER_ID, STACK_ORDER=:STACK_ORDER WHERE WIDGET_ID=:WIDGET_ID
		</sql>
	</sql_statement>
	<sql_statement id="widget_install">
		<sql db_lang="default">
			INSERT INTO {table_prefix}XPS_WIDGET(WIDGET_ID, MODULE_ID, WIDGET_NAME, DESCRIPTION, URL, VERSION, CONTAINER_ID, ACTIVE_DATE)VALUES(:WIDGET_ID, :MODULE_ID, :WIDGET_NAME, :DESCRIPTION, :URL, :VERSION, :CONTAINER_ID, NOW())
		</sql>
		<sql db_lang="oracle">
			INSERT INTO {table_prefix}XPS_WIDGET(WIDGET_ID, MODULE_ID, WIDGET_NAME, DESCRIPTION, URL, VERSION, CONTAINER_ID, ACTIVE_DATE)VALUES(:WIDGET_ID, :MODULE_ID, :WIDGET_NAME, :DESCRIPTION, :URL, :VERSION, :CONTAINER_ID, SYSDATE)
		</sql>
	</sql_statement>
    <sql_statement id="insert_user_widget_pref">
		<sql db_lang="default">
			INSERT INTO {table_prefix}XPS_USER_WIDGET_PREF(USER_ID, WIDGET_ID, CONTAINER_ID, STACK_ORDER)VALUES(:USER_ID, :WIDGET_ID, :CONTAINER_ID, :STACK_ORDER)
		</sql>
	</sql_statement>
    <sql_statement id="update_user_widget_pref">
		<sql db_lang="default">
			UPDATE {table_prefix}XPS_USER_WIDGET_PREF SET USER_ID=:USER_ID, WIDGET_ID=:WIDGET_ID, CONTAINER_ID=:CONTAINER_ID, STACK_ORDER=:STACK_ORDER WHERE USER_ID=:USER_ID AND WIDGET_ID=:WIDGET_ID
		</sql>
	</sql_statement>
    <sql_statement id="count_user_widget_pref">
		<sql db_lang="default">
			SELECT COUNT(*) AS PREF_COUNT FROM {table_prefix}XPS_USER_WIDGET_PREF WHERE USER_ID=:USER_ID AND WIDGET_ID=:WIDGET_ID
		</sql>
	</sql_statement>
    <sql_statement id="get_user_widget_prefs">
		<sql db_lang="default">
			SELECT W.WIDGET_ID, W.WIDGET_NAME, W.MODULE_ID, W.URL, W.CONTAINER_ID, W.STACK_ORDER, U.CONTAINER_ID AS USER_CONTAINER_ID, U.STACK_ORDER AS USER_STACK_ORDER, U.USER_ID
			FROM {table_prefix}XPS_WIDGET W
			LEFT OUTER JOIN (SELECT *
							FROM {table_prefix}XPS_USER_WIDGET_PREF
							WHERE USER_ID=:USER_ID) U
				ON W.WIDGET_ID = U.WIDGET_ID
			ORDER BY U.STACK_ORDER, W.STACK_ORDER ASC
		</sql>
	</sql_statement>
<!--MISC STATEMENTS-->
	<sql_statement id="count_table">
		<sql db_lang="default">
			SELECT COUNT(*) AS SOME_COUNT FROM {table_name}
		</sql>
	</sql_statement>
</sql_statements>

Return current item: EXtensible Production Suite (XPS)