当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript IPool.query方法代码示例

本文整理汇总了TypeScript中promise-mysql.IPool.query方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IPool.query方法的具体用法?TypeScript IPool.query怎么用?TypeScript IPool.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在promise-mysql.IPool的用法示例。


在下文中一共展示了IPool.query方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: setHost

 setHost(region: IRegion, host: IHost, port: number): Promise<IRegion> {
   let address: string = host ? host.address : '';
   return this.db.query('UPDATE regions SET httpPort=?, slaveAddress=? WHERE uuid=?', [port, address, region.uuid]).then(() => {
     region.node = address;
     return region;
   });
 }
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:7,代码来源:Regions.ts

示例2: setXY

 setXY(region: IRegion, x: number, y: number): Promise<IRegion> {
   return this.db.query('UPDATE regions SET locX=?, locY=? WHERE uuid=?', [x, y, region.uuid]).then(() => {
     region.x = x;
     region.y = y;
     return region;
   });
 }
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:7,代码来源:Regions.ts

示例3: getByID

 getByID(id: number): Promise<IJob> {
   return this.db.query('SELECT * FROM jobs WHERE id=?', id).then((rows: job_row[]) => {
     if (rows.length !== 1)
       throw new Error('Job ' + id + ' does not exist');
     return rows[0];
   });
 }
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:7,代码来源:Jobs.ts

示例4: getByName

 getByName(name: string): Promise<IPendingUser> {
   return this.db.query('SELECT * FROM users WHERE name=?', name).then((rows: pending_user_row[]) => {
     if (rows.length !== 1)
       throw new Error('Pending User ' + name + ' does not exist');
     return rows[0];
   });
 }
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:7,代码来源:PendingUsers.ts

示例5:

 return Promise.all(rows.map((r: inventoryItem) => {
   let v: inventoryItem = {
     assetID: r.assetType == 24 ? uuidMap[r.assetID] : r.assetID,  // type 24 is a link
     assetType: r.assetType,
     inventoryName: r.inventoryName,
     inventoryDescription: r.inventoryDescription,
     inventoryNextPermissions: r.inventoryNextPermissions,
     inventoryCurrentPermissions: r.inventoryCurrentPermissions,
     invType: r.invType,
     creatorID: r.creatorID,
     inventoryBasePermissions: r.inventoryBasePermissions,
     inventoryEveryOnePermissions: r.inventoryEveryOnePermissions,
     salePrice: r.salePrice,
     saleType: r.saleType,
     creationDate: r.creationDate,
     groupID: r.groupID,
     groupOwned: r.groupOwned,
     flags: r.flags,
     inventoryID: invMap[r.inventoryID],
     avatarID: target.UUID,
     parentFolderID: uuidMap[r.parentFolderID],
     inventoryGroupPermissions: r.inventoryGroupPermissions
   }
   return db.query('INSERT INTO inventoryitems SET ?', v);
 }))
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:25,代码来源:Inventory.ts

示例6: getByAddress

 getByAddress(address: string): Promise<IHost> {
   return this.db.query('SELECT * FROM hosts WHERE address=?', [address]).then((rows: hosts_row[]) => {
     if (rows.length == 0)
       throw new Error('Host ' + address + ' does not exist');
     return rows[0];
   });
 }
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:7,代码来源:Hosts.ts

示例7: create

 create(address: string): Promise<IHost> {
   let host: hosts_row = {
     address: address,
     port: 0,
     name: '',
     slots: 0
   }
   return this.db.query('INSERT INTO hosts SET ?', host).then((result) => {
     host.id = result.insertId;
     return host;
   });
 }
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:12,代码来源:Hosts.ts

示例8: create

 create(type: string, user: IUser, data: string): Promise<IJob> {
   let job: job_row = {
     timestamp: new Date(),
     type: type,
     user: user.UUID,
     data: data
   }
   return this.db.query('INSERT INTO jobs SET ?', job).then((result) => {
     job.id = result.insertId;
     return job;
   });
 }
开发者ID:M-O-S-E-S,项目名称:mgm,代码行数:12,代码来源:Jobs.ts


注:本文中的promise-mysql.IPool.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。