Advertisement:

Author Topic: Package Server DB  (Read 3779 times)

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,157
  • Gender: Male
Package Server DB
« on: March 26, 2008, 06:44:22 PM »
I am not familiar with the 2.0 database as of yet. I need to know what needs to be changed in the queries that remove and add a package server to the database from 1.1 to 2.0 Beta 3.
Here are the codes from 1.1:
Code: [Select]
   // Delete our package server if there is one.
   $request = db_query("
       DELETE FROM {$db_prefix}package_servers WHERE name = 'Gamerz Garage'", __FILE__, __LINE__);
     
   // Install our package server.
   $request = db_query("
      INSERT INTO {$db_prefix}package_servers (name,url)VALUES('Gamerz Garage','http://www.gamerzgarage.com/mods')", __FILE__, __LINE__);

Thanks,
brianjw

Offline karlbenson

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,629
  • Gender: Male
    • Criminal Brief UK
Re: Package Server DB
« Reply #1 on: March 26, 2008, 07:25:03 PM »
Presuming you need to use 2.0 db functions see

Mod Authors: SMF 2.0 Database Functions

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,157
  • Gender: Male
Re: Package Server DB
« Reply #2 on: March 26, 2008, 09:58:01 PM »
Ok, well I can get some of it done. But I am just not very good with databases. Can someone help me finish this code?
Code: [Select]
   // Install our package server.
   $smcFunc['db_insert']('insert','
      '{db_prefix}package_servers',
     

Offline H

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,662
  • Gender: Male
Re: Package Server DB
« Reply #3 on: April 03, 2008, 04:25:53 PM »
Hi Brianjw,

Did you manage to do this?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,157
  • Gender: Male
Re: Package Server DB
« Reply #4 on: April 03, 2008, 04:43:40 PM »
No, i am not good with db's... :(

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 30,371
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: Package Server DB
« Reply #5 on: April 10, 2008, 01:34:16 PM »
Are you trying to remove the entry from the package database?
Or are you attempting to do something else?
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:
GitHub

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,157
  • Gender: Male
Re: Package Server DB
« Reply #6 on: April 10, 2008, 02:20:18 PM »
I want to put this db query in the add_settings.php file to remove the package server named ___ if there is one and then to add a package server named ___. This way it will make it so there aren't duplicate servers. I am horrible with dbs.

Offline SleePy

  • Site Team Lead
  • SMF Master
  • *
  • Posts: 30,371
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: Package Server DB
« Reply #7 on: April 19, 2008, 10:22:38 PM »
Code: [Select]
$request = $smcFunc['db_insert']('replace',
    '{db_prefix}package_servers',
    array(
        'name' => 'string',
        'url' => 'string',
    ),
    array(
        'Gamerz Garage', 'http://www.gamerzgarage.com/mods',
    ),
    array( 'id_server')
);

That should do it.
It will replace the entry if it exists otherwise it will insert it.
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:
GitHub

Offline brianjw

  • SMF Hero
  • ******
  • Posts: 2,157
  • Gender: Male
Re: Package Server DB
« Reply #8 on: April 19, 2008, 11:02:46 PM »
Thanks. I will try it out later. :)