第12月第15天 mysqlx boost reswift

1.

INSTALL PLUGIN mysqlx SONAME 'mysqlx.so'

 

https://yq.aliyun.com/articles/38288

2. boost

 

        boost::shared_ptr< MySQL_Driver > newDriver;

        newDriver.reset(new MySQL_Driver(dummy));
        driver[dummy] = newDriver;

        return newDriver.get();
...
MySQL_Driver::MySQL_Driver(const ::sql::SQLString & clientLib)
{
    try {
        proxy.reset(::sql::mysql::NativeAPI::createNativeDriverWrapper(clientLib));
    }    catch(std::runtime_error & e)    {
        throw sql::InvalidArgumentException(e.what());
    }
}
...
/* {{{ createStMysqlWrapper() */
NativeDriverWrapper *
createNativeDriverWrapper(const SQLString & clientFileName)
{
    return new MySQL_NativeDriverWrapper(clientFileName);
}
/* }}} */


/* {{{ MySQL_NativeDriverWrapper::MySQL_NativeDriverWrapper() */
MySQL_NativeDriverWrapper::MySQL_NativeDriverWrapper(const ::sql::SQLString & clientFileName)
    : api(::sql::mysql::NativeAPI::getCApiHandle(clientFileName))
{
}
/* }}} */
...
boost::shared_ptr< IMySQLCAPI > getCApiHandle(const sql::SQLString & name)
{
#ifdef MYSQLCLIENT_STATIC_BINDING
    return LibmysqlStaticProxy::theInstance();
#else

 

https://codeload.github.com/mysql/mysql-connector-cpp/tar.gz/1.1.9

 

3.

import UIKit

class ViewController: UIViewController {
    var finishedCallBack: ( (dataString: String) -> () )?
    override func viewDidLoad() {
        super.viewDidLoad()

        //解决方式三: [unowned self]  跟 _unsafe_unretained 类似  
        loadData { [unowned self] (dataString) -> () in
            print("\(dataString) \(self.view)")
        }  
    }

    func method2() {
        //解决方式二:  在swift中 有特殊的写法  [weak self]
        loadData { [weak self] (dataString) -> () in

            //以后在闭包中中 使用self 都是若引用的
            print("\(dataString) \(self?.view)")
        }
    }

    func method1() {
        // 解决方式一: weak , OC中类似方法__weak
        weak var weakSelf = self
        loadData { (dataString) -> () in
            print("\(dataString) \(weakSelf?.view)")
        }
    }

 

 

http://www.jianshu.com/p/42c09c4bf6de

http://www.infoq.com/cn/articles/ios-arch-based-on-reswift-and-app-coordinator

posted @ 2017-09-15 09:00  lianhuaren  阅读(163)  评论(0编辑  收藏  举报