//public async Task<string> WebMethod2() public void WebMethod2(Action<string> yield) { // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, // conversion done in AddParameter // .stack rewriter needs to store struct. can we create new byref struct parameters? //EventTime = DateTime.Now.AddDays(-0), // conversion done in Insert? z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } Console.WriteLine("after insert " + new { rid }); var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); // I/System.Console( 7320): {{ c = 18, rid = 18 }} //return new { c, rid }.ToString(); yield( "TestAndroidInsert " + new { c, rid }.ToString() ); }
//public async Task<string> WebMethod2() public void WebMethod2(Action <string> yield) { // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, // conversion done in AddParameter // .stack rewriter needs to store struct. can we create new byref struct parameters? //EventTime = DateTime.Now.AddDays(-0), // conversion done in Insert? z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } Console.WriteLine("after insert " + new { rid }); var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); // I/System.Console( 7320): {{ c = 18, rid = 18 }} //return new { c, rid }.ToString(); yield( "TestAndroidInsert " + new { c, rid }.ToString() ); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\ClickCounter\ClickCounter\Application.cs // X:\jsc.svn\examples\javascript\LINQ\LINQWebCamAvatars\LINQWebCamAvatars\Application.cs // string DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); //n.Create(); n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); //var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); // /* 2102:0007 */ /* let */ `PerformanceResourceTimingData2ApplicationPerformance`.`Key` as /* x */ `Key` var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() orderby x.Timestamp descending select new[] { x.z }; var f = q.FirstOrDefault(); Console.WriteLine(new { f }); //new xApplicationPerformance().Where(x => x.Key == f.Key).Delete(); //new PerformanceResourceTimingData2ApplicationPerformance().Delete(x => x.Key == f.Key); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\ClickCounter\ClickCounter\Application.cs // X:\jsc.svn\examples\javascript\LINQ\LINQWebCamAvatars\LINQWebCamAvatars\Application.cs // string DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); //n.Create(); n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); //var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); // /* 2102:0007 */ /* let */ `PerformanceResourceTimingData2ApplicationPerformance`.`Key` as /* x */ `Key` var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() orderby x.Timestamp descending select new[] { x.z }; var f = q.FirstOrDefault(); Console.WriteLine(new { f }); //new xApplicationPerformance().Where(x => x.Key == f.Key).Delete(); //new PerformanceResourceTimingData2ApplicationPerformance().Delete(x => x.Key == f.Key); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\ClickCounter\ClickCounter\Application.cs // X:\jsc.svn\examples\javascript\LINQ\LINQWebCamAvatars\LINQWebCamAvatars\Application.cs #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion //new[] { 5 }.Average(); // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5 }, new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 55 }, new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 555 } ); //var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); var c = (from x in new PerformanceResourceTimingData2ApplicationPerformance() select x.connectStart ).Average(); // { c = 205 } Console.WriteLine(new { c }); Debugger.Break(); }
static void Main(string[] args) { #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, //EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } // sumLong = 0 var sumLong = ( from x in new PerformanceResourceTimingData2ApplicationPerformance() where x.connectEnd == 13 select x.connectStart ).Sum(); Console.WriteLine(new { sumLong }); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\ClickCounter\ClickCounter\Application.cs // X:\jsc.svn\examples\javascript\LINQ\LINQWebCamAvatars\LINQWebCamAvatars\Application.cs #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion //new[] { 5 }.Average(); // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5 }, new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 55 }, new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 555 } ); //var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); var c = (from x in new PerformanceResourceTimingData2ApplicationPerformance() select x.connectStart ).Average(); // { c = 205 } Console.WriteLine(new { c }); Debugger.Break(); }
static void Main(string[] args) { #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, //EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } // sumLong = 0 var sumLong = ( from x in new PerformanceResourceTimingData2ApplicationPerformance() where x.connectEnd == 13 select x.connectStart ).Sum(); Console.WriteLine(new { sumLong }); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\ClickCounter\ClickCounter\Application.cs // X:\jsc.svn\examples\javascript\LINQ\LINQWebCamAvatars\LINQWebCamAvatars\Application.cs #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\ClickCounter\ClickCounter\Application.cs // X:\jsc.svn\examples\javascript\LINQ\LINQWebCamAvatars\LINQWebCamAvatars\Application.cs #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); }
public static void Main(string[] args) { try { #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the safe way to hint we need to talk PHP dialect // ScriptCoreLib.Query.Experimental.QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; ScriptCoreLib.Query.Experimental.QueryExpressionBuilder.WithConnection = y => { Console.WriteLine("enter WithConnection"); // nuget? // <package id="System.Data.XMySQL" version="1.0.0.0" targetFramework="net451" /> var cc0 = new System.Data.MySQL.MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { //Database = UserID = "root", Server = "127.0.0.1", //SslMode = MySQLSslMode.VerifyFull //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // rdbms.driver=com.mysql.jdbc.Driver // http://www.codejava.net/java-se/jdbc/connect-to-mysql-database-via-jdbc try { // mysql-connector-java-5.1.37-bin.jar //java.lang.ClassLoader.getSystemClassLoader(). // Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver //java.sql.Driver drv = new xDriver { }; var drv = (java.sql.Driver)xDriver.Create(); Console.WriteLine(new { drv }); java.sql.DriverManager.registerDriver(drv); //var cDriver = java.lang.Class.forName("com.mysql.jdbc.Driver"); } catch { throw; } ScriptCoreLibJava.BCLImplementation.System.Data.SQLite.__MySQLConnection.OpenConnectionPrefix = "jdbc:mysql://"; cc0.Open(); // http://stackoverflow.com/questions/1457716/what-is-the-mysql-jdbc-driver-connection-string //Caused by: java.lang.RuntimeException: __SQLiteConnection { Message = No suitable driver found for jdbc:google:rdbms://127.0.0.1, StackTrace = java.sql.SQLException: No suitable driver found for jdbc:google:rdbms://127.0.0.1 // at java.sql.DriverManager.getConnection(Unknown Source) // at java.sql.DriverManager.getConnection(Unknown Source) // at ScriptCoreLibJava.BCLImplementation.System.Data.SQLite.__MySQLConnection.Open(__MySQLConnection.java:78) #region use db { var QDataSource = "TestUbuntuMySQLInsert"; // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteNonQuery(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteNonQuery(); } #endregion y(cc0); // jsc java does the wrong thing here cc0.Close(); //cc0.Dispose(); Console.WriteLine("exit WithConnection"); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, // conversion done in AddParameter // .stack rewriter needs to store struct. can we create new byref struct parameters? //EventTime = DateTime.Now.AddDays(-0), // conversion done in Insert? z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } Console.WriteLine("after insert " + new { rid }); var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); } catch (Exception err) { Console.WriteLine(new { err.Message, err.StackTrace }); } Console.ReadLine(); }
public static void Main(string[] args) { try { #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the safe way to hint we need to talk PHP dialect // ScriptCoreLib.Query.Experimental.QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; ScriptCoreLib.Query.Experimental.QueryExpressionBuilder.WithConnection = y => { Console.WriteLine("enter WithConnection"); // nuget? // <package id="System.Data.XMySQL" version="1.0.0.0" targetFramework="net451" /> var cc0 = new System.Data.MySQL.MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { //Database = UserID = "root", Server = "127.0.0.1", //SslMode = MySQLSslMode.VerifyFull //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // rdbms.driver=com.mysql.jdbc.Driver // http://www.codejava.net/java-se/jdbc/connect-to-mysql-database-via-jdbc try { // mysql-connector-java-5.1.37-bin.jar //java.lang.ClassLoader.getSystemClassLoader(). // Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver //java.sql.Driver drv = new xDriver { }; var drv = (java.sql.Driver)xDriver.Create(); Console.WriteLine(new { drv }); java.sql.DriverManager.registerDriver(drv); //var cDriver = java.lang.Class.forName("com.mysql.jdbc.Driver"); } catch { throw; } ScriptCoreLibJava.BCLImplementation.System.Data.SQLite.__MySQLConnection.OpenConnectionPrefix = "jdbc:mysql://"; cc0.Open(); // http://stackoverflow.com/questions/1457716/what-is-the-mysql-jdbc-driver-connection-string //Caused by: java.lang.RuntimeException: __SQLiteConnection { Message = No suitable driver found for jdbc:google:rdbms://127.0.0.1, StackTrace = java.sql.SQLException: No suitable driver found for jdbc:google:rdbms://127.0.0.1 // at java.sql.DriverManager.getConnection(Unknown Source) // at java.sql.DriverManager.getConnection(Unknown Source) // at ScriptCoreLibJava.BCLImplementation.System.Data.SQLite.__MySQLConnection.Open(__MySQLConnection.java:78) #region use db { var QDataSource = "TestUbuntuMySQLInsert"; // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteNonQuery(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteNonQuery(); } #endregion y(cc0); // jsc java does the wrong thing here cc0.Close(); //cc0.Dispose(); Console.WriteLine("exit WithConnection"); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, // conversion done in AddParameter // .stack rewriter needs to store struct. can we create new byref struct parameters? //EventTime = DateTime.Now.AddDays(-0), // conversion done in Insert? z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } Console.WriteLine("after insert " + new { rid }); var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); } catch (Exception err) { Console.WriteLine(new { err.Message, err.StackTrace }); } Console.ReadLine(); }
static void Main(string[] args) { #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); n.Delete(); new PerformanceResourceTimingData2ApplicationPerformance().Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); new PerformanceResourceTimingData2ApplicationResourcePerformance().Insert( new PerformanceResourceTimingData2ApplicationResourcePerformanceRow { // lookup connectStart = 5, duration = 77 }, new PerformanceResourceTimingData2ApplicationResourcePerformanceRow { // lookup connectStart = 5, duration = 33 } ); var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() let rminq = from y in new PerformanceResourceTimingData2ApplicationResourcePerformance() where y.connectStart == x.connectStart select y.duration let rmin = rminq.Min() select new { rmin }; var f = q.FirstOrDefault(); //var f = q.Min(); Console.WriteLine(new { f }); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\ClickCounter\ClickCounter\Application.cs // X:\jsc.svn\examples\javascript\LINQ\LINQWebCamAvatars\LINQWebCamAvatars\Application.cs //Console.WriteLine("i am a zombie"); // string DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); //{ // // Error 101 Cannot initialize type 'TestSelectMath.PerformanceResourceTimingData2ApplicationPerformance' with a collection initializer because it does not implement 'System.Collections.IEnumerable' X:\jsc.svn\examples\javascript\LINQ\test\auto\TestSelect\TestSelectMath\Program.cs 39 9 TestSelectMath // new PerformanceResourceTimingData2ApplicationPerformanceRow // { // connectStart = 5, // connectEnd = 13, // EventTime = DateTime.Now.AddDays(-0), // z = new XElement("goo", "foo") // } //}; //n.Create(); n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() //orderby x.Timestamp descending select new { x.z, x.Key, x.connectStart, x.connectEnd, x.Timestamp }; var f = q.FirstOrDefault(); Console.WriteLine(new { f }); //new xApplicationPerformance().Where(x => x.Key == f.Key).Delete(); //new PerformanceResourceTimingData2ApplicationPerformance().Delete(x => x.Key == f.Key); new PerformanceResourceTimingData2ApplicationPerformance().Delete(f.Key); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the idea is to test MySQL as we have LINQ to SQL also running in chrome now var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(500); #region MySQLConnection // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); cc0.Dispose(); }; #endregion //'TestXMySQL.PerformanceResourceTimingData2ApplicationPerformanceRow' cannot be used for delegate parameter of type 'System.Object' // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); //n.Create(); // wont return? jsc broke xMySQL async? no there was an sql error //var count = n.CountAsync(cc0).Result; var count = n.Count(); // ScriptCoreLib.Async n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0) } // if you do not wait you wont get the id damn it ); // should be based on QueryExpressionBuilder.Dialect, and wait for the last async? //var id = cc0.GetLastInsertRowId(); // http://stackoverflow.com/questions/5440168/c-sharp-mysql-there-is-already-an-open-datareader-associated-with-this-connectio var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() orderby x.Timestamp descending select new { x.Key, x.connectStart, x.connectEnd, x.Timestamp }; //var f = q.FirstOrDefaultAsync().Result; var f = q.FirstOrDefault(); Console.WriteLine(new { f }); //new PerformanceResourceTimingData2ApplicationPerformance().Where(x => x.Key == f.Key).Delete(); //new PerformanceResourceTimingData2ApplicationPerformance().Delete(x => x.Key == f.Key); new PerformanceResourceTimingData2ApplicationPerformance().Delete(f.Key); mysqldp.CloseMainWindow(); Debugger.Break(); }
static void Main(string[] args) { #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); n.Delete(); n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); var ee = n.AsEnumerable(); var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() //orderby x.Timestamp descending select new { x.z, x.Key, x.connectStart, x.connectEnd, x.Timestamp } into g select g; //select g.connectStart; //var f = q.FirstOrDefault(); // X:\jsc.svn\examples\javascript\forms\test\TestMinSelector\TestMinSelector\ApplicationControl.cs var f = q.Min(k => k.connectStart); //var f = q.Min(); Console.WriteLine(new { f }); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the idea is to test MySQL as we have LINQ to SQL also running in chrome now //var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; var mysqld = @"X:\util\xampp-win32-1.8.3-5-VC11\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // C:\util\xampp\mysql\bin\mysqld.exe --defaults-file=C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\my.ini mysql // already running as a service? //151019 12:23:06 InnoDB: Operating system error number 32 in a file operation. //InnoDB: The error means that another program is using InnoDB's files. //InnoDB: This might be a backup or antivirus software or another instance //InnoDB: of MySQL. Please close it to get rid of this error. // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(3000); // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", //SslMode = MySQLSslMode.VerifyFull //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); // Additional information: Authentication to host '127.0.0.1' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'localhost' (using password: NO) // https://www.apachefriends.org/download.html #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteNonQuery(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteNonQuery(); } #endregion y(cc0); cc0.Dispose(); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); Debugger.Break(); // + $exception {"Process has exited, so the requested information is not available."} System.Exception {System.InvalidOperationException} mysqldp.CloseMainWindow(); }
static void Main(string[] args) { #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); n.Delete(); n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); var ee =n.AsEnumerable(); var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() //orderby x.Timestamp descending select new { x.z, x.Key, x.connectStart, x.connectEnd, x.Timestamp } into g select g; //select g.connectStart; //var f = q.FirstOrDefault(); // X:\jsc.svn\examples\javascript\forms\test\TestMinSelector\TestMinSelector\ApplicationControl.cs var f = q.Min(k => k.connectStart); //var f = q.Min(); Console.WriteLine(new { f }); }
static void Main(string[] args) { #region QueryExpressionBuilder.WithConnection QueryExpressionBuilder.WithConnection = y => { var cc = new SQLiteConnection( new SQLiteConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); cc.Open(); y(cc); cc.Dispose(); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); n.Delete(); new PerformanceResourceTimingData2ApplicationPerformance().Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); new PerformanceResourceTimingData2ApplicationResourcePerformance().Insert( new PerformanceResourceTimingData2ApplicationResourcePerformanceRow { // lookup connectStart = 5, duration = 77 }, new PerformanceResourceTimingData2ApplicationResourcePerformanceRow { // lookup connectStart = 5, duration = 33 } ); var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() let rminq = from y in new PerformanceResourceTimingData2ApplicationResourcePerformance() where y.connectStart == x.connectStart select y.duration let rmin = rminq.Min() select new { rmin }; var f = q.FirstOrDefault(); //var f = q.Min(); Console.WriteLine(new { f }); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs #region MySQLConnection // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the idea is to test MySQL as we have LINQ to SQL also running in chrome now //var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; var mysqld = @"X:\util\xampp-win32-1.8.3-5-VC11\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // C:\util\xampp\mysql\bin\mysqld.exe --defaults-file=C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\my.ini mysql // already running as a service? //151019 12:23:06 InnoDB: Operating system error number 32 in a file operation. //InnoDB: The error means that another program is using InnoDB's files. //InnoDB: This might be a backup or antivirus software or another instance //InnoDB: of MySQL. Please close it to get rid of this error. // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(3000); // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", //SslMode = MySQLSslMode.VerifyFull //ConnectionTimeout = 3000 }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); // Additional information: Authentication to host '127.0.0.1' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'localhost' (using password: NO) // https://www.apachefriends.org/download.html #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteNonQuery(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteNonQuery(); } #endregion y(cc0); cc0.Dispose(); }; #endregion var n = new PerformanceResourceTimingData2ApplicationPerformance(); var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0), z = new XElement("goo", "foo") } ); // { LastInsertRowId = 2 } var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); Debugger.Break(); // + $exception {"Process has exited, so the requested information is not available."} System.Exception {System.InvalidOperationException} mysqldp.CloseMainWindow(); }
static void Main(string[] args) { // X:\jsc.svn\examples\javascript\LINQ\test\TestSelectGroupByAndConstant\TestSelectGroupByAndConstant\ApplicationWebService.cs // the idea is to test MySQL as we have LINQ to SQL also running in chrome now var mysqld = @"C:\util\xampp-win32-1.8.0-VC9\xampp\mysql\bin\mysqld.exe"; // --standalone --console var mysqldp = Process.Start(mysqld, " --standalone --console"); // Additional information: WaitForInputIdle failed. This could be because the process does not have a graphical interface. //mysqldp.WaitForInputIdle(); Thread.Sleep(500); #region MySQLConnection // the safe way to hint we need to talk PHP dialect QueryExpressionBuilder.Dialect = QueryExpressionBuilderDialect.MySQL; QueryExpressionBuilder.WithConnection = y => { var DataSource = "file:xApplicationPerformance.xlsx.sqlite"; var cc0 = new MySQLConnection( new System.Data.MySQL.MySQLConnectionStringBuilder { UserID = "root", Server = "127.0.0.1", }.ToString() //new MySQLConnectionStringBuilder { DataSource = "file:PerformanceResourceTimingData2.xlsx.sqlite" }.ToString() ); // Additional information: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'asus7' (using password: NO) // Additional information: Unable to connect to any of the specified MySQL hosts. cc0.Open(); #region use db { var a = Assembly.GetExecutingAssembly().GetName(); // SkipUntilIfAny ??? var QDataSource = a.Name + ":" + DataSource.SkipUntilIfAny("file:").TakeUntilIfAny(".xlsx.sqlite"); // QDataSource.Length = 76 var QLengthb = QDataSource.Length; // Database 64 cc0.CreateCommand("CREATE DATABASE IF NOT EXISTS `" + QDataSource + "`").ExecuteScalar(); cc0.CreateCommand("use `" + QDataSource + "`").ExecuteScalar(); } #endregion y(cc0); cc0.Dispose(); }; #endregion //'TestXMySQL.PerformanceResourceTimingData2ApplicationPerformanceRow' cannot be used for delegate parameter of type 'System.Object' // ThreadLocal SynchronizationContext aware ConnectionPool? var n = new PerformanceResourceTimingData2ApplicationPerformance(); //n.Create(); // wont return? jsc broke xMySQL async? no there was an sql error //var count = n.CountAsync(cc0).Result; var count = n.Count(); // ScriptCoreLib.Async n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, EventTime = DateTime.Now.AddDays(-0) } // if you do not wait you wont get the id damn it ); // should be based on QueryExpressionBuilder.Dialect, and wait for the last async? //var id = cc0.GetLastInsertRowId(); // http://stackoverflow.com/questions/5440168/c-sharp-mysql-there-is-already-an-open-datareader-associated-with-this-connectio var q = from x in new PerformanceResourceTimingData2ApplicationPerformance() orderby x.Timestamp descending select new { x.Key, x.connectStart, x.connectEnd, x.Timestamp }; //var f = q.FirstOrDefaultAsync().Result; var f = q.FirstOrDefault(); Console.WriteLine(new { f }); //new PerformanceResourceTimingData2ApplicationPerformance().Where(x => x.Key == f.Key).Delete(); //new PerformanceResourceTimingData2ApplicationPerformance().Delete(x => x.Key == f.Key); new PerformanceResourceTimingData2ApplicationPerformance().Delete(f.Key); mysqldp.CloseMainWindow(); Debugger.Break(); }
public async Task<long> AddAndCount(XElement value) { var n = new PerformanceResourceTimingData2ApplicationPerformance(); // using var rid = n.Insert( new PerformanceResourceTimingData2ApplicationPerformanceRow { connectStart = 5, connectEnd = 13, // conversion done in AddParameter // .stack rewriter needs to store struct. can we create new byref struct parameters? //EventTime = DateTime.Now.AddDays(-0), // conversion done in Insert? z = new XElement("goo2", value) } ); // { LastInsertRowId = 2 } Console.WriteLine("after insert " + new { rid }); var c = new PerformanceResourceTimingData2ApplicationPerformance().Count(); Console.WriteLine(new { c, rid }); // Error 10 Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?) Z:\jsc.svn\examples\javascript\ubuntu\Test\UbuntuTestMySQLInsert\UbuntuTestMySQLInsert\ApplicationWebService.cs 191 20 UbuntuTestMySQLInsert return c; }