Exemplo n.º 1
0
        /// <summary>
        /// Enum tables in the database
        /// </summary>
        /// <param name="list">Table names list</param>
        public void EnumTables(ref string[] list)
        {
            uint          i;
            string        sTableName;
            StringBuilder buf;

            string[] listTemp;

            if (databaseId <= 0)
            {
                return;
            }

            list = null;

            lock (SyncRoot)
            {
                VistaDBAPI.ivdb_SelectDb(databaseId);

                buf = new StringBuilder(64);

                i = 0;

                do
                {
                    i++;

                    i = VistaDBAPI.ivdb_EnumTables(i, buf, 63);

                    if (i != 0)
                    {
                        sTableName = VistaDBAPI.CutString(buf);

                        if (list == null)
                        {
                            list = new string[1];
                        }
                        else
                        {
                            listTemp = new string[list.Length + 1];
                            list.CopyTo(listTemp, 0);
                            list = listTemp;
                        }

                        list[list.GetUpperBound(0)] = sTableName;
                    }
                }while(i != 0);
            }
        }