www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - mysql-native: newbie questions

reply "salvari" <salvari gmail.com> writes:
Hi all!

After 14 years using Perl for programming at job I'm now learning 
D. (And enjoying it)

We've been using Perl (at job) for years for loading input data 
(UTF files) into a database and using these data for different 
purposes.

The volume of input data files has been constantly increasing 
along the years and, eventually, we need a faster solution, 
that's the reason to switch back to compiled languages, and D 
seemed interesting enough to give it a try. :-)

As a newbie I've a few questions. I'm already using D and it's 
working fine, although I'm writing baby-D the performance 
improvement is impressive, I'm now trying to use mysql native 
access. It seems there are two possibilities:

- https://github.com/simendsjo/mysqln
- https://github.com/rejectedsoftware/mysql-native

So far we've tried the second one, mysql-native, with success 
while using rdmd, but I've failed to compile using dmd, (the 
rather cryptic message from the compiler it's attached at the end 
of this entry).

I'm using Ubuntu 13.10 64 bits. dmd v2.064, dub v0.9.20

I've cloned from github and then:
$ cd mysql-native
$ dub
$ cd ../myProyect
$ cp -r ../mysql-native/source/mysql .
$ dmd mpe_procTmpTables.d (fails)
$ ./mpe_procTmpTables.d   (works fine via rdmd)


I know I must be doing something really stupid and wrong but I'm 
stuck, any help would be really appreciated.

Thanks in advance.


Compiler error:
dmd mpe_procTmpTables.d
mpe_procTmpTables.o:(.data+0x550): undefined reference to 
`_D5mysql10connection12__ModuleInfoZ'
mpe_procTmpTables.o: In function 
`_D17mpe_procTmpTables10procTablesFAyaZv':
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x1e): 
undefined reference to `_D5mysql10connection10Connection7__ClassZ'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x4a): 
undefined reference to 
`_D5mysql10connection10Connection6__ctorMFAyaE5mysql10connection11SvrCapFlagsZC5mysql10connection10Connection'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x69): 
undefined reference to 
`_D5mysql10connection8MetaData6__ctorMFNcC5mysql10connection10ConnectionZS5mysql10connection8MetaData'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x99): 
undefined reference to 
`_D5mysql10connection7Command6__ctorMFNcC5mysql10connection10ConnectionZS5mysql10connection7Command'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x415): 
undefined reference to 
`_D5mysql10connection7Command6__ctorMFNcC5mysql10connection10ConnectionZS5mysql10connection7Command'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x5b9): 
undefined reference to 
`_D5mysql10connection7Command6__ctorMFNcC5mysql10connection10ConnectionZS5mysql10connection7Command'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x5d3): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x5e6): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x650): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x663): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x67d): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x690): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x710): 
undefined reference to 
`_D5mysql10connection7Command6__ctorMFNcC5mysql10connection10ConnectionZS5mysql10connection7Command'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x72a): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x73d): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x81c): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x82f): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x849): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x85c): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x93b): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x94e): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x968): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x97b): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0x9fb): 
undefined reference to 
`_D5mysql10connection7Command6__ctorMFNcC5mysql10connection10ConnectionZS5mysql10connection7Command'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xa65): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xa78): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xae2): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xaf5): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xb0f): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xb22): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xc01): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xc14): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xc2e): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xc41): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xcc1): 
undefined reference to 
`_D5mysql10connection7Command6__ctorMFNcC5mysql10connection10ConnectionZS5mysql10connection7Command'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xcdb): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xcee): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xd6e): 
undefined reference to 
`_D5mysql10connection7Command6__ctorMFNcC5mysql10connection10ConnectionZS5mysql10connection7Command'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xe4d): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xe60): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xe7a): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv+0xe8d): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.o: In function 
`_D17mpe_procTmpTables10procTablesFAyaZv8colNamesMFAyaZAAya':
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv8colNa
esMFAyaZAAya+0x52): 
undefined reference to 
`_D5mysql10connection8MetaData7columnsMFAyaZAS5mysql10connection10ColumnInfo'
mpe_procTmpTables.o: In function 
`_D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3MFKAyaKAyaZi':
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x12f): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x209): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x22e): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x2de): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x2f1): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x32b): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x33e): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x42f): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x442): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x49b): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody3
FKAyaKAyaZi+0x4ae): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.o: In function 
`_D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4MFKAyaKAyaZi':
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody
MFKAyaKAyaZi+0xef): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x10d): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x1ab): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x1be): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x2bf): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x2d2): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x33b): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x34e): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x3a6): 
undefined reference to 
`_D5mysql10connection7Command3sqlMFNdAyaZAya'
mpe_procTmpTables.d:(.text._D17mpe_procTmpTables10procTablesFAyaZv14__foreachbody4
FKAyaKAyaZi+0x3b9): 
undefined reference to 
`_D5mysql10connection7Command7execSQLMFJmZb'
collect2: error: ld returned 1 exit status
--- errorlevel 1
Feb 17 2014
next sibling parent reply "simendsjo" <simendsjo gmail.com> writes:
On Monday, 17 February 2014 at 22:54:58 UTC, salvari wrote:
 Hi all!

 After 14 years using Perl for programming at job I'm now 
 learning D. (And enjoying it)

