/// <summary> Execute a select at the TCL and return the active list. /// </summary> /// <param name="sentence">The AQL command to select key from file /// /// </param> public virtual D3SelectList select(System.String sentence) { D3Item list; System.String[] result; D3Buffer buf = this.myconnection.doit(D3Constants._D3_SELECT_TCL + "\x0001" + sentence + "\x0001"); if (buf.Status != D3Constants.D3_OK) { throw new D3Exception("Erreur d' excution de " + sentence); } // first data is number of key selected int nbelement = System.Int32.Parse((System.String)buf.Data[0]); result = new System.String[nbelement]; if (nbelement > 0) { // second data is list of key separated by @AM // We use D3Item, which is more easy to use ;) list = new D3Item((System.String)buf.Data[1]); for (int i = 0; i <= (nbelement - 1); i++) { result[i] = list.extract(i + 1); } } return(new D3SelectListTcl(result)); }
/// <summary> Identify the user in the server /// </summary> /// <param name="user">The user name /// </param> /// <param name="password">The password of the user /// /// </param> public virtual int login(System.String user, System.String password) { D3Buffer buf = doit(D3Constants._D3_LOGON + "\x0001" + user + "\x0001" + password + "\x0001"); this.username = user; return(buf.Status); }
/// <summary> Relacher un verrou /// </summary> /// <param name="key">la cl du verrou lacher /// </param> /// <returns>int rsultat de la commande /// /// </returns> //UPGRADE_NOTE: Synchronized keyword was removed from method 'release'. Lock expression was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1027"' public virtual int release(System.String key) { lock (this) { D3Buffer buf = this.con.doit(D3Constants._D3_RELEASE + "\x0001" + fd + "\x0001" + key + "\x0001"); return(buf.Status); } }
/// <summary> Ecrire un record /// </summary> /// <param name="key">la cl /// </param> /// <param name="PItem">le record /// </param> /// <returns>int rsultat de l'criture /// /// </returns> //UPGRADE_NOTE: Synchronized keyword was removed from method 'write'. Lock expression was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1027"' public virtual int write(System.String key, D3Item PItem) { lock (this) { //UPGRADE_TODO: The equivalent in .NET for method 'java.Object.toString' may return a different value. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1043"' D3Buffer buf = this.con.doit(D3Constants._D3_WRITE + "\x0001" + fd + "\x0001" + key + "\x0001" + PItem.ToString() + "\x0001"); return(buf.Status); } }
/// <summary> Get the name of the file /// </summary> /// <returns>The name of the file /// /// </returns> /// <summary> Get the name of the accoutn where is the file /// </summary> /// <returns>The name of the account where is the file /// /// </returns> /// <summary> Lecture d'un record /// </summary> /// <param name="key">la cl /// </param> /// <param name="PItem">le record mettre jour, doit tre cr avant l'appel (ventuellement vide) /// </param> /// <returns>rsultat de la lecture /// READ_FILENOTOPEN Le fichier n'est pas ouvert, le record est mis vide /// READ_RECORDEMPTY le record n'existe pas pour la cl demande, il est mis vide /// READ_RECORDLOCKED le record est dj lock, dans ce cas le record contient /// en <1> : le numro de port qui lock /// en <2> : le code user qui lock (si il est connu) /// D3_OK si tout va bien, le record est mis jour avec les infos /// /// </returns> //UPGRADE_NOTE: Synchronized keyword was removed from method 'read'. Lock expression was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1027"' public virtual int read(System.String key, D3Item PItem) { lock (this) { D3Buffer buf = this.con.doit(D3Constants._D3_READ + "\x0001" + fd + "\x0001" + key + "\x0001"); PItem.Record = (System.String)buf.Data[0]; return(buf.Status); } }
/// <summary> Execute a TCL command /// </summary> /// <param name="sentence">The TCL command to execute /// /// </param> public virtual System.String execute(System.String sentence) { D3Buffer buf = this.myconnection.doit(D3Constants._D3_EXECUTE + "\x0001" + sentence + "\x0001"); if (buf.Status != D3Constants.D3_OK) { throw new D3Exception("Erreur d' excution de " + sentence); } return((System.String)buf.Data[0]); }
/// <summary> Effectue un select sur un fichier /// </summary> /// <returns>int rsultat de la commande /// /// </returns> //UPGRADE_NOTE: Synchronized keyword was removed from method 'select'. Lock expression was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1027"' public virtual D3SelectList select() { lock (this) { int nb = 0; D3Buffer buf = this.con.doit(D3Constants._D3_SELECT + "\x0001" + fd + "\x0001"); nb = System.Int32.Parse((System.String)buf.Data[1]); return(new D3SelectListFile(this.con, (System.String)buf.Data[0], nb)); } }
/// <summary> Tester l'existance d'un record dans le fichier /// </summary> /// <param name="key">la cl /// </param> /// <returns>boolean false si le record n'existe pas ou s'il y a eu un problme /// true si le record existe /// /// </returns> //UPGRADE_NOTE: Synchronized keyword was removed from method 'testExist'. Lock expression was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1027"' public virtual bool testExist(System.String key) { lock (this) { D3Buffer buf = this.con.doit(D3Constants._D3_TEST_EXIST + "\x0001" + fd + "\x0001" + key + "\x0001"); if (buf.Status == D3Constants.D3_OK) { return(((System.String)buf.Data[0]).Equals("0")); } else { return(false); } } }
/// <summary> Lecture d'un attribut d'un record /// </summary> /// <param name="key"> la cl du record lire /// </param> /// <param name="am"> la position de l'attribut lire /// </param> /// <returns> String la valeur de l'attribut lu, vide s'il y a eu un problme ou s'il est vide /// /// </returns> //UPGRADE_NOTE: Synchronized keyword was removed from method 'readv'. Lock expression was added. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1027"' public virtual System.String readv(System.String key, int am) { lock (this) { D3Buffer buf = this.con.doit(D3Constants._D3_READV + "\x0001" + fd + "\x0001" + key + "\x0001" + System.Convert.ToString(am) + "\x0001"); if (buf.Status == D3Constants.D3_OK) { return((System.String)buf.Data[0]); } else { return(""); } } }
/// <summary> Get the next key in the select list /// </summary> /// <returns>The next key in the select list, null if there is no more key /// /// </returns> /// <summary> Read the next key from the select list on the server /// </summary> /// <returns>True if we succeed in reading next key /// /// </returns> private bool readNext() { // If we have already a key in the buffer if (curkey != null) { return(true); } // If we have already finished the select list if (finished) { return(false); } try { D3Buffer buf = this.con.doit(D3Constants._D3_READNEXT + "\x0001" + select + "\x0001"); // If it is the end of the list if (buf.Status == D3Constants.READNEXT_EOF) { finished = true; return(false); } else { // If there was another error if (buf.Status != D3Constants.D3_OK) { return(false); } } curkey = (System.String)buf.Data[0]; return(true); } catch { return(false); } }
/// <summary> this function do nothing, just send instruction and receive a response. /// Use it to know the communication is OK /// * /// </summary> /// <returns>the status of command. <li> D3_OK if the communication is OK <li> D3_ERR if not /// /// </returns> public virtual int noop() { D3Buffer buf = this.myconnection.doit(D3Constants._D3_NOOP + "\x0001"); return(buf.Status); }