Ejemplo n.º 1
0
    /// <summary>
    /// Renders the database tab.
    /// </summary>
    private void RenderDatabaseTab()
    {
        EditorGUILayout.BeginHorizontal(); {
            EditorGUILayout.LabelField("Query", EditorStyles.boldLabel, GUILayout.MaxWidth(50f));
            Query = EditorGUILayout.TextArea(Query, GUILayout.ExpandWidth(true), GUILayout.MaxHeight(100f));
        } EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal(); {
            EditorGUILayout.LabelField("Execute", EditorStyles.boldLabel, GUILayout.MaxWidth(50f));
            try {
                if(GUILayout.Button("Execute Reader")) {
                    _Table = June.BasicDB.Database.ExecuteReader(Query);
                    _Result = null == _Table ? "<NULL>" : null;
                }
                if(GUILayout.Button("Execute Scalar")) {
                    _Result = June.BasicDB.Database.ExecuteScalar(Query).ToString();
                }
                if(GUILayout.Button("Execute Non Query")) {
                    _Result = June.BasicDB.Database.ExecuteNonQuery(Query).ToString();
                }
                if(GUILayout.Button("Execute Script")) {
                    _Result = June.BasicDB.Database.ExecuteScript(Query).ToString();
                }
            }
            catch(Exception ex) {
                _Result = ex.ToString();
            }
        } EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal(); {
            EditorGUILayout.LabelField("Result", EditorStyles.boldLabel, GUILayout.ExpandWidth(true));
            if(GUILayout.Button("Clear", GUILayout.MaxWidth(50f))) {
                _Result = string.Empty;
                _Table = null;
            }
        } EditorGUILayout.EndHorizontal();

        EditorGUILayout.Separator();

        if(!string.IsNullOrEmpty(_Result)) {
            EditorGUILayout.TextField(_Result, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
        }
        else if(null != _Table) {
            RenderDataTable(_Table);
        }
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Refresh's the settings table.
 /// </summary>
 private void RefreshSettingsTable()
 {
     _SettingsTable = June.BasicDB.Database.ExecuteReader("SELECT * FROM " + June.BasicDB.Database.DB_SETTINGS_TABLE_NAME);
 }