Hi, and welcome. (...)
 As a newbie I've a few questions. I'm already using D and it's 
 working fine, although I'm writing baby-D the performance 
 improvement is impressive, I'm now trying to use mysql native 
 access. It seems there are two possibilities:

 - https://github.com/simendsjo/mysqln
 - https://github.com/rejectedsoftware/mysql-native

 So far we've tried the second one, mysql-native, with success 
 while using rdmd, but I've failed to compile using dmd, (the 
 rather cryptic message from the compiler it's attached at the 
 end of this entry).

You're right in picking the rejectedsoftware repo. The first one is in a state of flux while experimenting with a near complete rewrite and a new API. The rejectedsoftware repo is based on an earlier version of mine which in turn is based on the original by Steve Teale (britseye). (... lots of compiler errors ...) What you are seeing are missing dependencies. DMD won't figure out dependencies you are using without you specifying it in detail. You should be using dub directly rather than dmd. Specify your dependencies in the package.json file, and use "dub run" to run the application. I created a video tutorial a couple of days ago that might help you get started using dub: http://youtu.be/8TV9ZZteYEU
Feb 17 2014
next sibling parent reply John J <john.joyus gmail.com> writes:
On 02/17/2014 08:04 PM, simendsjo wrote:
 I created a video tutorial a couple of days ago that might help you get
 started using dub: http://youtu.be/8TV9ZZteYEU

That's helpful, thanks! Please post it in the D.Announce group too.
Feb 18 2014
parent John J <john.joyus gmail.com> writes:
On 02/18/2014 12:46 PM, simendsjo wrote:
 I've created two more videos, but they are pure live-coding D basics and
 probably of less interest to most of the users here:
 https://www.youtube.com/playlist?list=PLqABwcsDQUo59iBOM5DFtqbwrMhL4PWcQ

 I expect there will be made an announcement about that YouTube channel
 as soon as we upload a couple of more videos.

Cool!
Feb 18 2014
prev sibling next sibling parent Martin Nowak <code dawg.eu> writes:
On 02/18/2014 01:29 PM, simendsjo wrote:
 On Tuesday, 18 February 201hanks for the nod. It's good to see that all
 those hours were
 not wast4 at 11:56:23 UTC, Steve Teale wrote:
 On Tuesday, 18 February 2014 at 01:04:10 UTC, simendsjo wrote:

which in turn is based on the original by Steve Teale (britseye).

wasted.

And this is a reminder that I should finish the rewrite to not let all those hours go to waste :) The code everyone uses is pretty much exactly your original code with many small refactorings like remove magic constants. So big thanks for doing all that work!

