public static void Main(string[] args) { // jsc needs to see args to make Main into main for javac.. // see also> // X:\jsc.svn\examples\javascript\android\AndroidBroadcastLogger\AndroidBroadcastLogger\ApplicationWebService.cs System.Console.WriteLine( typeof(object).AssemblyQualifiedName ); //Y:\staging\web\java\JVMCLRSyntaxOrderByThenGroupBy__i__d\Internal\Query\Experimental\QueryExpressionBuilder_SQLWriter_1___c__DisplayClass14.java:54: error: bad operand types for binary operator '||' // if (!(!(this.CS___8__locals64.zSelect != null) || ((this.CS___8__locals64.zSelect.source) || ((this.CS___8__locals64.CS___8__locals19.CS___8__locals18.upperParameter == null))))) // if (!(!(select1 != null) || ((select1.source != null) || ((select0 == null))))) ^ // seems like == null is missing? var upperParameter = new xSelect(); var zSelect = new xSelect(); if (zSelect != null && zSelect.source == null && upperParameter != null) { } CLRProgram.CLRMain(); }
public static TKey Insert <TElement, TKey>(this xSelect <TKey, TElement> source, TElement value) { var LastInsertRowId = default(TKey); WithConnection( cc => { LastInsertRowId = Insert(source, cc, value); } ); return(LastInsertRowId); }
//public static void Insert<TElement>(this IQueryStrategy<TElement> source, IDbConnection cc, TElement value) public static TKey Insert <TElement, TKey>(this xSelect <TKey, TElement> source, IDbConnection cc, TElement value) { if (cc == null) { if (Debugger.IsAttached) { Debugger.Break(); } } // X:\jsc.svn\core\ScriptCoreLib.Async\ScriptCoreLib.Async\Query\Experimental\QueryExpressionBuilderAsync.IDbConnection.Insert.cs // tested by // X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestSQLiteCLRInsert\Program.cs var c = GetInsertCommand(source, cc, value) as DbCommand; var n = c.ExecuteNonQuery(); // jsc makes all Keys of long, yet data layer seems to talk int? long LastInsertRowId = IDbConnectionExtensions.GetLastInsertRowId(cc); //Console.WriteLine("Insert " + new { LastInsertRowId }); // Additional information: Invalid cast from 'System.Int32' to 'TestSQLiteCLRInsert.PerformanceResourceTimingData2ApplicationPerformanceRow'. // Additional information: Specified cast is not valid. return((TKey)(object)LastInsertRowId); //var __value = (TKey)Convert.ChangeType(LastInsertRowId, source.keySelector.Parameters[0].Type); //return __value; //var nKey = cc. // public const string CreateCommandText = @"create table // if not exists `PerformanceResourceTimingData2.ApplicationPerformance` ( // `Key` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, // `connectStart` BIGINT NOT NULL, // `connectEnd` BIGINT NOT NULL, // `requestStart` BIGINT NOT NULL, // `responseStart` BIGINT NOT NULL, // `responseEnd` BIGINT NOT NULL, // `domLoading` BIGINT NOT NULL, // `domComplete` BIGINT NOT NULL, // `loadEventStart` BIGINT NOT NULL, // `loadEventEnd` BIGINT NOT NULL, // `EventTime` BIGINT NOT NULL, // `Tag` TEXT, // `Timestamp` BIGINT NOT NULL)"; }
public static TKey Insert <TElement, TKey>(this xSelect <TKey, TElement> source, TElement value) { var LastInsertRowId = default(TKey); // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201510/20151007 // can we have a default? at if in CLR perhaps sqlite at appcache? WithConnection( cc => { LastInsertRowId = Insert(source, cc, value); } ); return(LastInsertRowId); }
// should be exposing IQueryStrategy instead of xSelect public static void Delete <TElement, TKey>(this xSelect <TKey, TElement> source, TKey key) { //Console.WriteLine("enter Delete " + new { key }); //source.keySelector // will this work for chrome too? // do we have enough type information available now? #region filter // Member = {TestXMySQL.PerformanceResourceTimingData2ApplicationPerformanceKey Key} var xMemberInitExpression = source.keySelector.Body as MemberInitExpression; var xFieldInfo = xMemberInitExpression.Bindings[0].Member as FieldInfo; var p = Expression.Parameter( // xrow xMemberInitExpression.Type, "x" ); //Additional information: Field 'TestXMySQL.PerformanceResourceTimingData2ApplicationPerformanceRow.Key' is not defined for type 'System.Object' // UnaryExpression var BodyLeft = Expression.Convert( Expression.Field(p, xFieldInfo), // FieldExpression typeof(long), null ); //Console.WriteLine(new { BodyLeft }); var BodyRight = Expression.Convert( Expression.Constant(key), typeof(long), null ); var e = Expression.Equal(BodyLeft, BodyRight); var filter = Expression.Lambda(e, p); #endregion //Delete(source, filter); // X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestXMySQL\Program.cs source.Where(filter).Delete(); }
public static TKey[] Insert <TElement, TKey>(this xSelect <TKey, TElement> source, params TElement[] collection) { // used by // X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestSelectAverage\Program.cs // x:\jsc.svn\examples\javascript\linq\test\auto\testselect\testweborderbythengroupby\application.cs var LastInsertRowId = new List <TKey>(); WithConnection( cc => { foreach (var item in collection) { LastInsertRowId.Add( Insert(source, cc, item) ); } } ); return(LastInsertRowId.ToArray()); }