@@ -18,7 +18,7 @@ var assert = require('assert');
1818var rds = require ( '../' ) ;
1919var config = require ( './config' ) ;
2020
21- describe . only ( 'ali-rds.test.js' , function ( ) {
21+ describe ( 'ali-rds.test.js' , function ( ) {
2222 before ( function * ( ) {
2323 this . db = rds ( config ) ;
2424 yield this . db . query ( 'truncate `ali-sdk-test-user`' ) ;
@@ -33,6 +33,41 @@ describe.only('ali-rds.test.js', function () {
3333 } ) ;
3434 } ) ;
3535
36+ describe ( 'options.needFields = false' , function ( ) {
37+ var options = { } ;
38+ for ( var k in config ) {
39+ options [ k ] = config [ k ] ;
40+ }
41+ options . needFields = false ;
42+ var db = rds ( options ) ;
43+
44+ it ( 'should return rows only' , function * ( ) {
45+ var rows = yield db . query ( 'show tables' ) ;
46+ assert ( rows ) ;
47+ assert ( Array . isArray ( rows ) ) ;
48+ } ) ;
49+
50+ it ( 'should connection query return rows only' , function * ( ) {
51+ var conn = yield db . getConnection ( ) ;
52+ var rows = yield conn . query ( 'show tables' ) ;
53+ conn . release ( ) ;
54+ assert ( rows ) ;
55+ assert ( Array . isArray ( rows ) ) ;
56+ } ) ;
57+ } ) ;
58+
59+ describe ( 'escape()' , function ( ) {
60+ it ( 'should client return escape string' , function ( ) {
61+ assert . equal ( this . db . escape ( '\'\"?<//\\' ) , '\'\\\'\\"?<//\\\\\'' ) ;
62+ } ) ;
63+
64+ it ( 'should connection return escape string' , function * ( ) {
65+ var conn = yield this . db . getConnection ( ) ;
66+ assert . equal ( conn . escape ( '\'\"?<//\\' ) , '\'\\\'\\"?<//\\\\\'' ) ;
67+ conn . release ( ) ;
68+ } ) ;
69+ } ) ;
70+
3671 describe ( 'query()' , function ( ) {
3772 before ( function * ( ) {
3873 yield this . db . query ( 'insert into `ali-sdk-test-user`(name, email, gmt_create, gmt_modified) \
0 commit comments