Please do, a concise and performant ORM (Datamapper) for MySQL is a huge selling point. I remember some good ideas in http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/4526/.
Apr 06 2014
prev sibling next sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 4/6/2014 3:05 PM, salvari wrote:
 Following Nick advice I've completed my project by using dmd and
 specifying dependencies manually, it's a tiny project after all.
 Everything seems to work fine. So...

 After seen your tutorials (at youtube, by the way very useful indeed)
 I'm now trying to port my code to use dub, again I have a doubt.

 In my code, at 'dub.json' file I've wrote:
      "dependencies": {
              "mysql-native" : ">=0.0.12"
      }

 When trying to build, I've got an error from mysql-native code:
 $HOME/.dub/packages/mysql-native-0.0.12/source/mysql/connection.d(333):
 Error: cannot implicitly convert expression (t % 24) of type int to ubyte


 But this error seems to be already solved in github repo for mysql-native.

 I manually copy the files from my cloned copy of mysql-native into
 $HOME/.dub/packages/mysql-native-0.0.12/source/mysql/

 and now everything works fine.

 Am I making an error when specifying my dependencies??

IMO, DUB really needs a way to specify a specific Git commit hash: https://github.com/rejectedsoftware/dub/issues/51 I've tagged the current mysql-native HEAD as v0.0.13, so as soon as the dub repository sees the update (check http://code.dlang.org/packages/mysql-native ), you should be able to just do: "mysql-native" : ">=0.0.13"
Apr 06 2014
prev sibling parent reply Martin Nowak <code dawg.eu> writes:
On 04/06/2014 09:05 PM, salvari wrote:
 In my code, at 'dub.json' file I've wrote:
      "dependencies": {
              "mysql-native" : ">=0.0.12"
      }

 When trying to build, I've got an error from mysql-native code:
 $HOME/.dub/packages/mysql-native-0.0.12/source/mysql/connection.d(333):
 Error: cannot implicitly convert expression (t % 24) of type int to ubyte


 But this error seems to be already solved in github repo for mysql-native.

You can use "~master" to get the latest version of a package. http://code.dlang.org/package-format#version-specs
Apr 06 2014
parent =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= <sludwig+dforum outerproduct.org> writes:
Am 07.04.2014 02:35, schrieb Nick Sabalausky:
 On Sunday, 6 April 2014 at 22:37:08 UTC, Martin Nowak wrote:
 You can use "~master" to get the latest version of a package.
 http://code.dlang.org/package-format#version-specs

I thought that was deprecated (according to the format description at code.dlang.org)

Seems like that documentation change was uploaded a bit too early. The deprecation will come with 0.9.22 (there is a beta version available for download) and there will be two alternative mechanisms to use non-tagged versions of a package then; user/system wide overrides ("dub add-override ...") and using the new dub.selections.json file.
Apr 07 2014
prev sibling next sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 2/17/2014 5:54 PM, salvari wrote:
 I'm using Ubuntu 13.10 64 bits. dmd v2.064, dub v0.9.20

 I've cloned from github and then:
 $ cd mysql-native
 $ dub
 $ cd ../myProyect
 $ cp -r ../mysql-native/source/mysql .
 $ dmd mpe_procTmpTables.d (fails)
 $ ./mpe_procTmpTables.d   (works fine via rdmd)


 I know I must be doing something really stupid and wrong but I'm stuck,
 any help would be really appreciated.

D's build model is similar to C: The compiler only compiles the files you give it. You didn't give it the mysql-native source files, so it didn't compile them. Hence, linker errors for all the missing symbols. The main point of RDMD is to find all the files used by your program and automatically pass them all to the compiler. Usually you'll just want to use RDMD instead of calling DMD directly. If you don't want RDMD to automatically run your program after compiling it, use --build-only. Or use DUB to build it and run it like simendsjo said. It grabs up all your files and passes them all to DMD much like RDMD does.
Feb 17 2014
prev sibling next sibling parent "simendsjo" <simendsjo gmail.com> writes:
On Tuesday, 18 February 2014 at 06:45:53 UTC, Nick Sabalausky 
wrote:
(...)
 Or use DUB to build it and run it like simendsjo said. It grabs 
 up all your files and passes them all to DMD much like RDMD 
 does.

