private void login() { List <IEntity> args = new List <IEntity>(); if (this.encrypted) { BasicString keyCode = (BasicString)run("getDynamicPublicKey()"); string key = RSAUtils.GetKey(keyCode.getString()); string usr = RSAUtils.RSA(this.userId, key); string pass = RSAUtils.RSA(this.password, key); args.Add(new BasicString(usr)); args.Add(new BasicString(pass)); args.Add(new BasicBoolean(true)); run("login", args); } else { args.Add(new BasicString(userId)); args.Add(new BasicString(password)); run("login('" + this.userId + "','" + this.password + "')"); //no encrypted temporary } //login("login", args); }
public void blob_scalar() { DBConnection db = new DBConnection(); db.connect(SERVER, PORT); BasicString str = (BasicString)db.run("mt=table(take(1..1000000,1000000) as id,take(`fyf``ftf`ddtjtydtyty`通常都是,1000000) as str,take(`fyf``ftf`ddtjtydtyty`通常都是,1000000) as str1," + "take(`fyf``ftf`ddtjtydtyty`通常都是,1000000) as str2);blob(mt.toStdJson())"); db.close(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public PartitionedTableAppender(String tableName, String host, int port, int threadCount) throws java.io.IOException public PartitionedTableAppender(string tableName, string host, int port, int threadCount) { this.tableName = new BasicString(tableName); DBConnection conn = new DBConnection(); BasicAnyVector locations; AbstractVector partitionSchema; BasicTable colDefs; BasicIntVector typeInts; try { conn.connect(host, port); tableInfo = (BasicDictionary)conn.run("schema(" + tableName + ")"); partitionColumnIdx = ((BasicInt)tableInfo.get(new BasicString("partitionColumnIndex"))).Int; if (partitionColumnIdx == -1) { throw new Exception("Table '" + tableName + "' is not partitioned"); } locations = (BasicAnyVector)tableInfo.get(new BasicString("partitionSites")); int partitionType = ((BasicInt)tableInfo.get(new BasicString("partitionType"))).Int; partitionSchema = (AbstractVector)tableInfo.get(new BasicString("partitionSchema")); router = TableRouterFacotry.createRouter(Enum.GetValues(typeof(Entity_PARTITION_TYPE))[partitionType], partitionSchema, locations); colDefs = ((BasicTable)tableInfo.get(new BasicString("colDefs"))); this.cols = colDefs.getColumn(0).rows(); typeInts = (BasicIntVector)colDefs.getColumn("typeInt"); this.columnCategories = new Entity_DATA_CATEGORY[this.cols]; this.columnTypes = new Entity_DATA_TYPE[this.cols]; for (int i = 0; i < cols; ++i) { this.columnTypes[i] = Enum.GetValues(typeof(Entity_DATA_TYPE))[typeInts.getInt(i)]; this.columnCategories[i] = Entity.typeToCategory(this.columnTypes[i]); } } catch (IOException e) { throw e; } finally { conn.close(); } this.threadCount = threadCount; if (this.threadCount <= 0) { this.threadCount = Math.Min(CORES, locations.rows()); } if (this.threadCount > 0) { this.threadCount--; } threadPool = Executors.newFixedThreadPool(this.threadCount); }
public void Test_udf() { DBConnection conn = new DBConnection(); conn.connect(SERVER, PORT, "admin", "123456"); var args = new List <IEntity> { new BasicString("linl") }; BasicString re = (BasicString)conn.run("Foo2", args); }
} // list of the stored highscore players /// <summary> /// scene constructor, reads the score data /// </summary> /// <param name="game">game</param> /// <param name="spriteBatch">spriteBatch for drawing</param> public HighScoreScene(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { this.texture = game.Content.Load <Texture2D>("Images/highscore_scene"); DoodleJumpGame djGame = (DoodleJumpGame)game; this.players = djGame.ReadScores(); // read the scores stored if (players != null) { SpriteFont standardItemFont = game.Content.Load <SpriteFont>("Fonts/standardItemFont"); int count = players.Count > MAX_CAPACITY ? MAX_CAPACITY : players.Count; // do not allow exceeding the bounds // display data read for (int i = 0; i < count; i++) { Color color = Color.Black; if (i == 0) { color = Color.DarkOrange; } else if (i == 1) { color = Color.Gray; } else if (i == 2) { color = Color.Brown; } BasicString numStr = new BasicString(game, spriteBatch, standardItemFont, $"{i + 1}. ", color); numStr.Position = new Vector2(NUM_PADDING, INIT_TOP_POSITION + LINE_HEIGHT * i); this.Components.Add(numStr); BasicString nameStr = new BasicString(game, spriteBatch, standardItemFont, $"{players[i].Name}", color); nameStr.Position = new Vector2(NAME_PADDING, INIT_TOP_POSITION + LINE_HEIGHT * i); this.Components.Add(nameStr); BasicString scoreStr = new BasicString(game, spriteBatch, standardItemFont, $"{players[i].Score}", color); scoreStr.Position = new Vector2(SCORE_PADDING, INIT_TOP_POSITION + LINE_HEIGHT * i); this.Components.Add(scoreStr); } } }
private void initialize(IList <long?> longs, BasicAnyVector locations) { if (locations.rows() <= 0) { throw new Exception("requires at least one location"); } if (locations.getEntity(0).DataType != Entity_DATA_TYPE.DT_STRING) { throw new Exception("location must be a string"); } if (isSorted(longs) == false) { throw new Exception("ranges " + longs.ToString() + " not sorted!"); } if (longs.Count != locations.rows() + 1) { throw new Exception("expect # locations == # range values - 1"); } ranges = longs.ToArray(); this.locations = new List <>(); bool isScalar = locations.getEntity(0).DataForm == Entity_DATA_FORM.DF_SCALAR; if (isScalar) { for (int i = 0; i < locations.rows(); ++i) { BasicString location = (BasicString)locations.get(i); this.locations.Add(location.String); } } else { for (int i = 0; i < locations.rows(); ++i) { BasicStringVector locationVector = (BasicStringVector)locations.getEntity(i); this.locations.Add(new List <>()); for (int j = 0; j < locationVector.rows(); ++j) { this.locations[this.locations.Count - 1].Add(((BasicString)locationVector.get(j)).String); } } } }
/// /// <param name="tableName"> name of the shared table </param> /// <param name="host"> host </param> /// <param name="port"> port </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public TableAppender(String tableName, String host, int port) throws java.io.IOException public TableAppender(string tableName, string host, int port) { this.tableName = new BasicString(tableName); this.conn = new DBConnection(); try { this.conn.connect(host, port); tableInfo = (BasicDictionary)conn.run("schema(" + tableName + ")"); int partitionColumnIdx = ((BasicInt)tableInfo.get(new BasicString("partitionColumnIndex"))).Int; if (partitionColumnIdx != -1) { throw new Exception("Table '" + tableName + "' is partitioned"); } BasicTable colDefs = ((BasicTable)tableInfo.get(new BasicString("colDefs"))); this.cols = colDefs.getColumn(0).rows(); } catch (IOException e) { throw e; } }
private void initialize(IList <string> strings, BasicAnyVector locations) { if (locations.rows() <= 0) { throw new Exception("requires at least one location"); } if (locations.getEntity(0).DataType != Entity_DATA_TYPE.DT_STRING) { throw new Exception("location must be a string"); } if (strings.Count != locations.rows()) { throw new Exception("expect # locations == # values"); } map = new Dictionary <>(); bool isScalar = locations.getEntity(0).DataForm == Entity_DATA_FORM.DF_SCALAR; if (isScalar) { for (int i = 0; i < locations.rows(); ++i) { BasicString location = (BasicString)locations.get(i); string val = strings[i]; map[val] = location.String; } } else { for (int i = 0; i < locations.rows(); ++i) { BasicStringVector locationVector = (BasicStringVector)locations.getEntity(i); string val = strings[i]; map[val] = new List <>(); for (int j = 0; j < locationVector.rows(); ++j) { map[val].Add(locationVector.getString(j)); } } } }
public void blob_imemory_table_upload_download_bigdata() { DBConnection db = new DBConnection(); db.connect(SERVER, PORT); db.run("share table(blob(`d`f) as blob)as st"); List <String> colNames = new List <String>(1); colNames.Add("str"); List <IVector> cols = new List <IVector>(1); BasicStringVector vec = new BasicStringVector(1000); BasicString str = (BasicString)db.run("mt=table(take(1..1000000,1000) as id,take(`fyf``ftf`ddtjtydtyty`通常都是,1000) as str,take(`fyf``ftf`ddtjtydtyty`通常都是,1000) as str1," + "take(`fyf``ftf`ddtjtydtyty`通常都是,1000) as str2);mt.toStdJson()"); String tmp = str.getString(); for (int i = 0; i < 1000; i++) { vec.setString(i, tmp + i.ToString()); } cols.Add(vec); BasicTable tb = new BasicTable(colNames, cols); List <IEntity> arg = new List <IEntity>() { tb }; // for (int i = 0; i < 100; i++) // { db.run("tableInsert{st}", arg); // } BasicTable st = (BasicTable)db.run("st"); Assert.AreEqual(1000, tb.rows()); Assert.AreEqual(1, tb.columns()); Assert.AreEqual(tmp + 8.ToString(), ((BasicTable)st).getColumn(0).get(10).getString()); }
private BasicString(BasicString.__Internal native, bool skipVTables = false) : this(__CopyValue(native), skipVTables) { __ownsNativeInstance = true; NativeToManagedMap[__Instance] = this; }
private static void* __CopyValue(BasicString.__Internal native) { var ret = Marshal.AllocHGlobal(32); *(BasicString.__Internal*) ret = native; return ret.ToPointer(); }
public static BasicString __CreateInstance(BasicString.__Internal native, bool skipVTables = false) { return new BasicString(native, skipVTables); }
private void initialize(AbstractVector values, BasicAnyVector locations) { if (values.DataType != Entity_DATA_TYPE.DT_ANY || values.DataForm != Entity_DATA_FORM.DF_VECTOR) { throw new Exception("expect a vector of partitioning lists"); } if (values.rows() <= 0) { throw new Exception("requires at least one partitioning list"); } if (locations.rows() <= 0) { throw new Exception("requires at least one location"); } if (locations.getEntity(0).DataType != Entity_DATA_TYPE.DT_STRING) { throw new Exception("location must be a string"); } if (values.rows() != locations.rows()) { throw new Exception("expect # locations == # partitioning lists"); } this.locationMap = new Dictionary <>(); IList <string>[] locationListArray = new IList[locations.rows()]; bool isScalar = locations.getEntity(0).DataForm == Entity_DATA_FORM.DF_SCALAR; if (isScalar) { for (int i = 0; i < locations.rows(); ++i) { BasicString location = (BasicString)locations.get(i); locationListArray[i] = location.String; } } else { for (int i = 0; i < locations.rows(); ++i) { BasicStringVector locationVector = (BasicStringVector)locations.getEntity(i); locationListArray[i] = new List <>(); for (int j = 0; j < locationVector.rows(); ++j) { BasicString location = (BasicString)locationVector.get(j); locationListArray[i].Add(location.String); } } } for (int i = 0; i < values.rows(); ++i) { AbstractVector partitioningList = (AbstractVector)((BasicAnyVector)values).getEntity(i); if (partitioningList.rows() <= 0) { throw new Exception("expect partitioning list to be nonempty"); } if (partitioningList.DataCategory != Entity_DATA_CATEGORY.INTEGRAL) { throw new Exception("expect partitioning column values to be integral-typed."); } for (int j = 0; j < partitioningList.rows(); ++j) { try { long val = partitioningList.get(j).Number.longValue(); locationMap[val] = locationListArray[i]; } catch (Exception e) { throw new Exception(e); } } } }
public static void LoadBank(string path, bool value) { var basicStr = BasicString.Create(path); LoadBankFunc(AudioManagerPtr, value, ref basicStr, ref AudioManagerPtr->mGlobalBanks, false); }