Esempio n. 1
0
        /// <summary>
        /// Converts the type of the to SQL join.
        /// </summary>
        /// <returns>The to SQL join type.</returns>
        /// <param name="type">Type.</param>
        public string ConvertToSQLJoinType(SqliteJoinType type)
        {
            StringBuilder stringBuilder = new StringBuilder();

            switch (type)
            {
            case SqliteJoinType.Cross:
                stringBuilder.Append("CROSS ");
                break;

            case SqliteJoinType.Inner:
                stringBuilder.Append("INNER ");
                break;

            case SqliteJoinType.Outer:
                stringBuilder.Append("LEFT OUTER ");
                break;

            default:
                return("");
            }

            stringBuilder.Append("JOIN {0} ON ");
            return(stringBuilder.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Generates the join SQL.
        /// </summary>
        /// <returns>The join SQL.</returns>
        /// <param name="tableName">Table name.</param>
        /// <param name="joinTableName">Join table name.</param>
        /// <param name="columnName">Column name.</param>
        /// <param name="joinColumnName">Join column name.</param>
        /// <param name="type">Type.</param>
        public string GenerateJoinSQL(string tableName,
                                      string joinTableName,
                                      string columnName,
                                      string joinColumnName,
                                      SqliteJoinType type)
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        joinQuery     = ConvertToSQLJoinType(type);

            if (joinQuery == "")
            {
                return(joinQuery);
            }

            stringBuilder.AppendFormat(joinQuery, joinTableName);
            stringBuilder.Append(EqualsSign(Period(tableName, columnName), Period(joinTableName, joinColumnName)));
            return(stringBuilder.ToString());
        }
        /// <summary>
        /// Converts the type of the to SQL join.
        /// </summary>
        /// <returns>The to SQL join type.</returns>
        /// <param name="type">Type.</param>
        public string ConvertToSQLJoinType(SqliteJoinType type)
        {
            StringBuilder stringBuilder = new StringBuilder ();
            switch (type) {
            case SqliteJoinType.CROSS:
                stringBuilder.Append ("CROSS ");
            break;
            case SqliteJoinType.INNER:
                stringBuilder.Append ("INNER ");
            break;
            case SqliteJoinType.OUTER:
                stringBuilder.Append ("LEFT OUTER ");
            break;
            default:
                return "";
            }

            stringBuilder.Append ("JOIN {0} ON ");
            return stringBuilder.ToString ();
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Hellgate.JoinAttribute"/> class.
 /// </summary>
 /// <param name="type">Type.</param>
 public JoinAttribute(SqliteJoinType type)
 {
     this.type = type;
 }
Esempio n. 5
0
 /// <summary>
 /// Sets the type of the join.
 /// </summary>
 /// <param name="joinType">Join type.</param>
 public void SetJoinType(SqliteJoinType joinType = SqliteJoinType.None)
 {
     this.joinType = joinType;
 }
Esempio n. 6
0
        /// <summary>
        /// Generates the join SQL.
        /// </summary>
        /// <returns>The join SQL.</returns>
        /// <param name="tableName">Table name.</param>
        /// <param name="joinTableName">Join table name.</param>
        /// <param name="columnName">Column name.</param>
        /// <param name="joinColumnName">Join column name.</param>
        /// <param name="type">Type.</param>
        public string GenerateJoinSQL(string tableName,
                                       string joinTableName,
                                       string columnName,
                                       string joinColumnName,
                                       SqliteJoinType type)
        {
            StringBuilder stringBuilder = new StringBuilder ();
            string joinQuery = ConvertToSQLJoinType (type);
            if (joinQuery == "") {
                return joinQuery;
            }

            stringBuilder.AppendFormat (joinQuery, joinTableName);
            stringBuilder.Append (EqualsSign (Period (tableName, columnName), Period (joinTableName, joinColumnName)));
            return stringBuilder.ToString ();
        }