I would say use DUB for anything other than very small projects - and perhaps even then. Sönke Ludwig has done a great job on creating a pragmatic build/package manager. I'm a big fan of ddox too.
Feb 17 2014
prev sibling next sibling parent "Steve Teale" <steve.teale britseyeview.com> writes:
On Tuesday, 18 February 2014 at 01:04:10 UTC, simendsjo wrote:

mine which in turn is based on the original by Steve Teale (britseye).

not wasted.
Feb 18 2014
prev sibling next sibling parent "simendsjo" <simendsjo gmail.com> writes:
On Tuesday, 18 February 201hanks for the nod. It's good to see 
that all those hours were
not wast4 at 11:56:23 UTC, Steve Teale wrote:
 On Tuesday, 18 February 2014 at 01:04:10 UTC, simendsjo wrote:

mine which in turn is based on the original by Steve Teale (britseye).

not wasted.

And this is a reminder that I should finish the rewrite to not let all those hours go to waste :) The code everyone uses is pretty much exactly your original code with many small refactorings like remove magic constants. So big thanks for doing all that work!
Feb 18 2014
prev sibling next sibling parent "salvari" <salvari gmail.com> writes:
On Tuesday, 18 February 2014 at 11:56:23 UTC, Steve Teale wrote:
 On Tuesday, 18 February 2014 at 01:04:10 UTC, simendsjo wrote:

mine which in turn is based on the original by Steve Teale (britseye).

not wasted.

Not wasted at all! For me, MySQL access from D was almost a must.
Feb 18 2014
prev sibling next sibling parent "salvari" <salvari gmail.com> writes:
Hey! Thanks everybody for such a quick response. Problem solved! 
As Nick and you pointed I didn't understand the build process.

Now, thanks to your video simendsjo, I have new duties. Dub and 
Vibed seems worth a detailed look. :-)

I look forward to see the evolution of the mysql native libraries 
;-)
Feb 18 2014
prev sibling next sibling parent "simendsjo" <simendsjo gmail.com> writes:
On Tuesday, 18 February 2014 at 17:39:58 UTC, John J wrote:
 On 02/17/2014 08:04 PM, simendsjo wrote:
 I created a video tutorial a couple of days ago that might 
 help you get
 started using dub: http://youtu.be/8TV9ZZteYEU

That's helpful, thanks! Please post it in the D.Announce group too.

I posted it to D.learn. It was aimed at beginners, so I thought it might be a bit spammy posting it to D.announce. I've created two more videos, but they are pure live-coding D basics and probably of less interest to most of the users here: https://www.youtube.com/playlist?list=PLqABwcsDQUo59iBOM5DFtqbwrMhL4PWcQ I expect there will be made an announcement about that YouTube channel as soon as we upload a couple of more videos.
Feb 18 2014
prev sibling next sibling parent "salvari" <salvari gmail.com> writes:
On Tuesday, 18 February 2014 at 01:04:10 UTC, simendsjo wrote:
 .. preamble

 The rejectedsoftware repo is based on an earlier version of 
 mine which in turn is based on the original by Steve Teale 
 (britseye).

 (... lots of compiler errors ...)

 What you are seeing are missing dependencies. DMD won't figure 
 out dependencies you are using without you specifying it in 
 detail.

 You should be using dub directly rather than dmd. Specify your 
 dependencies in the package.json file, and use "dub run" to run 
 the application.

 I created a video tutorial a couple of days ago that might help 
 you get started using dub: http://youtu.be/8TV9ZZteYEU

Following Nick advice I've completed my project by using dmd and specifying dependencies manually, it's a tiny project after all. Everything seems to work fine. So... After seen your tutorials (at youtube, by the way very useful indeed) I'm now trying to port my code to use dub, again I have a doubt. In my code, at 'dub.json' file I've wrote: "dependencies": { "mysql-native" : ">=0.0.12" } When trying to build, I've got an error from mysql-native code: $HOME/.dub/packages/mysql-native-0.0.12/source/mysql/connection.d(333): Error: cannot implicitly convert expression (t % 24) of type int to ubyte But this error seems to be already solved in github repo for mysql-native. I manually copy the files from my cloned copy of mysql-native into $HOME/.dub/packages/mysql-native-0.0.12/source/mysql/ and now everything works fine. Am I making an error when specifying my dependencies??
Apr 06 2014
prev sibling next sibling parent "Nick Sabalausky" <a a.a> writes:
On Sunday, 6 April 2014 at 22:37:08 UTC, Martin Nowak wrote:
 You can use "~master" to get the latest version of a package.
 http://code.dlang.org/package-format#version-specs

