本文整理汇总了C#中Cassandra.Session.Prepare方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Prepare方法的具体用法?C# Session.Prepare怎么用?C# Session.Prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cassandra.Session
的用法示例。
在下文中一共展示了Session.Prepare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VideoDbBasicImpl
//private ExecutorService executor;
public VideoDbBasicImpl(List<String> contactPoints, String keyspace)
{
cluster = Cluster
.Builder()
.AddContactPoints(contactPoints.ToArray())
.WithRetryPolicy(Policies.DefaultRetryPolicy)
.Build();
session = cluster.Connect(keyspace);
getUserByNamePreparedStatement = session.Prepare(GET_USER_BY_USERNAME);
setUser = session.Prepare(SET_USER);
getVideosByUsernamePreparedStatement = session
.Prepare(GET_VIDEOS_BY_USERNAME);
getVideoByIDPreparedStatement = session.Prepare(GET_VIDEO_BY_ID);
getVideosByTagPreparedStatement = session.Prepare(GET_VIDEOS_BY_TAG);
getRatingByVideoPreparedStatement = session
.Prepare(GET_RATING_BY_VIDEO);
setCommentByVideo = session.Prepare(SET_COMMENT_BY_VIDEO);
setCommentByUsername = session.Prepare(SET_COMMENT_BY_USERNAME);
getCommentByUsername = session.Prepare(GET_COMMENT_BY_USERNAME);
getCommentByVideoId = session.Prepare(GET_COMMENT_BY_VIDEOID);
timeOfDayRetryPolicy = new TimeOfDayRetryPolicy(9, 17);
// Create a thread pool equal to the number of cores
/*
executor = Executors.newFixedThreadPool(Runtime.getRuntime()
.availableProcessors());
*/
}
示例2: PrepareQuery
public PreparedStatement PrepareQuery(Session session, string query, string messageInstead = null)
{
if (messageInstead != null)
Console.WriteLine("CQL<\t" + messageInstead);
else
Console.WriteLine("CQL< Prepared Query:\t" + query);
var ret = session.Prepare(query);
Console.WriteLine("CQL> (OK).");
return ret;
}