Jump to:

23370 Posts in 18160 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » [Solved] Uploading (dumping fields) to database

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 232 Views
  • PhiloPachem
    Avatar
    Community Member
    4 Posts

    [Solved] Uploading (dumping fields) to database Link to this post

    Hi i have created a page like this:

    Problema.php
    <?php
    class Problema extends DataObject {
    static $db = array(
    'Desc' => 'Varchar',
    'FEN' => 'Varchar(90)',
    'Lances' => 'Varchar(200)',
    );
    static $has_one = array(
    'TipoProblema' => 'TipoProblema'
    );
    }

    TipoProblema.php (my holder)

    <?php
    class TipoProblema extends Page {

    static $has_many = array(
    'Problemas' => 'Problema'
    );

    ....

       public function MostraProblema() {      
          $problemas = new PaginatedList(Problema::get($callerClass = "Problema",$filter = "`TipoProblemaID` = '".$this->ID."'"), $this->request);
          
          $problemas->setPageLength(1);
          return $problemas;
       }

    i then insert into with mysql console

    INSERT INTO `Problema` (`ID`, `ClassName`, `Created`, `LastEdited`, `Desc`, `FEN`, `Lances`, `TipoProblemaID`) VALUES
    (88, 'Problema', '2013-05-14 15:05:23', '2013-05-16 02:24:07', 'Šachmaty #1' , 'bb1Q4/5KpB/8/4p1Rr/1N3kpB/1r6/3P1p1P/3nNR2 w - - 0 1', '1. Qd5 Ne3 (1... Bd6 2. Ng2#) (1... Bc7 2. Ng2#) (1... Ba7 2. Ng2# (2. Qxe5#)) (1... Bxd5+ 2. Nxd5#) (1... Bc6 2. Ng2#) (1... Bb7 2. Ng2#) (1... g6 2. Ng2#) (1... Rxh4 2. Rf5#) (1... Rxg5 2. Ng2#) (1... Rxh7 2. Ng2#) (1... Rh6 2. Ng2# (2. Rf5#)) (1... e4 2. Qf5#) (1... g3 2. Ng2#) (1... Rb1 2. Ned3# (2. Nbd3#) (2. Ng2#)) (1... Rb2 2. Ned3# (2. Nbd3#) (2. Ng2#)) (1... Ra3 2. Ng2#) (1... Rh32. Ng2#) (1... Rg3 2. hxg3#) (1... Rf3 2. Ng2#) (1... Re3 2. Ng2#) (1... Rd32. Nexd3# (2. Nbxd3#) (2. Ng2#)) (1... Rc3 2. Ng2#) (1... Rxb4 2. Nd3# (2. Ng2#)) (1... Nb2 2. Ng2#) (1... Nc3 2. Ned3# (2. Ng2#)) 2. Rxf2# 1-0', 22),
    (89, 'Problema', '2013-05-14 15:05:23', '2013-05-16 02:24:07', 'Magyar Sakkelet #2' , '1K2BN2/8/b2pR3/1p1kBpPQ/1Pp5/2n3N1/5pP1/8 w - - 0 1', '1. Ne2 (1. Bc6+ Kxc6 2. Rxd6#) 1... f1=Q (1... dxe5 2. Bc6#) (1... Bc8 2. Nxc3#) (1... Bb7 2. Nxc3#) (1... f4 2. Nxc3#) (1... Ke4 2. Qf3#) (1... Nb1 2. Qf3#) (1... Nd1 2. Qf3#) (1... Na2 2. Qf3#) (1... Nxe2 2. Qf3#) (1... Na4 2. Qf3#) (1... Ne4 2. Nf4#) (1... f1=N 2. Nxc3#) (1... f1=B 2. Nxc3#) (1... f1=R 2. Nxc3#)2. Nxc3# 1-0', 22),
    (810, 'Problema', '2013-05-14 15:05:23', '2013-05-16 02:24:07', 'Magyar Sakkelet #3' , '3KBN2/8/b2pR3/1p1kBpPQ/1Pp5/2n3N1/6P1/8 w - - 0 1', '1. Ne2 (1. Bxc3 f4 (1... Bc8 2. Qf3# (2. Qd1#)) (1... Bb7 2. Qf3# (2. Qd1#))2. g6# (2. Qd1#) (2. Qf3#)) 1... Ne4 (1... dxe5 2. Bc6#) (1... Bc8 2. Nxc3#) (1... Bb7 2. Nxc3#) (1... f4 2. Nxc3#) (1... Ke4 2. Qf3#) (1... Nb1 2. Qf3#) (1... Nd1 2. Qf3#) (1... Na2 2. Qf3#) (1... Nxe2 2. Qf3#) (1... Na4 2. Qf3#)2. Nf4# 1-0', 22),
    (811, 'Problema', '2013-05-14 15:05:23', '2013-05-16 02:24:07', '? #4' , 'K2Q4/5p2/N1pp1rn1/p2kBP1N/2r1R1pq/bP6/b1P5/7B w - - 0 1', '1. Qb6 Bxb3 2. Nc7# 1-0', 22),
    (812, 'Problema', '2013-05-14 15:05:23', '2013-05-16 02:24:07', 'Hlas l´udu #5' , 'b2R1Q1B/r6B/4p1P1/p3N1p1/2P1kbP1/K1P1N3/2PPn1Pn/8 w - - 0 1', '1. Nf7 Nd4 (1... Bd5 2. g7#) (1... Bc6 2. g7#) (1... Bb7 2. g7#) (1... Ra62. g7#) (1... Rxf7 2. gxf7#) (1... Re7 2. g7#) (1... Rd7 2. g7#) (1... Rc72. g7#) (1... Rb7 2. g7#) (1... e5 2. Nd6# (2. g7#)) (1... a4 2. g7#) (1... Bg32. Nxg5#) (1... Bxe3 2. Nd6#) (1... Bb8 2. Nxg5#) (1... Bc7 2. Nxg5#) (1... Bd6+2. Nxd6#) (1... Be5 2. Nxg5#) (1... Nf1 2. g7#) (1... Nf3 2. g7#) (1... Nxg42. g7#) (1... Nc1 2. g7# (2. Rd4#)) (1... Ng1 2. g7# (2. Rd4#)) (1... Nxc32. g7# (2. Rd4#)) (1... Ng3 2. Rd4#) 2. Rxd4# 1-0', 22);

    With this few number of records everything works fine...
    now i tried to upload 17000 records.
    for them to apear i need to go to CMS and save one by one!!!
    anyone can help, i can not open and save the 17000 records to this to work!
    If i go to CMS and save the record it will apear correctly on frontend!
    the .sql file is created by a script pherhaps is a char that is troubling!!
    anyone?! regards

  • PhiloPachem
    Avatar
    Community Member
    4 Posts

    Re: [Solved] Uploading (dumping fields) to database Link to this post

    Solved it was a \r on the Lances field, i changed Lances to Text but the \r was there and making me nut
    i replaced them on my .sql file and dumped again, and now is working fine.

    when i upload site to production i will put it in showcase

    regards

    232 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.