I thought that was deprecated (according to the format description at code.dlang.org)
Apr 06 2014
prev sibling next sibling parent reply "Steve Teale" <steve.teale britseyeview.com> writes:
On Monday, 17 February 2014 at 22:54:58 UTC, salvari wrote:
 Hi all!

 After 14 years using Perl for programming at job I'm now 
 learning D. (And enjoying it)

 We've been using Perl (at job) for years for loading input data 
 (UTF files) into a database and using these data for different 
 purposes.

 The volume of input data files has been constantly increasing 
 along the years and, eventually, we need a faster solution, 
 that's the reason to switch back to compiled languages, and D 
 seemed interesting enough to give it a try. :-)

 As a newbie I've a few questions. I'm already using D and it's 
 working fine, although I'm writing baby-D the performance 
 improvement is impressive, I'm now trying to use mysql native 
 access. It seems there are two possibilities:

 - https://github.com/simendsjo/mysqln
 - https://github.com/rejectedsoftware/mysql-native

Quite by accident/coincidence, I recently returned to my mysqln effort to see if it would still build with the latest dmd. I had also reinstalled MySQL recently so it was a different version, and that resulted in a few tweaks to the unit tests. However, other than that, I had no great problem. I then set about trying to minimize memory allocations, and hopefully get the thing to be a bit more speedy. I think I have made some improvements there. Now I realize that the code is pretty impenetrable. It's dealing with a protocol that is really very basic, badly documented, and consists of streams of ubytes minimized as much as possible, probably by disparate authors. You don't know what the next byte might represent until you've looked at the current one in context, so that makes it as bad a candidate for an input range as UTF8, or worse. However, on a return visit, I'm not inclined to change my mind about the higher level interactions. I think the ability to read a specific table row into a tuple of D types, or to populate a D struct is quite cool. Also result sets with multiple rows can constitute an input range, so the std.algorithm stuff should be fine for doing finer graded selection than that provided by the SQL query. If you want to do database stuff that avoids knowledge of how to use SQL, then I'd say it could be wrapped to provide that sort of thing - but then I always hated Visual Basic. If you give me a couple of weeks or less, I'll convert it into a tidy module that will build with dub, and then I will invite the D aficionados to tell me how I can improve the efficiency of the protocol handling, and the template stuff that I used. From previous experience, I'm fairly confident that I won't get any takers, so I'll just keep up with the newsgroup and do the best I can to keep up with idiomatic D usage, as long as it's not just to show how cleverly things can be done. I still quite like it, and if I had to seriously write something in D that needed MySQL, I would use it in preference to my earlier attempt at a wrapper around the C library. But thanks for the interest Steve.
Apr 07 2014
parent reply simendsjo <simendsjo gmail.com> writes:
On 04/07/2014 07:27 PM, Steve Teale wrote:
 On Monday, 17 February 2014 at 22:54:58 UTC, salvari wrote:
 Hi all!

 After 14 years using Perl for programming at job I'm now learning D.
 (And enjoying it)

 We've been using Perl (at job) for years for loading input data (UTF
 files) into a database and using these data for different purposes.

 The volume of input data files has been constantly increasing along
 the years and, eventually, we need a faster solution, that's the
 reason to switch back to compiled languages, and D seemed interesting
 enough to give it a try. :-)

 As a newbie I've a few questions. I'm already using D and it's working
 fine, although I'm writing baby-D the performance improvement is
 impressive, I'm now trying to use mysql native access. It seems there
 are two possibilities:

 - https://github.com/simendsjo/mysqln
 - https://github.com/rejectedsoftware/mysql-native

Quite by accident/coincidence, I recently returned to my mysqln effort to see if it would still build with the latest dmd.

