in

Mysql code Generation X SQLSERVER

Last post 03-23-2008 11:41 AM by bob.diego1. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-08-2008 11:55 AM

    Mysql code Generation X SQLSERVER

    hi...

    i'm trying mysql with subsonic and the generated code betwen mysql an SQLserver are diffents...

    for example:

    1 people has many cars

    and

    1 car has one people 

    -- on SQlServer:

     Car.People(objetct People)

     --on mySql

     Car.IdPeople(int)

     its right? 

    on mysql i havent suport to relationships?

    it´s just whith id's?

    thanks..... 

     

     

  • 03-09-2008 12:42 PM In reply to

    Re: Mysql code Generation X SQLSERVER

    Yup if there is no FK (relationships) to the other table then SubSonic doesn't know that it is a reference to a different table.

    But you should also have Car.IdPeople on the SqlServer one.

    If I am I because I am I, and You are You because You are You, then I am I, and you are you. But If I am I because You are You, and You are You because I am I, then I am not I and You are not You. -Rabbi of Kotzk
  • 03-09-2008 1:49 PM In reply to

    Re: Mysql code Generation X SQLSERVER

    ok, thanks for the answer....

     

    but i did a FK see that other example:

     

    DROP TABLE IF EXISTS `vendas`.`produto`;
    CREATE TABLE  `vendas`.`produto` (
      `idProduto` int(10) unsigned NOT NULL auto_increment,
      `idFornecedor` int(10) unsigned NOT NULL,
      `descricao` varchar(45) NOT NULL,
      `idPreco` int(10) unsigned NOT NULL,
      `quantidade` int(10) unsigned NOT NULL,
      PRIMARY KEY  (`idProduto`),
      KEY `FK_Produto_Fornecedor` (`idFornecedor`),
      CONSTRAINT `FK_Produto_Fornecedor` FOREIGN KEY (`idFornecedor`) REFERENCES `fornecedor` (`idFornecedor`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

     

    AND

     

     

    DROP TABLE IF EXISTS `vendas`.`fornecedor`;
    CREATE TABLE  `vendas`.`fornecedor` (
      `idFornecedor` int(10) unsigned NOT NULL auto_increment,
      `nomeFantasia` varchar(45) NOT NULL,
      `razaoSocial` varchar(45) NOT NULL,
      `CNPJ` varchar(15) NOT NULL,
      `endereco` varchar(45) NOT NULL,
      `bairro` varchar(45) NOT NULL,
      `estado` varchar(2) NOT NULL,
      `telefone1` varchar(10) default NULL,
      `telefone2` varchar(10) default NULL,
      `celular` varchar(10) default NULL,
      `email` varchar(30) default NULL,
      `cep` varchar(15) NOT NULL,
      `fax` varchar(10) default NULL,
      PRIMARY KEY  (`idFornecedor`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

     

     whats wrong?

    thanks!!!!!!! 

  • 03-16-2008 11:08 AM In reply to

    Re: Mysql code Generation X SQLSERVER

     hi , what version of MYSQL and Mysql.Data

    are working with subsonic....

    i coud not solve my problem....

    thanks 

  • 03-16-2008 12:00 PM In reply to

    Re: Mysql code Generation X SQLSERVER

    Answer

    i found the error

    MYSQL Subsonic  Provider only supports MYISAN table, this dont supports Relationships.

    so, i will never have

    Person.Car 

    but just

    Person.IdCar 

     

    bye 

  • 03-22-2008 5:28 PM In reply to

    Re: Mysql code Generation X SQLSERVER

    are you using the MySqlInnoDBDataProvider provider

  • 03-23-2008 11:41 AM In reply to

    Re: Mysql code Generation X SQLSERVER

     oh, thanks....

    i changed to MySqlInnoDBDataProvider

    but it doesnt works

    my mysql is 5.1.11 and subsonic is 2.0.3

    this is the mysql rigth version ?

    I did the relationships.....

    thanks....!!!!!!!!!!!!!!!!!!! 

     

     

    se my web config:

     

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <configSections>
        <section name="SubSonicService"
               type="SubSonic.SubSonicSection, SubSonic"
               />
      </configSections>

      <connectionStrings>
        <add name="MySql" connectionString="Server=localhost;Database=vendas;Uid=root;Pwd=mysql;"
          providerName="MySql.Data.MySqlClient" />
        </connectionStrings>

      <!-- 3 - Point SubSonic at the appropriate data source(s) -->
      <SubSonicService defaultProvider="MySql">
        <providers>
          <clear/>
          <add name="MySql"
        type="SubSonic.MySqlInnoDBDataProvider, SubSonic"
        connectionStringName="MySql"
        generatedNamespace="Diego"/>
          <!--MySqlDataProvider-->

        </providers>

      </SubSonicService>

    </configuration>

     

    some tables in my database:

     

    DROP TABLE IF EXISTS `vendas`.`produto`;
    CREATE TABLE  `vendas`.`produto` (
      `idProduto` int(10) unsigned NOT NULL auto_increment,
      `idFornecedor` int(10) unsigned NOT NULL,
      `descricao` varchar(45) NOT NULL,
      `quantidade` int(10) unsigned NOT NULL,
      `idTipoProduto` int(10) unsigned NOT NULL,
      `preco` decimal(10,0) NOT NULL,
      PRIMARY KEY  (`idProduto`),
      KEY `FK_Produto_Fornecedor` (`idFornecedor`),
      KEY `FK_Produto_Tipo_Produto` (`idTipoProduto`),
      CONSTRAINT `FK_Produto_Fornecedor` FOREIGN KEY (`idFornecedor`) REFERENCES `fornecedor` (`idFornecedor`),
      CONSTRAINT `FK_Produto_Tipo_Produto` FOREIGN KEY (`idTipoProduto`) REFERENCES `tipoproduto` (`idTipoProduto`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

     

    DROP TABLE IF EXISTS `vendas`.`fornecedor`;
    CREATE TABLE  `vendas`.`fornecedor` (
      `idFornecedor` int(10) unsigned NOT NULL auto_increment,
      `nomeFantasia` varchar(45) NOT NULL,
      `razaoSocial` varchar(45) NOT NULL,
      `CNPJ` varchar(15) NOT NULL,
      `endereco` varchar(45) NOT NULL,
      `bairro` varchar(45) NOT NULL,
      `estado` varchar(2) NOT NULL,
      `telefone1` varchar(10) default NULL,
      `telefone2` varchar(10) default NULL,
      `celular` varchar(10) default NULL,
      `email` varchar(30) default NULL,
      `cep` varchar(15) NOT NULL,
      `fax` varchar(10) default NULL,
      `pessoa` int(10) unsigned NOT NULL,
      PRIMARY KEY  (`idFornecedor`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

     

    DROP TABLE IF EXISTS `vendas`.`tipoproduto`;
    CREATE TABLE  `vendas`.`tipoproduto` (
      `idTipoProduto` int(10) unsigned NOT NULL auto_increment,
      `descricao` varchar(45) NOT NULL,
      PRIMARY KEY  USING BTREE (`idTipoProduto`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

     

     thanks

     

     

     

Page 1 of 1 (7 items)