void adbl_attrs_addLong (AdblAttributes* self, const EcString column, uint_t value) { EcString cvalue = ecstr_long( value ); ecmapchar_set( self->columns, column, cvalue ); ecstr_delete( &cvalue ); }
void module_destroy (Q5Module** pself) { Q5Module* self = *pself; ecstr_delete (&(self->host)); ENTC_DEL (pself, Q5Module); }
EcFileObserver ecf_observer_newFromPath(const EcString path, const EcString filename, const EcString confdir, EcEventFiles events, events_callback_fct fct, void* ptr) { EcString lrealpath = ecfs_mergeToPath(path, filename); EcFileObserver inst = ecf_observer_new (lrealpath, confdir, events, fct, ptr); ecstr_delete(&lrealpath); return inst; }
void adbl_parseXMLDatabase( AdblManager self, EcXMLStream xmlstream, const char* confpath) { const EcString name = ecxmlstream_nodeAttribute( xmlstream, "name" ); if(name) { const EcString dbtype = ecxmlstream_nodeAttribute( xmlstream, "type" ); if(dbtype) { ADBLModuleProperties* pp; EcMapNode node; node = ecmap_find(self->modules, dbtype); if (node == ecmap_end(self->modules)) { eclogger_fmt (LL_WARN, MODULE, "credentials", "database '%s' not in the list", dbtype); return; } pp = ecmap_data (node); node = ecmap_find(self->credentials, name); if( node == ecmap_end(self->credentials) ) { int isfile = FALSE; EcString fileprefix = NULL; EcString filextension = NULL; //create new credential AdblCredentials* pc = adbl_credentials_new (dbtype); pc->pp = pp; //add to map ecmap_append(self->credentials, name, pc); //parse the other stuff ENTC_XMLSTREAM_BEGIN if( ecxmlstream_isBegin( xmlstream, "connection" ) ) { const char* port = ecxmlstream_nodeAttribute( xmlstream, "port" ); pc->properties.host = ecstr_copy( ecxmlstream_nodeAttribute( xmlstream, "host" ) ); if(port) pc->properties.port = atoi(port); } else if( ecxmlstream_isBegin( xmlstream, "schema" ) ) { pc->properties.schema = ecstr_copy( ecxmlstream_nodeAttribute( xmlstream, "name" ) ); pc->properties.username = ecstr_copy( ecxmlstream_nodeAttribute( xmlstream, "user" ) ); pc->properties.password = ecstr_copy( ecxmlstream_nodeAttribute( xmlstream, "password" ) ); } else if( ecxmlstream_isBegin( xmlstream, "file" ) ) { isfile = TRUE; fileprefix = ecstr_copy( ecxmlstream_nodeAttribute( xmlstream, "prefix" ) ); filextension = ecstr_copy( ecxmlstream_nodeAttribute( xmlstream, "filextension" ) ); } ENTC_XMLSTREAM_END( "database" ) //create the filename if( isfile == TRUE ) { EcStream file = ecstream_new(); if( fileprefix ) { ecstream_append( file, fileprefix ); ecstream_append( file, "_" ); ecstr_delete (&fileprefix ); } if( pc->properties.schema ) { ecstream_append( file, pc->properties.schema ); } if( filextension ) { ecstream_append( file, filextension ); ecstr_delete (&filextension); } else { ecstream_append( file, ".db" ); } pc->properties.file = ecfs_mergeToPath(confpath, ecstream_buffer( file )); /* clean up */ ecstream_delete(&file); } } else { eclogger_fmt (LL_WARN, MODULE, "credentials", "parsing the config file: db-source already exists [%s] in current register", name ); } }