#1

Hi guys totally noob on ORM systems and i have no clue how to make data retrieving from old table, before retrieving old table i create new one and from old i want to get data and put into new one so any ideas? Thanks.
Reply
#2

UP>>>
Reply
#3

First, read carefully ORM tutorial.

Now, for the workflow:
1. Create key, and select data from first table
2. Run threaded query creating new table
3. In callback create key for new table
4. Copy contents from first array into second array
5. Use orm_save on new table
Reply
#4

Код:
stock LoadServersConfig()
{
    new Year, Month, Day, date[20], date1[20], Hour, Minute, Second;
	getdate(Year, Month, Day);
	gettime(Hour, Minute, Second);
	format(date, sizeof(date), "%d-%02d-%02d",Year,Month,Day);
	format(date1, sizeof(date), "%d:%d:%d",Hour,Minute,Second);
	strins(server[ond], date, 0);
	strins(server[ont], date1, 0);
	server[ORMID] = orm_create("server", dbhandle);
	orm_addvar_int(server[ORMID], server[session], "session");
	orm_addvar_string(server[ORMID], server[ond], 50, "OnD");
	orm_addvar_string(server[ORMID], server[ont], 50, "OnT");
	orm_addvar_int(server[ORMID], server[ownedb], "ownedb");
	orm_addvar_int(server[ORMID], server[maxown], "Cars");
	orm_setkey(server[ORMID], "session");
	
	orm_select(server[ORMID], "LoadID", "i", server[session]-1);
	//orm_insert(server[ORMID], "LoadID", "", "");
}

forward LoadID(i);
public LoadID(i)
{
	orm_addvar_int(server[ORMID], server[ownedb], "ownedb"); // i thinking here to retrieve old data info from old table which session is lover by -1
	orm_addvar_int(server[ORMID], server[maxown], "Cars");
	orm_insert(server[ORMID], "LoadServersOldInfo", "");
	return 1;
}

forward LoadServersOldInfo();
public LoadServersOldInfo()
{
	orm_update(server[ORMID]);
    return 1;
}
So where is problem session retrieves but ownedb and maxown wont.
Reply
#5

Код:
stock LoadServersConfig()
{
    new Year, Month, Day, date[20], date1[20], Hour, Minute, Second;
	getdate(Year, Month, Day);
	gettime(Hour, Minute, Second);
	format(date, sizeof(date), "%d-%02d-%02d",Year,Month,Day);
	format(date1, sizeof(date), "%d:%d:%d",Hour,Minute,Second);
	strins(server[ond], date, 0);
	strins(server[ont], date1, 0);
	server[ORMID] = orm_create("server", dbhandle);
	orm_addvar_int(server[ORMID], server[session], "session");
	orm_addvar_string(server[ORMID], server[ond], 50, "OnD");
	orm_addvar_string(server[ORMID], server[ont], 50, "OnT");
	orm_addvar_int(server[ORMID], server[ownedb], "ownedb");
	orm_addvar_int(server[ORMID], server[maxown], "Cars");
	orm_setkey(server[ORMID], "session");
	
	orm_select(server[ORMID], "LoadID", "i", server[session]-1);
	//orm_insert(server[ORMID], "LoadID", "", "");
}

forward LoadID(i);
public LoadID(i)
{
	orm_addvar_int(server[ORMID], server[ownedb], "ownedb"); // i thinking here to retrieve old data info from old table which session is lover by -1
	orm_addvar_int(server[ORMID], server[maxown], "Cars");
	orm_insert(server[ORMID], "LoadServersOldInfo", "");
	return 1;
}

forward LoadServersOldInfo();
public LoadServersOldInfo()
{
       //also i here put printf with maxown and prints me 0 but in old table is 9
	orm_update(server[ORMID]);
    return 1;
}
So where is problem session retrieves but ownedb and maxown wont. Sorry for Double post mouse stuck on it
Reply
#6

up...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)