anchor.diff:  find_by(DocName, Conditions, Limit, Offset, State) ->
     [Sqls, Values] = lists:foldl(
       fun({Key, Value}, [CondSqls, CondValues]) ->
  -      [["`" ++ atom_to_list(Key) ++ "`=?"|CondSqls], [Value|CondValues]]
  +      [
  +        [[escape(atom_to_list(Key)), "=?"]|CondSqls],
  +        [Value|CondValues]
  +      ]
       end,
       [[],[]],
       Conditions
     ),
  -  Sql1 =
  -    "SELECT * FROM `" ++ atom_to_list(DocName) ++
  -    "` WHERE "++ string:join(Sqls, " AND "),
  +  % Select * is not good.. 
  +  Sql1 =[
  +    "SELECT * FROM ", escape(atom_to_list(DocName)),
  +    " WHERE ", string:join(Sqls, " AND ")
  +  ],
     Sql = case Limit of
       0 -> Sql1;
  -    _ ->
  -      Sql1 ++ " LIMIT " ++ integer_to_list(Offset) ++ ","
  -      ++ integer_to_list(Limit)
  +    _ -> [Sql1|[" LIMIT ", integer_to_list(Offset), ",", integer_to_list(Limit)]]
     end,
     case execute(Sql, Values, State) of
       #result_packet{rows = Rows, field_list = Fields} ->
  
positive.code:     NewDoc#sumo_doc.fields
    ),
  
    Dql = "INSERT INTO `"
      ++ atom_to_list(DocName) ++ "` (" ++ string:join(ColumnDqls, ",") ++ ")"
      ++ " VALUES (" ++ string:join(ColumnSqls, ",") ++ ")"
      ++ " ON DUPLICATE KEY UPDATE "
      ++ string:join(lists:map(
        fun(ColumnName) ->
          ColumnName ++ "=?"
        end,
        ColumnDqls
      ), ","),
    emysql:prepare(insert_stmt, list_to_binary(Dql)),
    case execute(Dql, lists:append(ColumnValues, ColumnValues), State) of
      #ok_packet{insert_id = InsertId} ->
  
negative.code:   )).
  
  create_index(Name, id) ->
    ["PRIMARY KEY(", escape(atom_to_list(Name)), ")"];
  
  create_index(Name, unique) ->
    List = atom_to_list(Name),
    ["UNIQUE KEY ", escape(List), " (", escape(List), ")"];
  
  create_index(Name, index) ->
    List = atom_to_list(Name),
    ["KEY ", escape(List), " (", escape(List), ")"];
  
  create_index(_, _) ->
    none.
  
  execute(Query, Args, #state{pool=Pool}) when is_list(Query), is_list(Args) ->
    ok = emysql:prepare(stmt, iolist_to_binary(Query)),
    lager:debug("Query: ~s ->  ~p ~n", [Query, Args]),
    emysql:execute(Pool, stmt, Args).
  
  