Giter Site home page Giter Site logo

dm-mysql-adapter's People

Contributors

bernerdschaefer avatar dbussink avatar dkubb avatar namelessjon avatar paul avatar sam avatar snusnu avatar solnic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dm-mysql-adapter's Issues

auto_migrate! with belongs_to with a composite key works in one case but not the other

I'm filing this here because I'm assuming that it's a bug with the adapter, but I'm not entirely sure. It works with sqlite3, but that may just be a coincidence.

Anyhow, I made a repo, https://github.com/jdodds/datamapper-bug , that demonstrates the behavior. I have a model with a composite primary key, and two models that refer to it with belongs_to ..., :key => true, while it has the corresponding has n declarations. Looking at the logs, it creates the first model's table correctly, but either fails to detect or ignores the composite key when creating the second model's table.

If you need any more info, let me know.

lazy loaded porperties cause .save failure even if you don't touch that property.

sample code derived from http://datamapper.org/docs/create_and_destroy.html,
When you run it the second time you'll get the error:

/pr/tasks/ruby/datamapper/dm/dm-core/lib/dm-core/property.rb:712:in `assert_valid_value': Invalid value nil for property :body (DataMapper::Property::Text) on model Post (DataMapper::Property::InvalidValueError)

CODE:

# encoding: UTF-8
require 'dm-core'

$DATA_MAPPER_MYSQL_CONNECTION = 'mysql://root:mysqlpage@localhost/datamapper'

# If you want the logs displayed you have to do this before the call to setup
DataMapper::Logger.new($stdout, :debug)

DataMapper.setup(:default, $DATA_MAPPER_MYSQL_CONNECTION )

# by default all fields are required
DataMapper::Property.required(true)
DataMapper::Property::String.length(120)
DataMapper::Property::Boolean.allow_nil(false)
DataMapper::Model.raise_on_save_failure = true

class Post
  include DataMapper::Resource

  property :id, Serial
  property :title, String
  property :body, Text

end

DataMapper.finalize

require  'dm-migrations'
DataMapper.auto_upgrade!

if Post.first
  puts "phase2 editing post"
  post = Post.first
  post.title = "dummy"
  # this causes an exception because body porperty is nil because its loaded lazily !?
  post.save
else
  puts "creating post, rerun script!"
  post = Post.create({
    :title =>  "My first DataMapper post",
    :body => "A lot of text ...",
  })
end

# repository(:default).adapter.execute('COMMIT')

This causes the feeling that the mysql backend (and maybe all?) are still kind of unstable.

Tell me if I should file this bug against a different github repo.. maybe its not related to mysql at all.

dm-mysql-adapter is not getting installed in Windows

gem install dm-mysql-adapter
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing dm-mysql-adapter:
ERROR: Failed to build gem native extension.

current directory: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/do_mysql-0.10.17/ext/do_mysql

C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20161223-7120-yyjae.rb extconf.rb
checking for my_global.h... no
checking for mysql.h... no
checking for main() in -llibmysql... no
checking for mysql_query() in mysql.h... no
checking for mysql_ssl_set() in mysql.h... no
checking for localtime_r()... yes
checking for gmtime_r()... yes
checking for mysql.h... no
checking for MYSQL_TYPE_STRING in mysql.h... no
checking for MYSQL_TYPE_BIT in mysql.h... no
checking for MYSQL_TYPE_NEWDECIMAL in mysql.h... no
checking for mysql_query() in mysql.h... no
checking for mysql_ssl_set() in mysql.h... no
checking for mysql_sqlstate() in mysql.h... no
checking for mysql_get_ssl_cipher() in mysql.h... no
checking for mysql_set_character_set() in mysql.h... no
checking for mysql_get_server_version() in mysql.h... no
checking for mysql_real_escape_string_quote() in mysql.h... no
checking for MYSQL_FIELD.charsetnr in mysql.h... no
checking for rb_thread_fd_select()... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/do_mysql-0.10.17/mkmf.log

current directory: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/do_mysql-0.10.17/ext/do_mysql
make "DESTDIR=" clean

current directory: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/do_mysql-0.10.17/ext/do_mysql
make "DESTDIR="
generating do_mysql-x64-mingw32.def
compiling do_common.c
compiling do_mysql.c
do_mysql.c:8:19: fatal error: mysql.h: No such file or directory
compilation terminated.
make: *** [do_mysql.o] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/do_mysql-0.10.17 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/do_mysql-0.10.17/gem_make.out

client secure_auth enabled

I'm trying to connect to a mysql 5.6 database and get this error: client secure_auth enabled. I tried to set OLD_PASSWORD('password') to the user, but it didn't work. Also tried with no success to set :secure_auth => false in the setup options.

Did anyone face this problem? Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.