Coder Social home page Coder Social logo

mysql-lited's People

Contributors

cromfr avatar devebookingservices avatar jcrapuchettes avatar joalves avatar marcioapm avatar mario-tripaneer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mysql-lited's Issues

inserter.d(210,9): Error: no property 'execute' for type 'Connection!(VibeSocket, cast(ConnectionOptions)0)**'

After upgrade from 0.3.15 to 0.3.16 I got an error:
../../.dub/packages/mysql-lited-0.3.16/mysql-lited/src/mysql/inserter.d(210,9): Error: no property 'execute' for type 'Connection!(VibeSocket, cast(ConnectionOptions)0)**'
source/vcm/sqlWrapper.d(59,31): Error: template instance mysql.inserter.inserter!(Connection!(VibeSocket, cast(ConnectionOptions)0)*, string[]) error instantiating
source/updater/action/addRecords.d(22,12): instantiated from here: insert!(int, string)
...
It was o.k. in 0.3.15

Support for transactions

Transactions guarantee that all info required are insert without failure before saving records. Especially for things like double entry and payments.

Access violation

I run MySQL in docker using:

sudo docker create --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mysecretpassword mysql

And I try to connect to it using:

import mysql.client;
import mysql.socket;

shared static this()
{
    auto conn = new Connection!VibeSocket();
    conn.connect("host=127.0.0.1;user=root;pwd=mysecretpassword");
    conn.execute("SELECT 1 + 1 as solution", (MySQLRow row)
    {
        return false; 
    });
}

Giving me an Access violation and the program crashes.

ConnectionPool constructor is depracated

Using vibe-d:0.8.4:

../.dub/packages/mysql-lited-0.4.5/mysql-lited/src/mysql/client.d(11,18): Deprecation: constructor vibe.core.connectionpool.ConnectionPool!(Connection!(VibeSocket, cast(ConnectionOptions)0)*).ConnectionPool.this is deprecated - Use an @safe callback instead
../.dub/packages/mysql-lited-0.4.5/mysql-lited/src/mysql/client.d(19,18): Deprecation: constructor vibe.core.connectionpool.ConnectionPool!(Connection!(VibeSocket, cast(ConnectionOptions)0)*).ConnectionPool.this is deprecated - Use an @safe callback instead
../.dub/packages/mysql-lited-0.4.5/mysql-lited/src/mysql/client.d(27,18): Deprecation: constructor vibe.core.connectionpool.ConnectionPool!(Connection!(VibeSocket, cast(ConnectionOptions)0)*).ConnectionPool.this is deprecated - Use an @safe callback instead

Problems using inserter with OnDuplicate.Ignore.

When I run the following code:

auto client = new MySQLClient(...);
auto con = clieck.lockConnection();

con.use(my_db);
auto insert = inserter(con, OnDuplicate.Ignore, "users", "googleID");
foreach(i; 30 .. 40) {
insert.row(i);
}
insert.flush;

I get the following error on the flush call:
[email protected]\packages\mysql-lited-0.3.15\mysql-lited\src\mysql\packet.d(53): Assertion failure

0x0059A99B in _d_assert
0x0048E071 in void mysql.packet.InputPacket.skip(uint) at dub\packages\mysql-lited-0.3.15\mysql-lited\src\mysql\packet.d(54)
0x00477FD9 in D5mysql10connection84__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionA0698ACEAD000617DF0366730C40E1B2 at dub\packages\mysql-lited-0.3.15\mysql-lited\src\mysql\connection.d(691)


The table looks like this:
create table users ( id int auto_increment,
googleID bigint unsigned unique,
primary key(id))

When I use OnDuplicate.Error everything works fine. (unless i have duplicates ofc)
Am I using the inserter wrong or is there something else that is problematic?

mysql-lited-0.3.13,compile "conn.execute" error

mysql-lited-0.3.13,compile error

conn.execute("insert into users (name, email) values (?, ?)", "frank", "[email protected]");

connection.d(246,4): Error: undefined identifier 'func'
connection.d(246,4): Error: undefined identifier 'file', did you mean variabl
e 'File'?
connection.d(246,4): Error: undefined identifier 'line', did you mean variabl
e 'Line'?
source\app.d(9,14): Error: template instance mysql.connection.Connection!(VibeSo
cket, cast(ConnectionOptions)0).Connection.execute!("source\app.d", 9, string,
string) error instantiating
dmd failed with exit code 1.

AssertError in packet.d 24 when connecting to MariaDB 10.0.29

Server version: 10.0.29-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

usage:

class SqlWrapper
{
	enum Options = ConnectionOptions.Default;
	alias ClientType = MySQLClientT!(VibeSocket,Options);

	private 
	{
		static __gshared Mutex mutex;
		ClientType client;
		Connection!(VibeSocket, Options)* conn;
	}
	
	this(string connectionString)
	{
		client = new ClientType(connectionString);
		conn = client.lockConnection();
	}
....
}

Error:

core.exception.AssertError@../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/packet.d(24): Assertion failure
----------------
??:? _d_assert [0x81834c]
??:? void mysql.packet.__assert(int) [0x770b3d]
../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/packet.d:24 pure nothrow @nogc ushort mysql.packet.InputPacket.eat!(ushort).eat() [0x7562a3]
../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/connection.d:717 void mysql.connection.__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z.Connection.eatStatus!("../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/connection.d", 671uL).eatStatus(mysql.packet.InputPacket, bool) [0x75b42f]
../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/connection.d:671 void mysql.connection.__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z.Connection.eatHandshake(mysql.packet.InputPacket) [0x7509e3]
../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/connection.d:492 void mysql.connection.__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z.Connection.connect() [0x74ff97]
../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/connection.d:144 void mysql.connection.__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z.Connection.connect(immutable(char)[]) [0x74f72b]
../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/client.d:13 _D5mysql6client86__T12MySQLClientTTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z12MySQLClientT6__ctorMFAyaZ9__lambda2MFZPS5mysql10connection84__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z10Connection [0x74eff2]
../../.dub/packages/vibe-d-0.7.30/vibe-d/source/vibe/core/connectionpool.d:87 vibe.core.connectionpool.LockedConnection!(mysql.connection.__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z.Connection*).LockedConnection vibe.core.connectionpool.ConnectionPool!(mysql.connection.__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z.Connection*).ConnectionPool.lockConnection() [0x751f9d]
../../.dub/packages/mysql-lited-0.3.15/mysql-lited/src/mysql/client.d:35 vibe.core.connectionpool.LockedConnection!(mysql.connection.__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z.Connection*).LockedConnection mysql.client.__T12MySQLClientTTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionOptionsi0Z.MySQLClientT.lockConnection() [0x74f43b]
src/vcm/sqlWrapper.d:21 vcm.sqlWrapper.SqlWrapper vcm.sqlWrapper.SqlWrapper.__ctor(immutable(char)[]) [0x74498b]
...

Connection Type

Hi there, this isn't a bug but just wondering if you can advise what Type I can use to store the MySQL connection as a private class attribute.

e.g.

class DB {
private Connection conn;

this {
this.conn = client.lockConnection();
}
}

Can you provide an example of what to use for "Connection" as the type?

Cheers and thanks!

InvalidMemoryOperationError

when i run this simple code in the unittest mode,the app will cause a memory exception after exiting

shared static this()
{       
    import mysql;
    auto client = new MySQLClient("host=127.0.0.1;user=root;pwd=test;db=motion");
}

core.exception.InvalidMemoryOperationError@src\core\exception.d(679): Invalid memory operation

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.