@@ -106,7 +106,7 @@ public override string ToString()
106106 /// Converts the query to a count query.
107107 /// </summary>
108108 /// <returns>A new <see cref="SQLitePCL.pretty.Orm.TableQuery<T>"/>.</returns>
109- public TableQuery < T > ToCountQuery ( )
109+ public TableQuery < T > Count ( )
110110 {
111111 return new TableQuery < T > ( _mapping , "count(*)" , _where , _orderBy , _limit , _offset ) ;
112112 }
@@ -446,8 +446,6 @@ private static string CompileNullBinaryExpression(BinaryExpression expression, s
446446 else { throw new NotSupportedException ( "Cannot compile Null-BinaryExpression with type " + expression . NodeType . ToString ( ) ) ; }
447447 }
448448
449-
450-
451449 private static string GetSqlName ( Expression expr )
452450 {
453451 var n = expr . NodeType ;
@@ -471,7 +469,7 @@ private static string GetSqlName (Expression expr)
471469 /// </summary>
472470 public static class TableQuery
473471 {
474- public static ITableMappedStatement < T > PrepareQuery < T > ( this IDatabaseConnection This , TableQuery < T > query )
472+ public static ITableMappedStatement < T > PrepareStatement < T > ( this IDatabaseConnection This , TableQuery < T > query )
475473 {
476474 return new TableMappedStatement < T > ( This . PrepareStatement ( query . ToString ( ) ) , query . Mapping ) ;
477475 }
@@ -491,19 +489,19 @@ public static IObservable<T> Query<T>(this IAsyncDatabaseConnection This, TableQ
491489 return This . Query ( query . ToString ( ) ) . Select ( query . Mapping . ToObject ) ;
492490 }
493491
494- public static IStatement PrepareCount < T > ( this IDatabaseConnection This , TableQuery < T > query )
492+ public static IStatement PrepareCountStatement < T > ( this IDatabaseConnection This , TableQuery < T > query )
495493 {
496- return This . PrepareStatement ( query . ToCountQuery ( ) . ToString ( ) ) ;
494+ return This . PrepareStatement ( query . Count ( ) . ToString ( ) ) ;
497495 }
498496
499- public static Task < IAsyncStatement > PrepareCountAsync < T > ( this IAsyncDatabaseConnection This , TableQuery < T > query )
497+ public static Task < IAsyncStatement > PrepareCountStatemenAsync < T > ( this IAsyncDatabaseConnection This , TableQuery < T > query )
500498 {
501- return This . PrepareStatementAsync ( query . ToCountQuery ( ) . ToString ( ) ) ;
499+ return This . PrepareStatementAsync ( query . Count ( ) . ToString ( ) ) ;
502500 }
503501
504502 public static int Count < T > ( this IDatabaseConnection This , TableQuery < T > query )
505503 {
506- return This . Query ( query . ToCountQuery ( ) . ToString ( ) ) . SelectScalarInt ( ) . First ( ) ;
504+ return This . Query ( query . Count ( ) . ToString ( ) ) . SelectScalarInt ( ) . First ( ) ;
507505 }
508506
509507 public static Task < int > CountAsync < T > ( this IAsyncDatabaseConnection This , TableQuery < T > query )
@@ -513,12 +511,12 @@ public static Task<int> CountAsync<T>(this IAsyncDatabaseConnection This, TableQ
513511
514512 public static Task < int > CountAsync < T > ( this IAsyncDatabaseConnection This , TableQuery < T > query , CancellationToken ct )
515513 {
516- return This . Query ( query . ToCountQuery ( ) . ToString ( ) ) . SelectScalarInt ( ) . FirstAsync ( ) . ToTask ( ct ) ;
514+ return This . Query ( query . Count ( ) . ToString ( ) ) . SelectScalarInt ( ) . FirstAsync ( ) . ToTask ( ct ) ;
517515 }
518516
519517 public static int Count < T > ( this IDatabaseConnection This , TableQuery < T > query , params object [ ] values )
520518 {
521- return This . Query ( query . ToCountQuery ( ) . ToString ( ) , values ) . SelectScalarInt ( ) . First ( ) ;
519+ return This . Query ( query . Count ( ) . ToString ( ) , values ) . SelectScalarInt ( ) . First ( ) ;
522520 }
523521
524522 public static Task < int > CountAsync < T > ( this IAsyncDatabaseConnection This , TableQuery < T > query , params object [ ] values )
@@ -528,7 +526,7 @@ public static Task<int> CountAsync<T>(this IAsyncDatabaseConnection This, TableQ
528526
529527 public static Task < int > CountAsync < T > ( this IAsyncDatabaseConnection This , TableQuery < T > query , CancellationToken ct , params object [ ] values )
530528 {
531- return This . Query ( query . ToCountQuery ( ) . ToString ( ) , values ) . SelectScalarInt ( ) . FirstAsync ( ) . ToTask ( ct ) ;
529+ return This . Query ( query . Count ( ) . ToString ( ) , values ) . SelectScalarInt ( ) . FirstAsync ( ) . ToTask ( ct ) ;
532530 }
533531 }
534532}
0 commit comments