Version:
  1. Database operations

    Article: AN0001857 Displayed: 544x

    Value update in the database

    We are updating count of article display in the model Knowledge Base. This operation can be performed by reading the given record, increasing the value in the column showcount and saving the record into the database again. Such a solution, however, is not adequate. Simple update in the database offers a higher performance and it represents in this case more suitable solution.
    var cl = OG.ClassDef.GetByCode(OGModel.Id, 'article');
    var colShow = cl.Columns['showcount'];
    var sql = 'update DataRow' + article.ParentId + ' set ' + colShow.DBColumnName + ' = isnull(' + colShow.DBColumnName + ', 0) + 1 where Id = ' + article.Id;
    OG.Sql.RunSql(sql);


    Executing custom stored procedure in the database

    If you have in your model data that have to be regularly processed, then it may be suitable to perform such operations directly in the database. You will increase performance and implementation by means of a stored procedure is simple.
    In order to execute such a procedure e.g. from a job step use following example of a script.
     

    OG.Sql.RunSql('exec MyStoredProcedure');

  2.    ---
    Your rating:
    Rated by users: 0x
  3. Top
SearchTitle
×