www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - mysql-native + vibe.d example

reply crimaniak <crimaniak gmail.com> writes:
Hi!
Moving my project from mysql-lited to mysql-native I faced the 
problem with null pointer error inside of mysql-native:

Log:
SELECT id FROM versionupdate ORDER BY id
Task terminated with unhandled exception:
etc.linux.memoryerror.NullPointerError src/etc/linux/memoryerror.d(325)
----------------
??:? void etc.linux.memoryerror.sigsegvUserspaceProcess(void*) 
[0x102ebad]
??:? void etc.linux.memoryerror.sigsegvDataHandler() [0x102eaee]
../../.dub/packages/mysql-native-1.1.0/mysql-native/source/mysql/result.d:466
const(pure nothrow  property bool function()) mysql.result.ResultRange.isValid
[0xdf1626]
../../.dub/packages/mysql-native-1.1.0/mysql-native/source/mysql/result.d:536
void mysql.result.ResultRange.close() [0xdf1cb8]
../../.dub/packages/mysql-native-1.1.0/mysql-native/source/mysql/result.d:460
void mysql.result.ResultRange.__dtor() [0xdf15cc]
../../.dub/packages/mysql-native-1.1.0/mysql-native/source/mysql/result.d:430
ref return mysql.result.ResultRange
mysql.result.ResultRange.opAssign(mysql.result.ResultRange) [0xdf1dba]
source/vcm/sqlWrapper.d:63 mysql.result.ResultRange 
vcm.sqlWrapper.SqlWrapper.query!().query(immutable(char)[]) 
[0xdd57e3]
source/updater/manager.d:92 void 
updater.manager.UpdateManager.update() [0xd74886]
source/app.d:81 void app.prepareDb().__lambda1() [0xcfe740]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/core/core.d:595 void
vibe.core.core.makeTaskFuncInfo!(void delegate()).makeTaskFuncInfo(ref void
delegate()).callDelegate(vibe.core.core.TaskFuncInfo*) [0xc5b703]
../../.dub/packages/vibe-d-0.7.31/vibe-d/source/vibe/core/core.d:1224 void
vibe.core.core.CoreTask.run() [0xf6a916]
??:? void core.thread.Fiber.run() [0x107f17b]
??:? fiber_entryPoint [0x107eede]
??:? [0xffffffff]

Code fragment:
		string s = Sql(sqlString, args).toString!MysqlDialect;
		writeln(s);stdout.flush; // debugging...

		if(conn.__conn() is null) // debugging...
			throw new Exception("connection is null");
		
		ResultRange result;
		// synchronized (mutex)
			result = conn.query(s);  // <-- sqlWrapper.d:63 is here

It seems I am doing something wrong so myself-native fails to 
detect it in isValid(). So I search for example how to use 
mysql-native in real multi-threaded vibe.d application with usage 
of MySQLPool. Please do not point me to basic example provided 
with package because it is single thread.
Thanks.
Jun 29 2017
next sibling parent Martin Tschierschke <mt smartdolphin.de> writes:
On Friday, 30 June 2017 at 00:52:28 UTC, crimaniak wrote:
 Hi!
 Moving my project from mysql-lited to mysql-native I faced the 
 problem with null pointer error inside of mysql-native:
[...]
 It seems I am doing something wrong so myself-native fails to 
 detect it in isValid(). So I search for example how to use 
 mysql-native in real multi-threaded vibe.d application with 
 usage of MySQLPool. Please do not point me to basic example 
 provided with package because it is single thread.
 Thanks.
Sorry, can not help, but would be very interested to learn how to do a real multi-threaded vibe.d with mysql So if you find a solution, please make an simplified example for vibe.d documentation! Sönke might include it into vibe.d docs.
Jun 30 2017
prev sibling parent reply tetyys <tetyys tetyys.com> writes:
On Friday, 30 June 2017 at 00:52:28 UTC, crimaniak wrote:
 Hi!
 Moving my project from mysql-lited to mysql-native I faced the 
 problem with null pointer error inside of mysql-native:
seems like it's already fixed https://github.com/mysql-d/mysql-native/commit/477636ad944442a15d504308d1893f987685cd71
Jun 30 2017
parent crimaniak <crimaniak gmail.com> writes:
On Friday, 30 June 2017 at 16:18:33 UTC, tetyys wrote:
 On Friday, 30 June 2017 at 00:52:28 UTC, crimaniak wrote:
 Hi!
 Moving my project from mysql-lited to mysql-native I faced the 
 problem with null pointer error inside of mysql-native:
seems like it's already fixed https://github.com/mysql-d/mysql-native/commit/477636ad944442a15d504308d1893f987685cd71
Yes, this is relevant fix. Thanks!
Jun 30 2017