Пример #1
0
static void load_data_record(Istream& fin, const gcstring& table, int tran, int n)
	{
	try
		{
		if (n > loadbuf_size)
			{
			loadbuf_size = max(n, 2 * loadbuf_size);
			mem_release(loadbuf);
			loadbuf = (char*) mem_committed(loadbuf_size);
			verify(loadbuf);
			}
		fin.read(loadbuf, n);
		Record rec(loadbuf);
		if (rec.cursize() != n)
			except_err(table << ": rec size " << rec.cursize() << " not what was read " << n);
		if (table == "views")
			theDB()->add_any_record(tran, table, rec);
		else
			theDB()->add_record(tran, table, rec);
		}
	catch (const Except& e)
		{
		errlog("load: skipping corrupted record in: ", table.str(), e.str());
		alert("skipping corrupted record in: " << table << ": " << e);
		alerts = true;
		}
	}
Пример #2
0
static int load1(Istream& fin, gcstring tblspec)
	{
	int n = tblspec.find(' ', 7);
	gcstring table = tblspec.substr(7, n - 7);

	if (table != "views")
		{
		if (theDB()->istable(table))
			theDB()->remove_table(table);
		database_admin(tblspec.str());
		}
	return load_data(fin, table);
	}
Пример #3
0
Value symbol(const gcstring& s)
	{
	return symbol(s.str());
	}