This is great news. If you look at the simendsjo repo, there's a rewrite in progress, but it's still missing some key features. The rejectedsoftware repo is the one in production use. Here's a TODO: http://forum.dlang.org/post/zsfxoggzwkmqjzyxbwgc forum.dlang.org And a recent discussion on github: https://github.com/rejectedsoftware/mysql-native/issues/34#issuecomment-39708245 The code is still very much your own with some restructuring and cleanups, so hopefully you'll feel at home.
Apr 07 2014
next sibling parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 4/8/2014 2:51 AM, simendsjo wrote:
 This is great news. If you look at the simendsjo repo, there's a rewrite
 in progress, but it's still missing some key features.
 The rejectedsoftware repo is the one in production use.

 Here's a TODO:
 http://forum.dlang.org/post/zsfxoggzwkmqjzyxbwgc forum.dlang.org

It looks like at least some of that TODO takes things beyond where the rejectedsoftware version is, which is good, of course. But what would you say are the things needed just to bring it up to parity with the rejectedsoftware version? (So we could declare it the new "official" and either replace or deprecate the current one.)
Apr 08 2014
parent reply simendsjo <simendsjo gmail.com> writes:
On 04/08/2014 09:52 AM, Nick Sabalausky wrote:
 On 4/8/2014 2:51 AM, simendsjo wrote:
 This is great news. If you look at the simendsjo repo, there's a rewrite
 in progress, but it's still missing some key features.
 The rejectedsoftware repo is the one in production use.

 Here's a TODO:
 http://forum.dlang.org/post/zsfxoggzwkmqjzyxbwgc forum.dlang.org

It looks like at least some of that TODO takes things beyond where the rejectedsoftware version is, which is good, of course. But what would you say are the things needed just to bring it up to parity with the rejectedsoftware version? (So we could declare it the new "official" and either replace or deprecate the current one.)

What comes to mind is * Stored Procedures * Purging results (cancelling queries) * Sending and receiving large blobs But if this should become the official version, more thought should go into the API, or we should build a "fully" compatible API. By "fully", I mean as much as possible - there are some very odd behavior regarding passing values to stored procedures in the original code that shouldn't be replicated.
Apr 08 2014
parent reply simendsjo <simendsjo gmail.com> writes:
On 04/08/2014 04:00 PM, Steve Teale wrote:
 On Tuesday, 8 April 2014 at 07:58:58 UTC, simendsjo wrote:
 On 04/08/2014 09:52 AM, Nick Sabalausky wrote:
 On 4/8/2014 2:51 AM, simendsjo wrote:


 What comes to mind is
 * Stored Procedures
 * Purging results (cancelling queries)
 * Sending and receiving large blobs

The original did all of these, and user-defined functions. At the time MySQL did not support strored procedures that returned a result set. Maybe it does not but I have not investigated that yet. Steve

I think most of what's needed for stored procedures is implemented.
Apr 08 2014
parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 4/8/2014 11:49 AM, Steve Teale wrote:
 On Tuesday, 8 April 2014 at 14:10:19 UTC, simendsjo wrote:

 I think most of what's needed for stored procedures is implemented.

OK, can you give me a brief run-down on the changes you would like to see/are working on. Then we can get together and agree on an outcome that makes the best of both our points of view. I am not inflexible. When I dropped out it was because there was just no consensus. Now, I don't give a **ck if there's consensus or not. The main thing is 1) does it work, ans 2) does it provide what D programmers might expect in the context of the language features and Phobos custom and practice. Those who want something completely different are most welcome to use our stuff and do it themselves. Deal?

Is there some specific disagreement this is referring to, or just a general "proposed ground rules" statement?
Apr 08 2014
prev sibling parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 4/8/2014 2:51 AM, simendsjo wrote:
 This is great news. If you look at the simendsjo repo, there's a rewrite
 in progress, but it's still missing some key features.
 The rejectedsoftware repo is the one in production use.

 Here's a TODO:
 http://forum.dlang.org/post/zsfxoggzwkmqjzyxbwgc forum.dlang.org

