1 edb Jul 22, 2007 09:33
3 edb Jul 22, 2007 11:13
Yes and no.
function GetDbLayout() {
return array(
"CREATE TABLE IF NOT EXISTS ".$this->get_sql_table('Sites')." (
name varchar(50) NOT NULL default '',
latitude varchar(12) NOT NULL default '',
longitude varchar(12) NOT NULL default '',
PRIMARY KEY (name)
)",
);
}
That's a snip that basically shows where I'm at. So how do I tell it what Site #1 is upon installation?
4 balupton Jul 22, 2007 13:58
Honestly, I have no fricking clue. I find b2evo's db interface extremely confusing. And the only plugin i've made that actually uses the db is the gallery plugin, and in that I tried to stay away from b2evo as much as possible. And in non b2evo projects, I have written my own OO db interface (about 5 months straight of dev) which I use in all my commercial projects. So I hardly touch SQL.
5 yabba Jul 22, 2007 17:07
You want to look into [url=http://doc.b2evolution.net/v-1-10/plugins/Plugin.html#methodAfterInstall]AfterInstall()[/url] ;)
¥
6 afwas Jul 22, 2007 17:27
¥åßßå wrote:
You want to look into AfterInstall() Wink
¥
No, there is a reference to DB install in [url=http://doc.b2evolution.net/v-1-10/plugins/Plugin.html#methodBeforeInstall]BeforeInstall()[/url].
I ran through the code of the Democracy Plugin. It found the function as cited by EdB, but I can't figure out when it is called.
7 edb Jul 22, 2007 22:40
I'll look at both those hooks and see if I can make sense of it. Thanks!
8 yabba Jul 23, 2007 00:42
Afwas wrote:
No, there is a reference to DB install in [url=http://doc.b2evolution.net/v-1-10/plugins/Plugin.html#methodBeforeInstall]BeforeInstall()[/url].
Yeah, but that wasn't the question ;)
¥
9 personman Jul 23, 2007 14:50
EdB, did you ever get this sorted. I usually just do something like this:
function whateverHookYoureUsing()
{
global $DB;
$sql = "INSERT INTO " . $this->get_sql_table('Sites') . " (name, lattitude, longitude) VALUES ('$name', '$lattitude', '$longitude')"
$DB->query( $sql );
}
Daniel's dnsbl plugin is a good example of the things you can do with $DB.
10 edb Jul 23, 2007 15:42
been doing the work thing again so I haven't had the chance to play, but I also thought why not just do a dbinsert after I make the database? Either way, it shouldn't be a big problem to get some content in the database upon creation.
Thanks!
11 edb Jul 29, 2007 00:24
Hooray for AfterInstall()!
Are you talking about a db table, and settings?