コード例 #1
0
 public List <object[]> Select(string join, string what, string whereClause, object[] vars, string orderBy, uint limit)
 {
     return(SqlController.Select(tableName,
                                 join,
                                 what ?? (join == null ? "*" : tableName + ".*"),
                                 whereClause,
                                 vars,
                                 orderBy,
                                 limit));
 }
コード例 #2
0
ファイル: SqlRow.cs プロジェクト: shashankmishra55/HardlyBot
        private bool RefreshColumnsByUniqueKey(uint value)
        {
            string          whereClause = table.additionalKeyHeaders[value - (table.primaryKeyHeaders?.Length ?? 0)].name + "=?a";
            List <object[]> newValues   = SqlController.Select(table.tableName, null, "*", whereClause, new[] { values[value] }, null, 1);

            if (newValues != null && newValues.Count > 0)
            {
                return(Set(newValues[0]));
            }

            Debug.Fail();
            return(false);
        }
コード例 #3
0
ファイル: SqlRow.cs プロジェクト: shashankmishra55/HardlyBot
 private bool AddOrUpdateRow(bool lazySave)
 {
     return(SqlController.AddOrUpdate(table, ref values, lazySave));
 }
コード例 #4
0
ファイル: SqlRow.cs プロジェクト: shashankmishra55/HardlyBot
 private bool InsertAndGetAutoIncrementingKey(bool lazySave)
 {
     return(SqlController.AddOrUpdatedAndGetAutoIncrementingKey(table, ref values, lazySave));
 }
コード例 #5
0
        public SqlTable(string tableName)
        {
            if (tableName != null && tableName.Trim().Length > 0)
            {
                this.tableName = tableName;

                SqlColumnHeaders[] columns = SqlController.GetColumns(tableName);
                if (columns != null && columns.Length > 0)
                {
                    uint primaryKeyCount = 0;
                    foreach (SqlColumnHeaders column in columns)
                    {
                        if (column.isPrimaryKey)
                        {
                            primaryKeyCount++;
                        }
                        else
                        {
                            break;
                        }
                    }

                    if (primaryKeyCount > 0)
                    {
                        primaryKeyHeaders = new SqlColumnHeaders[primaryKeyCount];
                    }
                    else
                    {
                        primaryKeyHeaders = null;
                    }

                    long additionalKeyCount = columns.Length - primaryKeyCount;
                    if (additionalKeyCount > 0)
                    {
                        additionalKeyHeaders = new SqlColumnHeaders[additionalKeyCount];
                    }
                    else
                    {
                        additionalKeyHeaders = null;
                    }

                    for (int i = 0; i < columns.Length; i++)
                    {
                        if (i < primaryKeyCount)
                        {
                            Debug.Assert(columns[i].isPrimaryKey);

                            primaryKeyHeaders[i] = columns[i];
                        }
                        else
                        {
                            Debug.Assert(!columns[i].isPrimaryKey);

                            additionalKeyHeaders[i - primaryKeyCount] = columns[i];
                        }
                    }
                }
                else
                {
                    throw new ArgumentNullException();
                }
            }
            else
            {
                throw new ArgumentNullException();
            }
        }
コード例 #6
0
 public bool Update(string join, string set, string where, object[] vars)
 {
     return(SqlController.Update(this, join, set, where, vars));
 }