FWIW, I've just tried running the tests. In short, it seems to work fine on Windows 32-bit, although my MySQL server breaks a few minor unittests. Details: - Server: MySQL version "5.0.91-community-nt" (probably getting old but, meh, it's just for local testing) running on a Win7 64-bit box. I'm not sure if the MySQL server itself is a 32-bit or 64-bit version (don't recall, and the admin panel isn't telling me). - Client 1: The same Win7 box, using DMD to compile a 32-bit exe. - Client 2: Linux Mint 15, 32-bit VM (DMD again). Everything behaved exactly the same between the two clients. Everything passed except for a few asserts in the "information_schema" section. There were two things that went wrong: - For me, field.table was always empty string, on all 4 entries in the field list (instead of "information_schema" as expected). - For me, the first two entries in the field list had lengths of 192, instead of 96 as expected.
Apr 08 2014
parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 4/8/2014 5:40 AM, Nick Sabalausky wrote:
 - For me, field.table was always empty string, on all 4 entries in the
 field list (instead of "information_schema" as expected).

Sorry, I meant to say "...field.***schema*** was always empty string..."
Apr 08 2014
prev sibling next sibling parent "Steve Teale" <steve.teale britseyeview.com> writes:
On Tuesday, 8 April 2014 at 07:58:58 UTC, simendsjo wrote:
 On 04/08/2014 09:52 AM, Nick Sabalausky wrote:
 On 4/8/2014 2:51 AM, simendsjo wrote:


 What comes to mind is
 * Stored Procedures
 * Purging results (cancelling queries)
 * Sending and receiving large blobs

The original did all of these, and user-defined functions. At the time MySQL did not support strored procedures that returned a result set. Maybe it does not but I have not investigated that yet. Steve
Apr 08 2014
prev sibling next sibling parent "Steve Teale" <steve.teale britseyeview.com> writes:
On Tuesday, 8 April 2014 at 14:10:19 UTC, simendsjo wrote:

 I think most of what's needed for stored procedures is 
 implemented.

OK, can you give me a brief run-down on the changes you would like to see/are working on. Then we can get together and agree on an outcome that makes the best of both our points of view. I am not inflexible. When I dropped out it was because there was just no consensus. Now, I don't give a **ck if there's consensus or not. The main thing is 1) does it work, ans 2) does it provide what D programmers might expect in the context of the language features and Phobos custom and practice. Those who want something completely different are most welcome to use our stuff and do it themselves. Deal? Steve
Apr 08 2014
prev sibling next sibling parent "Steve Teale" <steve.teale britseyeview.com> writes:
On Tuesday, 8 April 2014 at 14:10:19 UTC, simendsjo wrote:
 On 04/08/2014 04:00 PM, Steve Teale wrote:
 On Tuesday, 8 April 2014 at 07:58:58 UTC, simendsjo wrote:


On a more specific topic, Nick S mentioned purging of result sets. I have a mixed view of this. One half of me says "if you cant present a SQL query that selects what you want, then put up with the inefficiency of waiting for the thread to read through all the stuff until it finds an EOF". The other half wonders if there should be a connection pool, and then situations like that could just switch to a new connection, and leave the existing one at lower priority to clean up the garbage. But the latter is not systems programming approach. Writing that down cleared my mind. The level we should aim at should I think be just what is needed to exploit the capabilities of the MySQL/MariaDB protocol version. The protocol is what it is, and is unfriendly toward sloppy SQL. Steve
Apr 08 2014
prev sibling parent "Steve Teale" <steve.teale britseyeview.com> writes:
On Tuesday, 8 April 2014 at 22:06:51 UTC, Nick Sabalausky wrote:
 On 4/8/2014 11:49 AM, Steve Teale wrote:
 On Tuesday, 8 April 2014 at 14:10:19 UTC, simendsjo wrote:


 Those who want something completely different are most welcome 
 to use
 our stuff and do it themselves.

 Deal?

Is there some specific disagreement this is referring to, or just a general "proposed ground rules" statement?

Ground rules-but rules are meant to be broken ;=) Steve
Apr 08 2014